Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GPU: Always deallocate gpu_rand_state in Finalize() #3384

Merged
merged 1 commit into from
Jun 26, 2023

Conversation

mirenradia
Copy link
Contributor

Summary

This fixes #3383.

Additional background

I noticed this problem when I tried to build an application with multiple Initialize() and Finalize() calls with HIP e.g. something like:

amrex::Initialize(MPI_COMM_WORLD);
<some AMReX code>
amrex::Finalize();
amrex::Initialize(MPI_COMM_WORLD);
<some AMReX code>
amrex::Finalize();

I'm not sure if this officially supported but it works fine with CUDA (and with MPI so long as you only initialize and finalize this once outside of the above code) but not with HIP which fails at the second initialization here with the error message

amrex::Abort::0::CArena::free: unknown pointer !!!
SIGABRT

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

Src/Base/AMReX.cpp Outdated Show resolved Hide resolved
@mirenradia mirenradia changed the title HIP: Deallocate gpu_rand_state in Finalize() GPU: Always deallocate gpu_rand_state in Finalize() Jun 26, 2023
@WeiqunZhang WeiqunZhang merged commit e2d0d86 into AMReX-Codes:development Jun 26, 2023
65 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.

gpu_rand_state is not deallocated in Finalize() when using HIP
2 participants