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

ParticleContainer: Allocator Could be Runtime? #3643

Open
ax3l opened this issue Nov 27, 2023 · 2 comments
Open

ParticleContainer: Allocator Could be Runtime? #3643

ax3l opened this issue Nov 27, 2023 · 2 comments

Comments

@ax3l
Copy link
Member

ax3l commented Nov 27, 2023

The allocator in the ParticleContainer classes is a template argument, as in low level C++ objects like std::vector et al.

I think this is a bit of a design issue, impacting at least for me:

  • compile-time
  • link-time
  • maintainability
  • extensibility

in downstream codes and pyAMReX, because every template argument needs to be specialized, compiled, linked, etc.

@WeiqunZhang @atmyers do you think that long-term, we could make the PC classes using the allocator as a runtime argument, as we do in MultiFabs? This would simplify a lot for me downstream.

@AlexanderSinn
Copy link
Member

This can already be done by setting the templated allocator to amrex::PolymorphicArenaAllocator. The question is if this should be the default or maybe even the only allocator?

Currently with amrex::PolymorphicArenaAllocator one has to loop over all components of all particle tiles to set the arena. It would be nice if there were some helper functions for this, while also keeping the flexibility of having different allocators for different components.

@ax3l
Copy link
Member Author

ax3l commented Dec 1, 2023

Thanks @AlexanderSinn, I was not aware of that. I chatted with @WeiqunZhang confirming that we should be good to use the amrex::PolymorphicArenaAllocator for all our classes in BLAST codes, simplifying build times.

Yes, let's add a helper for setting all components at once.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants