Skip to content

Commit bd68665

Browse files
Use llama for particle frame and shared memory DataBox layout
Also support LLAMA frames in the IO.
1 parent 5da4754 commit bd68665

File tree

54 files changed

+852
-260
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+852
-260
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "thirdParty/llama"]
2+
path = thirdParty/llama
3+
url = https://github.com/alpaka-group/llama

include/picongpu/algorithms/Set.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ namespace picongpu
3333
}
3434

3535
template<typename Dst, typename T_Worker>
36-
HDINLINE void operator()(T_Worker const&, Dst& dst) const
36+
HDINLINE void operator()(T_Worker const&, Dst&& dst) const
3737
{
38-
dst = value;
38+
std::forward<Dst>(dst) = value;
3939
}
4040

4141
private:

include/picongpu/algorithms/Velocity.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ namespace picongpu
2828
struct Velocity
2929
{
3030
template<typename MomType, typename MassType>
31-
HDINLINE MomType operator()(const MomType mom, const MassType mass0)
31+
HDINLINE auto operator()(const MomType mom, const MassType mass0)
3232
{
3333
const float_X rc2 = MUE0_EPS0;
3434
const float_X m0_2 = mass0 * mass0;

include/picongpu/fields/FieldJ.kernel

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ namespace picongpu
131131
// The rest uses normal weighting
132132
const float_X weighting = particle[weighting_];
133133
Velocity velocity;
134-
const float3_X vel = velocity(particle[momentum_], attribute::getMass(weighting, particle));
134+
const float3_X vel
135+
= velocity(static_cast<float3_X>(particle[momentum_]), attribute::getMass(weighting, particle));
135136
auto fieldJShiftToParticle = jBox.shift(localCell);
136137
ParticleAlgo perParticle;
137138
perParticle(worker, fieldJShiftToParticle, pos, vel, charge, m_deltaTime);

include/picongpu/fields/FieldTmp.kernel

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,9 @@ namespace picongpu
9494
if(!forEachParticle.hasParticles())
9595
return;
9696

97-
auto cachedVal = CachedBox::create<0, typename T_TmpBox::ValueType>(worker, T_BlockDescription{});
97+
auto cachedVal = CachedBox::create<0, SharedDataBoxMemoryLayout, typename T_TmpBox::ValueType>(
98+
worker,
99+
T_BlockDescription{});
98100
Set<typename T_TmpBox::ValueType> set(float_X(0.0));
99101

100102
auto collective = makeThreadCollective<T_BlockDescription>();

include/picongpu/fields/MaxwellSolver/AddCurrentDensity.kernel

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222

2323
#include "picongpu/simulation_defines.hpp"
2424

25+
#include "picongpu/param/memory.param"
26+
2527
#include <pmacc/dimensions/SuperCellDescription.hpp>
2628
#include <pmacc/lockstep.hpp>
2729
#include <pmacc/mappings/threads/ThreadCollective.hpp>
@@ -68,7 +70,9 @@ namespace picongpu::fields::maxwellSolver
6870

6971
constexpr uint32_t cellsPerSuperCell = pmacc::math::CT::volume<SuperCellSize>::type::value;
7072

71-
auto cachedJ = CachedBox::create<0, typename FieldJ::DataBoxType::ValueType>(worker, BlockArea());
73+
auto cachedJ = CachedBox::create<0, SharedDataBoxMemoryLayout, typename FieldJ::DataBoxType::ValueType>(
74+
worker,
75+
BlockArea());
7276

7377
pmacc::math::operation::Assign assign;
7478
DataSpace<simDim> const block(

include/picongpu/fields/MaxwellSolver/FDTD/FDTDBase.kernel

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,9 @@ namespace picongpu
179179
auto srcFieldBlock = srcField.shift(beginCellIdx);
180180
auto cacheStencilArea = makeThreadCollective<StencilCfg>();
181181
auto cachedSrcField
182-
= CachedBox::create<0u, typename T_SrcBox::ValueType>(worker, StencilCfg{});
182+
= CachedBox::create<0u, SharedDataBoxMemoryLayout, typename T_SrcBox::ValueType>(
183+
worker,
184+
StencilCfg{});
183185
cacheStencilArea(worker, assign, cachedSrcField, srcFieldBlock);
184186

185187
worker.sync();

include/picongpu/fields/currentDeposition/Cache.hpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,11 @@ namespace picongpu
4848
*/
4949
template<typename T_BlockDescription, typename T_Worker, typename T_FieldBox>
5050
DINLINE static auto create(T_Worker const& worker, T_FieldBox const& fieldBox)
51-
#if(!BOOST_COMP_CLANG)
52-
-> decltype(CachedBox::create<0u, typename T_FieldBox::ValueType>(
53-
worker,
54-
std::declval<T_BlockDescription>()))
55-
#endif
5651
{
5752
using ValueType = typename T_FieldBox::ValueType;
5853
/* this memory is used by all virtual blocks */
59-
auto cache = CachedBox::create<0u, ValueType>(worker, T_BlockDescription{});
54+
auto cache
55+
= CachedBox::create<0u, SharedDataBoxMemoryLayout, ValueType>(worker, T_BlockDescription{});
6056

6157
Set<ValueType> set(ValueType::create(0.0_X));
6258
auto collectiveFill = makeThreadCollective<T_BlockDescription>();
@@ -90,9 +86,6 @@ namespace picongpu
9086
*/
9187
template<typename T_BlockDescription, typename T_Worker, typename T_FieldBox>
9288
DINLINE static auto create([[maybe_unused]] T_Worker const& worker, T_FieldBox const& fieldBox)
93-
#if(!BOOST_COMP_CLANG)
94-
-> T_FieldBox
95-
#endif
9689
{
9790
return fieldBox;
9891
}

include/picongpu/fields/incidentField/Solver.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,9 @@ namespace picongpu
283283
using IntVector = pmacc::math::Vector<int, simDim>;
284284
auto const beginLocalUserIdx
285285
= Index{math::max(IntVector{beginUserIdx - totalCellOffset}, IntVector::create(0))};
286-
auto const endLocalUserIdx
287-
= Index{math::min(IntVector{endUserIdx - totalCellOffset}, IntVector{localDomain.size})};
286+
auto const endLocalUserIdx = Index{math::min(
287+
IntVector{endUserIdx - totalCellOffset},
288+
static_cast<const IntVector&>(localDomain.size))};
288289

289290
// Check if we have any active cells in the local domain
290291
bool areAnyCellsInLocalDomain = true;

include/picongpu/param/memory.param

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,4 +114,19 @@ namespace picongpu
114114
*/
115115
constexpr bool fieldTmpSupportGatherCommunication = true;
116116

117+
struct ParticleFrameMemoryLayout
118+
: llama::mapping::BindSoA<llama::mapping::Blobs::Single, llama::mapping::SubArrayAlignment::Align>
119+
{
120+
inline static constexpr bool splitVector = false;
121+
};
122+
123+
struct ParticleFrameMemoryLayoutOpenPMD : llama::mapping::BindSoA<llama::mapping::Blobs::OnePerField>
124+
{
125+
inline static constexpr bool splitVector = false;
126+
};
127+
128+
struct SharedDataBoxMemoryLayout : llama::mapping::BindAoS<>
129+
{
130+
inline static constexpr bool splitVector = false;
131+
};
117132
} // namespace picongpu

0 commit comments

Comments
 (0)