Use this guide whenever you orchestrate explorers/workers inside the AMReX repository. It keeps PR reviews, bug hunts, new features, docs, and user support consistent for contributors and AI copilots alike.
- AMReX developers – follow a predictable workflow so fixes/features land quickly and safely.
- AMReX users – receive accurate build/test/docs guidance sourced from the repo.
Src/– Core C++/Fortran implementation.Amr*manage hierarchy/regridding,Basehosts runtime utilities, and folders such asBoundary,EB,LinearSolvers,Particle,FFTcontain subsystem code (check localCMakeLists.txtfor toggles).Tests/– Organized by topic; whenAMReX_ENABLE_TESTS=ON, they exposectesttargets. Many tutorials/tests also ship aGNUmakefilefor standalone runs.Docs/– Authoritative Sphinx sources underDocs/sphinx_documentation/; Doxygen lives underDocs/Doxygen/.Tools/– Shared CMake modules, GNU make helpers, scripts.
- Default CMake flow:
Toggle options from
cmake -S . -B build \ -DAMReX_ENABLE_TESTS=ON \ -DAMReX_TEST_TYPE=Small cmake --build build -j ctest --test-dir build --output-on-failureDocs/sphinx_documentation/source/BuildingAMReX.rst(“Customization options”) andTools/CMake/AMReXOptions.cmakefor GPUs, dimensions, debug flags, etc. - Targeted builds/tests:
cmake --build build -j --target <name>for individual executables;ctest --test-dir build -R <regex>(orctest -R <regex>) to rerun impacted cases only. - GNUmakefile workflows: When a directory ships a
GNUmakefile,cdthere and runmake -jwith required variables (e.g.,DIM,USE_MPI,USE_CUDA,COMP) as documented inDocs/sphinx_documentation/source/BuildingAMReX.rstandTools/GNUMake/README.md. - Log everything: Capture exact commands plus pass/fail output in PR descriptions or linked issues so reviewers can reproduce without guessing.
- Work on short-lived topic branches; never commit directly to
development. Rebase before opening or updating a PR. - Plan before you edit. Define scope, owners, and validation steps, and use
rg(or your editor) for fast searches to avoid wandering. - Choose a build workflow from the “Build & Test Reference” and stick to it for the task; don’t restate commands elsewhere—link back and record the actual invocations you ran.
- Update user-facing docs under
Docs/sphinx_documentation/whenever behavior changes, and mention the doc edits in the same PR. - When adding Doxygen comments or Sphinx docs, write for AMReX users: explain behavior and usage, omit unnecessary implementation details, and keep the tone instructional instead of developer-oriented.
- Never log work inside
CHANGES.md; release notes are curated separately, so leave that file untouched unless maintainers ask for a release update. - Hand-off context inside PRs/issues (commands run, results, TODOs). Personal scratchpads are optional, local, and should be pruned frequently.
- AI delegation: assign disjoint write scopes, keep subtasks bounded, and serialize conflicting edits when necessary. Review every AI-generated diff like a teammate’s patch.
- Safety: never paste secrets, private datasets, or PII into prompts; scrub logs before sharing; cite sources and licensing when in doubt by escalating to maintainers.
- Testing accountability: every substantive change must state which tests ran (and command lines) in the PR/issue.
- Historical hotspots: mirrored kernels and dimension-specific paths often drift—compare siblings whenever you touch them.
AMREX_GPU_DEVICE/ParallelForlambdas run on the GPU, so never capture host-only pointers (e.g.,Geometry::CellSize(),Geometry::ProbLo()). Take the device-safe views first—e.g.,auto const dx = geom.CellSizeArray();,auto const problo = geom.ProbLoArray();—and pass those by value into the lambda.
- Sync & scope – Update the branch, read the PR/issue description, and note ownership expectations.
- Reproduce – Follow the reporter’s steps or minimal
ctest/makeinvocations from the Build & Test Reference. - Inspect diffs – Check style, compare mirrored kernels/dimensional variants, and look for missing constant updates.
- Verify – Run the focused tests (GPU flags,
-DAMReX_TEST_TYPE=Small, GNU make targets, etc.) and capture output. - Report – List blockers first, cite files/lines, and record the commands/tests in the PR.
- Follow-ups – Document remaining work in the PR/issue; use a scratchpad only for personal reminders.
- Confirm requirements – Capture physics context, success metrics, and acceptance tests from the originating ticket.
- Configure builds – Apply the Build & Test Reference workflow that matches the directory; use targeted targets/tests for fast iteration.
- Implement carefully – Touch only owned files, note tricky code with short comments, and maintain coding-style guidelines.
- Update docs – When behavior or UX changes, add/adjust content in the relevant
Docs/sphinx_documentation/section (User’s Guide, Technical Reference, tutorials, etc.). - Validate – Run and record the necessary
ctest/makecommands plus any benchmarking or profiling relevant to the change. - Hand off – Summarize status, remaining risks, and next steps in the PR description; attach log excerpts only if scrubbed.
- Mirror the hierarchy noted in
README.md(User’s Guide, Example Codes, Guided Tutorials, Technical Reference) so published docs stay synchronized. - Surface any new build knobs/workflows in
Docs/sphinx_documentation/source/BuildingAMReX.rst. - Reference runnable examples in
Tutorials/README.mdorhttps://github.com/AMReX-Codes/amrex-tutorialswhen guiding users.
- Orientation – Summarize capabilities using the “Overview,” “Features,” and “Documentation” sections of
README.md, then link users to the best resource (User’s Guide, Example Codes, Guided Tutorials, Technical Reference). - Build help – Walk through the Build & Test Reference commands, clarifying how to toggle features via
-DVAR=valueormakevariables the tutorial expects. - Learning resources – Point to the tutorials repo plus any slides/videos referenced near the Documentation section of
README.md. - Authoritative sources – Read directly from
Docs/sphinx_documentation/when answering doc questions so citations match the published site. - Support channels – Encourage GitHub Discussions/issues for unresolved questions and remind users that contributions follow
CONTRIBUTING.md.
A local scratchpad can help you capture quick reminders, but keep it untracked, short-lived, and private. Anything others need to know belongs in PR descriptions, issues, or review comments.
- On a topic branch rebased on
development? If not, fix it. - Do you have a written plan that names owners, validation, and Build & Test commands? If not, write one before editing.
- Are tests/docs updated and the exact commands/results logged in the PR/issue? If not, add them.
- Are delegation, safety, and hand-off notes captured in canonical threads (not just scratchpads)? If not, update them now.