Modernize Python tutorials#176
Open
ax3l wants to merge 1 commit into
Open
Conversation
- HeatEquation: read runtime parameters via ParmParse from the C++ inputs file (closes the long-standing TODO); forward command line arguments to AMReX so `python3 main.py ../Exec/inputs` mirrors the C++ binary; use the `Array4.to_xp()` zero-copy views. - MultiFab: use `Array4.to_xp()`, forward command line arguments, demonstrate global min/max/sum reductions. - MPMD Case-2: forward command line arguments. - CI: pass the inputs file to the HeatEquation Python runs and add an MPI-parallel (2 ranks) Python run. - Docs: rewrite the Python tutorials page with install/run conventions. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
ax3l
commented
Jun 5, 2026
Comment on lines
102
to
+127
| @@ -121,8 +123,8 @@ def main(n_cell, max_grid_size, nsteps, plot_int, dt): | |||
| # new_phi = old_phi + dt * Laplacian(old_phi) | |||
| # Loop over boxes | |||
| for mfi in phi_old: | |||
| phiOld = xp.array(phi_old.array(mfi), copy=False) | |||
| phiNew = xp.array(phi_new.array(mfi), copy=False) | |||
| phiOld = phi_old.array(mfi).to_xp(copy=False, order="C") | |||
| phiNew = phi_new.array(mfi).to_xp(copy=False, order="C") | |||
Member
Author
There was a problem hiding this comment.
Could make the below code F-order... looks then more like C++-AMReX with its Fortran-ordered Array4
Member
Author
There was a problem hiding this comment.
On the other hand, that will complicate the PR diff here. Can be a follow-up PR.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
python3 main.py ../Exec/inputsmirrors the C++ binary; use theArray4.to_xp()zero-copy views.Array4.to_xp(), forward command line arguments, demonstrate global min/max/sum reductions.