Skip to content

Remove uses of Box range version of amrex::launch#4890

Merged
WeiqunZhang merged 2 commits intoAMReX-Codes:developmentfrom
AlexanderSinn:Remove_uses_of_Box_range_version_of_amrex__launch
Jan 12, 2026
Merged

Remove uses of Box range version of amrex::launch#4890
WeiqunZhang merged 2 commits intoAMReX-Codes:developmentfrom
AlexanderSinn:Remove_uses_of_Box_range_version_of_amrex__launch

Conversation

@AlexanderSinn
Copy link
Copy Markdown
Member

@AlexanderSinn AlexanderSinn commented Jan 11, 2026

Summary

There are two very different types of functions called amrex::launch. One gives raw access to a GPU block to be used with shared memory. The other type iterates over threads more like ParallelFor but gives a Box to the functor, not an IntVect. For GPU the box will only have one element, for CPU this is the same box that was passed into launch. This was used to quickly port amrex CPU code to GPU. However, I find this quite confusing.

This PR replaces the uses of the second type of launch inside amrex with ParallelFor and removes the section in the documentation that covered it. This avoids having to write the 4D loop inside every kernel.

TODO (in a future PR?): replace ...LAMBDA_RANGE macros used in LinearSolvers.

Additional background

Checklist

The proposed changes:

  • fix a bug or incorrect behavior in AMReX
  • add new capabilities to AMReX
  • changes answers in the test suite to more than roundoff level
  • are likely to significantly affect the results of downstream AMReX users
  • include documentation in the code and/or rst files, if appropriate

@ankithadas
Copy link
Copy Markdown
Contributor

There are more instances of such device launches in the linear solvers; there are several AMREX_LAUNCH_HOST_DEVICE_LAMBDA calls that do the same thing. I don't think we are ready to remove documentation regarding this yet.

@WeiqunZhang WeiqunZhang merged commit d8280a3 into AMReX-Codes:development Jan 12, 2026
74 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants