-
Notifications
You must be signed in to change notification settings - Fork 421
[WIP] Add simpler version of ParticleTile using 2D array #4404
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
base: development
Are you sure you want to change the base?
[WIP] Add simpler version of ParticleTile using 2D array #4404
Conversation
…rticleTile_using_2D_array
…rticleTile_using_2D_array
Hi @AlexanderSinn - is this still something you're working on? Do you think it would be worthwhile to keep pushing on this? |
Yes. There is still a lot left to do. I am waiting for Axel to return and give feedback first |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a great start!
Let's finalize the naming to be more descriptive and implementation :)
## Summary In preparation of #4404, this PR reduces the reliance of SuperParticle. The issue with getSuperParticle is that the compiler is instructed to read in all the data of the particle into registers even if most of it is not needed. Additionally, runtime data is not accessible through SuperParticle. ## Additional background The previous version of packIOData with RunOnGpu had a bug when some particles were invalid. ## Checklist The proposed changes: - [x] 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 --------- Co-authored-by: Andrew Myers <[email protected]>
…rticleTile_using_2D_array
## Summary This PR adds a `SetArena(Arena*)` function to ParticleContainerBase that allows setting a memory arena that is used for all the particle vectors if the allocator is PolymorphicArenaAllocator. The function has to be called before particle tiles are defined. This functionality is used to fix a bunch of places where a polymorphic vector would previously not have its arena set properly. Additionally the `RunOnGpu` logic in `AMReX_WriteBinaryParticleData.H` is extended to work with a polymorphic allocator. Uses changes extracted from #4404. ## Additional background Previously all components of all particle tiles needed their arena set individually by the user if PolymorphicArenaAllocator was used. In case this was done this PR is a braking change due to the `AMREX_ALWAYS_ASSERT_WITH_MESSAGE(a_arena != nullptr` assert in `ParticleTile::define()`. ## Checklist The proposed changes: - [ ] fix a bug or incorrect behavior in AMReX - [x] 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
Summary
This PR aims to explore adding a simpler version of ParticleTile #3570
It already assumes that a tile only has runtime components and always has a polymorphic arena allocator as described in #4380. To avoid the array of pointer style of the current particle tile, here a 2D array over particle ids and component ids is used. As a simplification both AoS and SoA members have been removed as well as all the push_back functions.
Performance test with HiPACE++:
dev, ParticleContainerPureSoA<11, 1>
ParticleContainerPureSoA<0, 0> using only runtime components
this PR, ParticleContainerPureSoA2<amrex::Real, int>
Additional background
ParticleReal and int are replaced with template types to make implementing the const versions easier and to allow for more flexibility in the future (use double and float in the same application, use double2 or float4, use 64 bit int etc).
Checklist
The proposed changes: