Skip to content

Conversation

@AlexanderSinn
Copy link
Member

@AlexanderSinn AlexanderSinn commented Nov 19, 2025

Summary

This PR adds the function amrex::Gpu::streamFree (Arena* arena, void* mem) that can be used to free memory the next time the current GPU stream is synchronized.

This is based on #4432 but with much reduced complexity from OMP.
The interface is now opt-in and always available, instead of needing to be enabled using runtime parameters.

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

@WeiqunZhang
Copy link
Member

/run-hpsf-gitlab-ci

@github-actions
Copy link

GitLab CI has started at https://gitlab.spack.io/amrex/amrex/-/pipelines/1319922.

@amrex-gitlab-ci-reporter
Copy link

GitLab CI 1319922 finished with status: success. See details at https://gitlab.spack.io/amrex/amrex/-/pipelines/1319922.

@AlexanderSinn
Copy link
Member Author

Maybe this should be named asyncFree or freeAsync instead.

@WeiqunZhang
Copy link
Member

I like freeAsync, which is similar to copyAsync.

@AlexanderSinn
Copy link
Member Author

For a case with very few particles, this helps to significantly improve the performance of hipace shiftSlippedParticles (which calls amrex::partitionParticles) by removing two stream synchronizes.

AMReX dev, 79 µs on the GPU:

image

Using this PR, 59 µs on the GPU:

image

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.

2 participants