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

Support SoA-Only Particles #2878

Merged
merged 123 commits into from Apr 17, 2023

Conversation

Thierry992
Copy link
Contributor

@Thierry992 Thierry992 commented Jul 15, 2022

Summary

Further updates of #2853 where @atmyers and @ax3l can also push to.

Upgrade Guide for C++ API Changes

These PRs show changes to keep using the old layout:

These PRs show changes to use the new layout (pure SoA):

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

@ax3l ax3l mentioned this pull request Aug 18, 2022
5 tasks
@ax3l ax3l requested review from atmyers and ax3l August 25, 2022 17:42
@ax3l ax3l marked this pull request as ready for review September 3, 2022 00:30
@ax3l
Copy link
Member

ax3l commented Sep 6, 2022

@Thierry992 @atmyers let us make sure this PR is passing this week, because @Thierry992 and @np-eazy will use this in ImpactX for the hackathon next week :)

@ax3l ax3l changed the title [WIP] Particle soa refactor Support SoA-Only Particles Sep 6, 2022
atmyers pushed a commit that referenced this pull request May 24, 2023
## Summary

* fix return by value/reference mismatch of `id()` and `cpu()` with
`decltype(auto)`
* update `packParticleData` and `unpackParticleData` for PureSoA
* change `getSuperParticle` and add `setSuperParticle` for PureSoA.
Remaining issue: super particle has redundant/unused fields for
positions, id and cpu
* update `ConstParticleTileData` for PureSoA
* don’t call `getParticleTileData` in `ParticleTile::id()` etc. as this
could be very slow if used in a for loop
* use if constexpr instead if SFINAE in a number of places
* change PODVector constructor so that `getParticleTileData()` won't
allocate memory if no runtime components are used

## Additional background

Follow-up to #2878.

## 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
ax3l added a commit that referenced this pull request May 31, 2023
Follow-up to #2878.

The proposed changes:
- [x] 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

Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
@ax3l ax3l mentioned this pull request Jun 1, 2023
5 tasks
WeiqunZhang pushed a commit that referenced this pull request Jun 6, 2023
## Summary

Ideally we do not need them, because 2B particles
generated per GPU is very low, but we do need this temporarily until we
find a way to generalize large id values again for pure SoA particle
layouts.

cc @AlexanderSinn 

## Additional background

Follow-up to #2878.

## 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
guj pushed a commit to guj/amrex that referenced this pull request Jul 13, 2023
## Summary

Remove the `restrict` qualifier from `GpuArray` members in
`ParticleTileData`. We see compilation problems with, among others Clang
14.0.6 and AppleClang, for this construct.

We expect that using `restrict` (`AMREX_RESTRICT`) on APIs as well as
aliased pointers in these arrays before access should be sufficient to
prevent that the compiler thinks that individual arrays alias each other
in hot loops.

## Additional background

- WarpX build regressions since 23.03, e.g.,
  - conda-forge/warpx-feedstock#63
  - conda-forge/warpx-feedstock#64
  - ECP-WarpX/WarpX#3817
- independently, about to be remove in
AMReX-Codes#2878
guj pushed a commit to guj/amrex that referenced this pull request Jul 13, 2023
Add support for storing particle positions and ids SoA style.

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
- [x] 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 <atmyers2@gmail.com>
Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
guj pushed a commit to guj/amrex that referenced this pull request Jul 13, 2023
## Summary

Update to use the new `ParticleTile` template parameters.

## Additional background

Follow-up to AMReX-Codes#2878.

## 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
guj pushed a commit to guj/amrex that referenced this pull request Jul 13, 2023
Follow-on to AMReX-Codes#2878

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
atmyers added a commit that referenced this pull request Jul 28, 2023
## Summary

Add support for pure SoA layouted particle containers for SENSEI.

## Additional background

Follow-up to #2878.

## 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

---------

Co-authored-by: Andrew Myers <atmyers2@gmail.com>
atmyers pushed a commit that referenced this pull request Sep 22, 2023
## Summary

When using a PureSoA particle container, trying to access the AoS
components will now result in a compile-time error.

Previously it still compiled, and I suspect it even allocated memory for
AoS.
New error message:
```
/hipace/src/Hipace.cpp:1499:39: error: ‘struct amrex::ThisParticleTileHasNoAoS’ has no member named ‘begin’
 1499 |         const auto& pos_structs = aos.begin() + nreal;
      |                                       ^~~~~
```
Using this I found more places that needed to be updated to account for
PureSoA.


PureSoA still has the following issues:
- [x] I believe it’s not possible to use the binning functions (in
`DenseBins.H`) as they require a particle pointer.
- [ ] The `ParticleTileData` struct that is used to access SoA data can
be very large, over 300 bytes in some cases. I recommend changing the
array-of-pointers to a full 2D array. This way ParticleTileData could be
as small as 24 bytes (real pointer, int pointer, stride).


## Additional background

Follow-up to #2878.

## 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: Axel Huebl <axel.huebl@plasma.ninja>
atmyers added a commit that referenced this pull request Nov 21, 2023
## Summary

Add support for pure SoA layouted particle containers for Ascent.

## Additional background

Follow-up to #2878.

## 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

---------

Co-authored-by: Andrew Myers <atmyers2@gmail.com>
guj pushed a commit to guj/amrex that referenced this pull request Dec 13, 2023
## Summary

Add support for pure SoA layouted particle containers for Ascent.

## Additional background

Follow-up to AMReX-Codes#2878.

## 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

---------

Co-authored-by: Andrew Myers <atmyers2@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants