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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
123 commits
Select commit Hold shift + click to select a range
dc0e7c1
Begin refactor of particle classes to allow positions and ids in SoA …
atmyers Jun 23, 2022
95357fa
do not redefine default arguments
atmyers Jun 23, 2022
9900521
Sprint: Add New Tile Interfaces
Thierry992 Jul 15, 2022
27cf58d
Last functions added to the Soa Particle struct
Thierry992 Jul 19, 2022
b750561
main file
Thierry992 Aug 1, 2022
0fc0c4a
Adding particle type corrections
Thierry992 Aug 3, 2022
56d6297
Adding particle type corrections
Thierry992 Aug 3, 2022
bb0f1c9
Adding correction to the cpu function
Thierry992 Aug 10, 2022
1fcfc22
test git push
Thierry992 Aug 10, 2022
528a67d
Merge branch 'thierry_soa_particle' of https://github.com/Thierry992/…
Thierry992 Aug 10, 2022
eba049f
Correcting the "!" and switching id/cpu index
Thierry992 Aug 10, 2022
ba3e58e
Still correcting Type errors
Thierry992 Aug 16, 2022
8b0daaf
fixing some compile errors, some still remain.
atmyers Aug 17, 2022
9221328
Adding new struct with N=0 output to GPU Array
Thierry992 Aug 19, 2022
d75a35c
Correction to a typing error
Thierry992 Aug 19, 2022
517970f
Compute a forward Declaration of SoAPartile class
Thierry992 Aug 19, 2022
158116c
Correcting the *void error
Thierry992 Aug 23, 2022
d03bd32
First version of the code that compiles !
Thierry992 Aug 25, 2022
79ab70d
Fixed test ParticleTransformation
Thierry992 Aug 25, 2022
7f97952
First compile with debug mode
Thierry992 Aug 25, 2022
6ab3e31
Correcting Particle Container Type in ParIter.H
Thierry992 Aug 26, 2022
bb9d53c
new main function
Thierry992 Aug 30, 2022
0c9aa59
Reset: `AMReX_Array.H`
ax3l Sep 6, 2022
5f2cab6
Example: Fix Unused Vars
ax3l Sep 7, 2022
3152370
Creating MakeParticle file to adapt to the new particle constructor
Thierry992 Sep 12, 2022
68d4652
Correcting ParIter.H file header
Thierry992 Sep 12, 2022
090e762
Forward Declarations in ParIter.H
Thierry992 Sep 12, 2022
1d7a48d
Add NexId function to the SoAParticle Structure
Thierry992 Sep 13, 2022
3ee712f
Replace the ConstParticleTileData at the top
Thierry992 Sep 13, 2022
52e90ae
Add rdata and idata to SoAParticle
Thierry992 Sep 14, 2022
6c39278
deleted one redundance getsuperparticle
Thierry992 Sep 14, 2022
d09f797
Write GetSuperParticle for SoAParticle
Thierry992 Sep 14, 2022
d5d8c1f
Fix the ReduceOp for the SoA Particle struct
Thierry992 Sep 19, 2022
ada7a1f
Function to get rdata and idata from ParticleTileData
Thierry992 Sep 21, 2022
58e7274
Adding test to SoAParticle main.cpp
Thierry992 Sep 22, 2022
d4388f9
Fix Particle Iterator Type & Pinned Real Vector
ax3l Sep 23, 2022
80d41aa
Clean up Formatting
ax3l Sep 23, 2022
b237dc5
Add tmp.copyParticles
ax3l Sep 23, 2022
c36f149
Adding corrections and test to amrex soa particle
Thierry992 Sep 26, 2022
ef82e8f
new main test
Thierry992 Sep 26, 2022
4cc5a49
trying to correct .copyParticles for SoA
Thierry992 Sep 26, 2022
9accbf1
Adapting the copyParticles function to SoAParticle
Thierry992 Sep 27, 2022
691a93c
Adapt new features to SoAParticles
Thierry992 Sep 28, 2022
8516860
Adapting ParticleContainerI.H to SoA
Thierry992 Sep 29, 2022
5f51d4b
Rewrote numParticlesOutOfRange and add constructor to SoAParticle
Thierry992 Oct 3, 2022
e9c91e5
Create a ConstSoAParticle class
Thierry992 Oct 3, 2022
db5b1f4
Adding ConstSoAParticle
Thierry992 Oct 4, 2022
9a47bfa
Still have to solve the enable_if error message
Thierry992 Oct 8, 2022
972095c
Adapating ParticleContainerI.H file to SoA
Thierry992 Oct 11, 2022
4b67ffa
Correcting the ParticleContainerI.H file to SoA
Thierry992 Oct 11, 2022
8b0a527
Commenting memcpy part
Thierry992 Oct 13, 2022
7fef711
Commenting memcpy part
Thierry992 Oct 13, 2022
a7b7344
Not incrementing the dst pointer by 1
Thierry992 Oct 13, 2022
8a7038a
Not incrementing the +1 in superparticle_size
Thierry992 Oct 13, 2022
9b1da5c
set Particlesize to zero
Thierry992 Oct 13, 2022
74e05d8
fix test
atmyers Oct 14, 2022
203346b
fix extraneous bracket
atmyers Oct 14, 2022
af5d227
Squashed commit of the following:
atmyers Nov 2, 2022
4d9bf4c
Squashed commit of the following:
atmyers Nov 2, 2022
c036e3e
Merge branch 'development' into particle_soa_refactor
atmyers Nov 2, 2022
95b053d
fix no-effect const
atmyers Nov 3, 2022
226181c
fix id() and cpu() for ConstSoAParticle too
atmyers Nov 3, 2022
aa5e7dd
add AMReX_MakeParticle.H to Make.package and CMakeLists.txt
atmyers Nov 3, 2022
1afb6f6
remove unused
atmyers Nov 3, 2022
a5c800f
remove unused
atmyers Nov 3, 2022
703d481
Merge remote-tracking branch 'mainline/development' into particle_soa…
ax3l Jan 2, 2023
6a522bf
Merge remote-tracking branch 'mainline/development' into particle_soa…
ax3l Feb 14, 2023
5614975
Fix: Unused Variables/Typedefs
ax3l Feb 15, 2023
04fd51b
PureSoA Test: ID Assignment
ax3l Feb 15, 2023
5df2b0b
Remove EOL Whitespaces
ax3l Feb 15, 2023
a580f7b
[Work-Around] GPUArray & Particle Type
ax3l Feb 15, 2023
be35983
ParticleTileData: Remove Debug Static Assert
ax3l Feb 15, 2023
fb37837
Cleanup ConstType Traits
ax3l Feb 15, 2023
c9f1402
Fix: ConstSoAParticle is SoAParticle
ax3l Feb 15, 2023
a026399
ConstSOAParticle: Add Missing Forward Declaration
ax3l Feb 15, 2023
0fc9623
Constructor Cosmetics
ax3l Feb 15, 2023
0187ac9
remove restrict from these members of ConstParticleTileData
atmyers Feb 16, 2023
e4a8f0e
fix applying periodic shift to the particle send buffer
atmyers Feb 16, 2023
df1a2e9
Merge branch 'particle_soa_refactor' of github.com:Thierry992/amrex i…
atmyers Feb 16, 2023
1c6134f
ParticleTile: Fix Const Access
ax3l Feb 16, 2023
2c4a6e5
remove now unused type alias
atmyers Feb 16, 2023
d286e8b
fix out of bounds access
atmyers Feb 16, 2023
c044a29
also constexpr when unpacking on CPU for GPU runs
atmyers Feb 16, 2023
df3d866
fix warnings
atmyers Feb 16, 2023
6bb4b0e
fix make_particle for legacy particle type
atmyers Feb 16, 2023
b72780e
some host / device annotations
atmyers Feb 16, 2023
99b49d2
More Host-Device
ax3l Feb 16, 2023
09acfd0
add missing include guard
atmyers Feb 16, 2023
5d1e9fd
some make_particle in ParticleUtil.H
atmyers Feb 16, 2023
b37fe61
remove old assert and add constexpr if
atmyers Feb 16, 2023
807ab00
Merge branch 'particle_soa_refactor' of github.com:Thierry992/amrex i…
atmyers Feb 16, 2023
49f672c
Cleaning
ax3l Feb 16, 2023
5af2224
SOAParticle: 1D and 2D Support
ax3l Feb 16, 2023
3bd8972
ParticleTile: Const Ptr Interfaces
ax3l Feb 16, 2023
f2bdf6f
SOAParticlTest: Improve & Clean
ax3l Feb 16, 2023
602a081
fix a couple of redistribute bugs
atmyers Feb 17, 2023
d501811
Merge branch 'particle_soa_refactor' of github.com:Thierry992/amrex i…
atmyers Feb 17, 2023
aa244d9
fix CPU redistribute with pure SOA particles
atmyers Feb 17, 2023
da0c032
Merge remote-tracking branch 'mainline/development' into particle_soa…
ax3l Apr 6, 2023
610c130
fix up RedistributeGPU for SOA particles
atmyers Apr 7, 2023
5599501
merging
atmyers Apr 7, 2023
1047e01
fix bad merge
atmyers Apr 7, 2023
867f298
remove unused
atmyers Apr 7, 2023
6f0e1c0
removed unused typedef
atmyers Apr 7, 2023
00ebbd9
use auto
atmyers Apr 7, 2023
cc9880b
use auto*
atmyers Apr 7, 2023
07d73cd
test did not have enough components for what it's doing
atmyers Apr 7, 2023
e3fd907
merging with development
atmyers Apr 7, 2023
c4f92eb
make the return type of MakeParticle const
atmyers Apr 7, 2023
0576ec1
pass by const&
atmyers Apr 7, 2023
c96cbd8
handle different id numbers in RedistributeMPI
atmyers Apr 8, 2023
b8c7acf
auto const
atmyers Apr 8, 2023
acaf3a4
remove auto const
atmyers Apr 8, 2023
94a5ada
Compiler Warnings: Const & Narrowing ID
ax3l Apr 9, 2023
8c91aef
More Narrorwing Conversions
ax3l Apr 9, 2023
0d8bf58
modernize loop as per linter
ax3l Apr 9, 2023
57a66d7
Destructor: override -> virtual
ax3l Apr 9, 2023
34326a5
Revert last change in destructor
ax3l Apr 9, 2023
3d2c49f
Re-add NOLINT
ax3l Apr 10, 2023
00c28c8
RedistributeSOA/main.cpp more clang-tidy
ax3l Apr 10, 2023
4617137
2x modernize-auto
ax3l Apr 10, 2023
adc1db9
Avoid copy
ax3l Apr 10, 2023
6afa7f6
Merge remote-tracking branch 'mainline/development' into particle_soa…
ax3l Apr 17, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
45 changes: 26 additions & 19 deletions Src/AmrCore/AMReX_AmrParticles.H
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@

namespace amrex {

template <int NStructReal, int NStructInt, int NArrayReal, int NArrayInt,
template <typename ParticleType, int NArrayReal, int NArrayInt,
template<class> class Allocator>
void
ParticleContainer<NStructReal, NStructInt, NArrayReal, NArrayInt, Allocator>
ParticleContainer_impl<ParticleType, NArrayReal, NArrayInt, Allocator>
::AssignDensity (int rho_index,
Vector<std::unique_ptr<MultiFab> >& mf_to_be_filled,
int lev_min, int ncomp, int finest_level, int ngrow) const
Expand Down Expand Up @@ -249,40 +249,47 @@ ParticleToMesh (PC const& pc, const Vector<MultiFab*>& mf,
}
}

template <int NStructReal, int NStructInt=0, int NArrayReal=0, int NArrayInt=0,
template <typename T_ParticleType, int NArrayReal=0, int NArrayInt=0,
template<class> class Allocator=DefaultAllocator>
class AmrParticleContainer // NOLINT
: public ParticleContainer<NStructReal, NStructInt, NArrayReal, NArrayInt, Allocator>
class AmrParticleContainer_impl // NOLINT(cppcoreguidelines-virtual-class-destructor)
: public ParticleContainer_impl<T_ParticleType, NArrayReal, NArrayInt, Allocator>
{

public:

typedef Particle<NStructReal, NStructInt> ParticleType;
using ParticleType = T_ParticleType;

AmrParticleContainer () = default;
AmrParticleContainer_impl ()
: ParticleContainer_impl<ParticleType, NArrayReal, NArrayInt, Allocator>()
{
}

AmrParticleContainer (AmrCore* amr_core)
: ParticleContainer<NStructReal, NStructInt, NArrayReal, NArrayInt, Allocator>(amr_core->GetParGDB())
AmrParticleContainer_impl (AmrCore* amr_core)
: ParticleContainer_impl<ParticleType, NArrayReal, NArrayInt, Allocator>(amr_core->GetParGDB())
{
}

AmrParticleContainer (const Vector<Geometry> & geom,
const Vector<DistributionMapping> & dmap,
const Vector<BoxArray> & ba,
const Vector<int> & rr)
: ParticleContainer<NStructReal, NStructInt, NArrayReal, NArrayInt, Allocator>(geom, dmap, ba, rr)
AmrParticleContainer_impl (const Vector<Geometry> & geom,
const Vector<DistributionMapping> & dmap,
const Vector<BoxArray> & ba,
const Vector<int> & rr)
: ParticleContainer_impl<ParticleType, NArrayReal, NArrayInt, Allocator>(geom, dmap, ba, rr)
{
}

~AmrParticleContainer () override = default;
~AmrParticleContainer_impl () override = default;
ax3l marked this conversation as resolved.
Show resolved Hide resolved

AmrParticleContainer ( const AmrParticleContainer &) = delete;
AmrParticleContainer& operator= ( const AmrParticleContainer & ) = delete;
AmrParticleContainer_impl ( const AmrParticleContainer_impl &) = delete;
AmrParticleContainer_impl& operator= ( const AmrParticleContainer_impl & ) = delete;

AmrParticleContainer ( AmrParticleContainer && ) noexcept = default;
AmrParticleContainer& operator= ( AmrParticleContainer && ) noexcept = default;
AmrParticleContainer_impl ( AmrParticleContainer_impl && ) noexcept = default;
AmrParticleContainer_impl& operator= ( AmrParticleContainer_impl && ) noexcept = default;
};

template <int T_NStructReal, int T_NStructInt=0, int T_NArrayReal=0, int T_NArrayInt=0,
template<class> class Allocator=DefaultAllocator>
using AmrParticleContainer = AmrParticleContainer_impl<Particle<T_NStructReal, T_NStructInt>, T_NArrayReal, T_NArrayInt, Allocator>;

class AmrTracerParticleContainer
: public TracerParticleContainer
{
Expand Down
1 change: 1 addition & 0 deletions Src/Base/AMReX_Array.H
Original file line number Diff line number Diff line change
Expand Up @@ -897,3 +897,4 @@ namespace amrex
}

#endif

1 change: 1 addition & 0 deletions Src/Base/AMReX_Geometry.H
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ public:
[[nodiscard]] GpuArray<ParticleReal,AMREX_SPACEDIM> ProbLoArrayInParticleReal () const noexcept {
return roundoff_lo;
}

[[nodiscard]] GpuArray<ParticleReal,AMREX_SPACEDIM> ProbHiArrayInParticleReal () const noexcept {
return roundoff_hi;
}
Expand Down
18 changes: 9 additions & 9 deletions Src/Base/AMReX_TypeTraits.H
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,17 @@ namespace amrex
struct IsMultiFabIterator : public std::is_base_of<MFIter, T>::type {};

#ifdef AMREX_PARTICLES
template <bool is_const, int NStructReal, int NStructInt, int NArrayReal, int NArrayInt,
template<class> class Allocator>
class ParIterBase;
// template <bool is_const, int NStructReal, int NStructInt, int NArrayReal, int NArrayInt,
// template<class> class Allocator>
// class ParIterBase;

template <int NStructReal, int NStructInt, int NArrayReal, int NArrayInt,
template<class> class Allocator>
class ParIter;
// template <int NStructReal, int NStructInt, int NArrayReal, int NArrayInt,
// template<class> class Allocator>
// class ParIter;

template <int NStructReal, int NStructInt, int NArrayReal, int NArrayInt,
template<class> class Allocator>
class ParConstIter;
// template <int NStructReal, int NStructInt, int NArrayReal, int NArrayInt,
// template<class> class Allocator>
// class ParConstIter;

class ParticleContainerBase;

Expand Down
1 change: 0 additions & 1 deletion Src/EB/AMReX_EB2.H
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ void Build (const Geometry& geom,
bool extend_domain_face = ExtendDomainFace(),
int num_coarsen_opt = NumCoarsenOpt());


void BuildFromChkptFile (std::string const& fname,
const Geometry& geom,
int required_coarsening_level,
Expand Down