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

PureSoA: Disable AoS Access #3290

Merged
merged 17 commits into from
Sep 22, 2023

Conversation

AlexanderSinn
Copy link
Member

@AlexanderSinn AlexanderSinn commented May 2, 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:

  • 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:

  • 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/Particle/AMReX_ParIter.H Outdated Show resolved Hide resolved
@ax3l ax3l force-pushed the more_soa_fixes branch 2 times, most recently from abf12ab to 9e9dbb8 Compare May 9, 2023 00:16
@ax3l ax3l mentioned this pull request May 9, 2023
5 tasks
@ax3l ax3l changed the title More PureSoA Fixes PureSoA: Disable AoS Access May 9, 2023
atmyers pushed a commit that referenced this pull request May 15, 2023
## Summary

More updates to `ParticleTile` and simplifications for pure SoA support.

## Additional background

Isolated from #3290 and author credited to @AlexanderSinn.

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

Co-authored-by: Alexander Sinn <alexander.sinn@desy.de>
@ax3l
Copy link
Member

ax3l commented May 26, 2023

For the errors in

detected during instantiation of "void amrex::ParticleContainer_impl<T_ParticleType, T_NArrayReal, T_NArrayInt, Allocator>::InitRandom

I started porting those in #3280

@ax3l ax3l mentioned this pull request Jun 6, 2023
9 tasks
@ax3l ax3l assigned atmyers and WeiqunZhang and unassigned atmyers Sep 22, 2023
@atmyers atmyers merged commit 2e99628 into AMReX-Codes:development Sep 22, 2023
64 of 66 checks passed
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