diff --git a/include/picongpu/algorithms/Set.hpp b/include/picongpu/algorithms/Set.hpp index 938613bf8c0..d0084cf61cc 100644 --- a/include/picongpu/algorithms/Set.hpp +++ b/include/picongpu/algorithms/Set.hpp @@ -33,9 +33,9 @@ namespace picongpu } template - HDINLINE void operator()(T_Worker const&, Dst& dst) const + HDINLINE void operator()(T_Worker const&, Dst&& dst) const { - dst = value; + std::forward(dst) = value; } private: diff --git a/include/picongpu/fields/FieldJ.kernel b/include/picongpu/fields/FieldJ.kernel index 4acd09436a4..a120bc7ca2b 100644 --- a/include/picongpu/fields/FieldJ.kernel +++ b/include/picongpu/fields/FieldJ.kernel @@ -131,7 +131,8 @@ namespace picongpu // The rest uses normal weighting const float_X weighting = particle[weighting_]; Velocity velocity; - const float3_X vel = velocity(particle[momentum_], attribute::getMass(weighting, particle)); + const float3_X vel + = velocity(static_cast(particle[momentum_]), attribute::getMass(weighting, particle)); auto fieldJShiftToParticle = jBox.shift(localCell); ParticleAlgo perParticle; perParticle(worker, fieldJShiftToParticle, pos, vel, charge, m_deltaTime); diff --git a/include/picongpu/fields/FieldTmp.kernel b/include/picongpu/fields/FieldTmp.kernel index dc6e61da5a2..ab33914e111 100644 --- a/include/picongpu/fields/FieldTmp.kernel +++ b/include/picongpu/fields/FieldTmp.kernel @@ -94,7 +94,9 @@ namespace picongpu if(!forEachParticle.hasParticles()) return; - auto cachedVal = CachedBox::create<0, typename T_TmpBox::ValueType>(worker, T_BlockDescription{}); + auto cachedVal = CachedBox::create<0, SharedDataBoxMapping, typename T_TmpBox::ValueType>( + worker, + T_BlockDescription{}); Set set(float_X(0.0)); auto collective = makeThreadCollective(); diff --git a/include/picongpu/fields/MaxwellSolver/AddCurrentDensity.kernel b/include/picongpu/fields/MaxwellSolver/AddCurrentDensity.kernel index 72fd0c307cd..ba9e8a2df43 100644 --- a/include/picongpu/fields/MaxwellSolver/AddCurrentDensity.kernel +++ b/include/picongpu/fields/MaxwellSolver/AddCurrentDensity.kernel @@ -22,6 +22,8 @@ #include "picongpu/simulation_defines.hpp" +#include "picongpu/param/memory.param" + #include #include #include @@ -68,7 +70,9 @@ namespace picongpu::fields::maxwellSolver constexpr uint32_t cellsPerSuperCell = pmacc::math::CT::volume::type::value; - auto cachedJ = CachedBox::create<0, typename FieldJ::DataBoxType::ValueType>(worker, BlockArea()); + auto cachedJ = CachedBox::create<0, SharedDataBoxMapping, typename FieldJ::DataBoxType::ValueType>( + worker, + BlockArea()); pmacc::math::operation::Assign assign; DataSpace const block( diff --git a/include/picongpu/fields/MaxwellSolver/FDTD/FDTDBase.kernel b/include/picongpu/fields/MaxwellSolver/FDTD/FDTDBase.kernel index 2de1bf2a1d3..6a110a1a38b 100644 --- a/include/picongpu/fields/MaxwellSolver/FDTD/FDTDBase.kernel +++ b/include/picongpu/fields/MaxwellSolver/FDTD/FDTDBase.kernel @@ -179,7 +179,9 @@ namespace picongpu auto srcFieldBlock = srcField.shift(beginCellIdx); auto cacheStencilArea = makeThreadCollective(); auto cachedSrcField - = CachedBox::create<0u, typename T_SrcBox::ValueType>(worker, StencilCfg{}); + = CachedBox::create<0u, SharedDataBoxMapping, typename T_SrcBox::ValueType>( + worker, + StencilCfg{}); cacheStencilArea(worker, assign, cachedSrcField, srcFieldBlock); worker.sync(); diff --git a/include/picongpu/fields/currentDeposition/Cache.hpp b/include/picongpu/fields/currentDeposition/Cache.hpp index 6dc92155140..9c1184a9d27 100644 --- a/include/picongpu/fields/currentDeposition/Cache.hpp +++ b/include/picongpu/fields/currentDeposition/Cache.hpp @@ -48,15 +48,10 @@ namespace picongpu */ template DINLINE static auto create(T_Worker const& worker, T_FieldBox const& fieldBox) -#if(!BOOST_COMP_CLANG) - -> decltype(CachedBox::create<0u, typename T_FieldBox::ValueType>( - worker, - std::declval())) -#endif { using ValueType = typename T_FieldBox::ValueType; /* this memory is used by all virtual blocks */ - auto cache = CachedBox::create<0u, ValueType>(worker, T_BlockDescription{}); + auto cache = CachedBox::create<0u, SharedDataBoxMapping, ValueType>(worker, T_BlockDescription{}); Set set(ValueType::create(0.0_X)); auto collectiveFill = makeThreadCollective(); @@ -90,9 +85,6 @@ namespace picongpu */ template DINLINE static auto create([[maybe_unused]] T_Worker const& worker, T_FieldBox const& fieldBox) -#if(!BOOST_COMP_CLANG) - -> T_FieldBox -#endif { return fieldBox; } diff --git a/include/picongpu/param/memory.param b/include/picongpu/param/memory.param index f4bc637d710..08cf5904ff4 100644 --- a/include/picongpu/param/memory.param +++ b/include/picongpu/param/memory.param @@ -114,4 +114,6 @@ namespace picongpu */ constexpr bool fieldTmpSupportGatherCommunication = true; + using ParticleFrameMapping = llama::mapping::BindSoA; + using SharedDataBoxMapping = llama::mapping::BindAoS; } // namespace picongpu diff --git a/include/picongpu/particles/Particles.hpp b/include/picongpu/particles/Particles.hpp index 39dba145a07..6c9f802b8e6 100644 --- a/include/picongpu/particles/Particles.hpp +++ b/include/picongpu/particles/Particles.hpp @@ -22,6 +22,7 @@ #include "picongpu/fields/Fields.def" #include "picongpu/fields/Fields.hpp" +#include "picongpu/param/memory.param" #include "picongpu/particles/boundary/Description.hpp" #include "picongpu/particles/boundary/Utility.hpp" #include "picongpu/particles/manipulators/manipulators.def" @@ -91,7 +92,10 @@ namespace picongpu // fallback if the species has not defined the alias boundaryCondition pmacc::HandleGuardRegion< pmacc::particles::policies::ExchangeParticles, - pmacc::particles::policies::DoNothing>>::type>, + pmacc::particles::policies::DoNothing>>::type, + bmpl::vector0<>, + bmpl::vector0<>, + picongpu::ParticleFrameMapping>, MappingDesc, DeviceHeap> , public ISimulationData @@ -110,7 +114,10 @@ namespace picongpu // fallback if the species has not defined the alias boundaryCondition pmacc::HandleGuardRegion< pmacc::particles::policies::ExchangeParticles, - pmacc::particles::policies::DoNothing>>::type>; + pmacc::particles::policies::DoNothing>>::type, + bmpl::vector0<>, + bmpl::vector0<>, + picongpu::ParticleFrameMapping>; using ParticlesBaseType = ParticlesBase; using FrameType = typename ParticlesBaseType::FrameType; using FrameTypeBorder = typename ParticlesBaseType::FrameTypeBorder; diff --git a/include/picongpu/particles/Particles.kernel b/include/picongpu/particles/Particles.kernel index 3270e804cc4..1f02903c360 100644 --- a/include/picongpu/particles/Particles.kernel +++ b/include/picongpu/particles/Particles.kernel @@ -222,8 +222,10 @@ namespace picongpu onlyMaster([&]() { mustShiftSupercell = 0; }); - auto cachedB = CachedBox::create<0, typename T_BBox::ValueType>(worker, T_DataDomain()); - auto cachedE = CachedBox::create<1, typename T_EBox::ValueType>(worker, T_DataDomain()); + auto cachedB + = CachedBox::create<0, SharedDataBoxMapping, typename T_BBox::ValueType>(worker, T_DataDomain()); + auto cachedE + = CachedBox::create<1, SharedDataBoxMapping, typename T_EBox::ValueType>(worker, T_DataDomain()); worker.sync(); diff --git a/include/picongpu/particles/Particles.tpp b/include/picongpu/particles/Particles.tpp index eeddec9b0b3..113ea7a81c3 100644 --- a/include/picongpu/particles/Particles.tpp +++ b/include/picongpu/particles/Particles.tpp @@ -44,6 +44,7 @@ #include #include +#include #include #include #include @@ -214,6 +215,34 @@ namespace picongpu size_t sizeOfExchanges = 0u; + // std::cout << "Frame:\n\tSize: " << sizeof(FrameType) << "\n\tLLAMA view offset: " << offsetof(FrameType, + // view) << "\n\tLLAMA view size: " << sizeof(FrameType::view) << std::endl; + + { + using View = decltype(FrameType::view); + using M = typename View::Mapping; + auto m = M{}; + // View view; + // std::cout << "view begin " << &view << "\n"; + // std::cout << "storage begin " << &view.storageBlobs[0][0] << "\n"; + // for(auto ai : llama::ArrayIndexRange{m.extents()}) + //{ + // llama::forEachLeafCoord( + // [&](auto rc) + // { + // auto& e = view(ai)(rc); + // std::cout << "ai " << ai << " rc " << rc << " addr " << (void*) &e << "\n"; + // }); + // } + // std::cout << "view end " << (&view + 1) << "\n"; + + std::ofstream{"llama_frame.html"} << llama::toHtml(m); + std::ofstream{"llama_frame.svg"} << llama::toSvg(m); + + // PMACC_VERIFY( + // reinterpret_cast(&view) == reinterpret_cast(&view.storageBlobs[0][0])); + } + const uint32_t commTag = pmacc::traits::GetUniqueTypeId::uid(); log("communication tag for species %1%: %2%") % FrameType::getName() % commTag; diff --git a/include/picongpu/particles/bremsstrahlung/Bremsstrahlung.hpp b/include/picongpu/particles/bremsstrahlung/Bremsstrahlung.hpp index 5b299d53289..b7a1e884d5a 100644 --- a/include/picongpu/particles/bremsstrahlung/Bremsstrahlung.hpp +++ b/include/picongpu/particles/bremsstrahlung/Bremsstrahlung.hpp @@ -87,7 +87,11 @@ namespace picongpu /* shared memory ion density device databoxes */ PMACC_ALIGN( cachedIonDensity, - DataBox>); + DataBox>); PMACC_ALIGN(scaledSpectrumFunctor, ScaledSpectrum::LookupTableFunctor); PMACC_ALIGN(stoppingPowerFunctor, ScaledSpectrum::LookupTableFunctor); diff --git a/include/picongpu/particles/bremsstrahlung/Bremsstrahlung.tpp b/include/picongpu/particles/bremsstrahlung/Bremsstrahlung.tpp index ac18809976d..2d16d2e10ee 100644 --- a/include/picongpu/particles/bremsstrahlung/Bremsstrahlung.tpp +++ b/include/picongpu/particles/bremsstrahlung/Bremsstrahlung.tpp @@ -81,7 +81,8 @@ namespace picongpu const DataSpace& blockCell) { /* caching of ion density field */ - cachedIonDensity = CachedBox::create<0, ValueTypeIonDensity>(worker, BlockArea()); + cachedIonDensity + = CachedBox::create<0, SharedDataBoxMapping, ValueTypeIonDensity>(worker, BlockArea()); /* instance of nvidia assignment operator */ pmacc::math::operation::Assign assign; diff --git a/include/picongpu/particles/ionization/byCollision/ThomasFermi/ThomasFermi_Impl.hpp b/include/picongpu/particles/ionization/byCollision/ThomasFermi/ThomasFermi_Impl.hpp index dfecb4e63a0..ac4720a0cb2 100644 --- a/include/picongpu/particles/ionization/byCollision/ThomasFermi/ThomasFermi_Impl.hpp +++ b/include/picongpu/particles/ionization/byCollision/ThomasFermi/ThomasFermi_Impl.hpp @@ -23,6 +23,7 @@ #include "picongpu/fields/CellType.hpp" #include "picongpu/fields/FieldTmp.hpp" +#include "picongpu/param/memory.param" #include "picongpu/particles/atomicPhysics/SetToAtomicGroundStateForChargeState.hpp" #include "picongpu/particles/ionization/byCollision/ThomasFermi/AlgorithmThomasFermi.hpp" #include "picongpu/particles/ionization/byCollision/ThomasFermi/ThomasFermi.def" @@ -104,8 +105,12 @@ namespace picongpu PMACC_ALIGN(eneBox, FieldTmp::DataBoxType); /* shared memory EM-field device databoxes */ - PMACC_ALIGN(cachedRho, DataBox>); - PMACC_ALIGN(cachedEne, DataBox>); + PMACC_ALIGN( + cachedRho, + DataBox>); + PMACC_ALIGN( + cachedEne, + DataBox>); public: /* host constructor initializing member : random number generator */ @@ -185,8 +190,8 @@ namespace picongpu DINLINE void collectiveInit(const T_Worker& worker, const DataSpace& blockCell) { /* caching of density and "temperature" fields */ - cachedRho = CachedBox::create<0, ValueType_Rho>(worker, BlockArea()); - cachedEne = CachedBox::create<1, ValueType_Ene>(worker, BlockArea()); + cachedRho = CachedBox::create<0, SharedDataBoxMapping, ValueType_Rho>(worker, BlockArea()); + cachedEne = CachedBox::create<1, SharedDataBoxMapping, ValueType_Ene>(worker, BlockArea()); /* instance of nvidia assignment operator */ pmacc::math::operation::Assign assign; diff --git a/include/picongpu/particles/ionization/byField/ADK/ADK_Impl.hpp b/include/picongpu/particles/ionization/byField/ADK/ADK_Impl.hpp index d23d9fc8ea8..6e19764525d 100644 --- a/include/picongpu/particles/ionization/byField/ADK/ADK_Impl.hpp +++ b/include/picongpu/particles/ionization/byField/ADK/ADK_Impl.hpp @@ -102,8 +102,12 @@ namespace picongpu PMACC_ALIGN(bBox, FieldB::DataBoxType); PMACC_ALIGN(jBox, FieldJ::DataBoxType); /* shared memory EM-field device databoxes */ - PMACC_ALIGN(cachedE, DataBox>); - PMACC_ALIGN(cachedB, DataBox>); + PMACC_ALIGN( + cachedE, + DataBox>); + PMACC_ALIGN( + cachedB, + DataBox>); public: /* host constructor initializing member : random number generator */ @@ -137,8 +141,8 @@ namespace picongpu jBox = jBox.shift(blockCell); /* caching of E and B fields */ - cachedB = CachedBox::create<0, ValueType_B>(worker, BlockArea()); - cachedE = CachedBox::create<1, ValueType_E>(worker, BlockArea()); + cachedB = CachedBox::create<0, SharedDataBoxMapping, ValueType_B>(worker, BlockArea()); + cachedE = CachedBox::create<1, SharedDataBoxMapping, ValueType_E>(worker, BlockArea()); /* instance of nvidia assignment operator */ pmacc::math::operation::Assign assign; diff --git a/include/picongpu/particles/ionization/byField/BSI/BSI_Impl.hpp b/include/picongpu/particles/ionization/byField/BSI/BSI_Impl.hpp index 70152484088..05e57069f1a 100644 --- a/include/picongpu/particles/ionization/byField/BSI/BSI_Impl.hpp +++ b/include/picongpu/particles/ionization/byField/BSI/BSI_Impl.hpp @@ -25,6 +25,7 @@ #include "picongpu/fields/FieldB.hpp" #include "picongpu/fields/FieldE.hpp" #include "picongpu/fields/FieldJ.hpp" +#include "picongpu/param/memory.param" #include "picongpu/particles/ParticlesFunctors.hpp" #include "picongpu/particles/atomicPhysics/SetToAtomicGroundStateForChargeState.hpp" #include "picongpu/particles/ionization/byField/BSI/AlgorithmBSI.hpp" @@ -93,7 +94,9 @@ namespace picongpu FieldE::DataBoxType eBox; FieldJ::DataBoxType jBox; /* shared memory EM-field device databoxes */ - PMACC_ALIGN(cachedE, DataBox>); + PMACC_ALIGN( + cachedE, + DataBox>); public: /* host constructor */ @@ -125,7 +128,7 @@ namespace picongpu jBox = jBox.shift(blockCell); /* caching of E field */ - cachedE = CachedBox::create<1, ValueType_E>(worker, BlockArea()); + cachedE = CachedBox::create<1, SharedDataBoxMapping, ValueType_E>(worker, BlockArea()); /* instance of nvidia assignment operator */ pmacc::math::operation::Assign assign; diff --git a/include/picongpu/particles/ionization/byField/Keldysh/Keldysh_Impl.hpp b/include/picongpu/particles/ionization/byField/Keldysh/Keldysh_Impl.hpp index d5c1bf2b83c..5459c83e58f 100644 --- a/include/picongpu/particles/ionization/byField/Keldysh/Keldysh_Impl.hpp +++ b/include/picongpu/particles/ionization/byField/Keldysh/Keldysh_Impl.hpp @@ -102,8 +102,12 @@ namespace picongpu PMACC_ALIGN(bBox, FieldB::DataBoxType); PMACC_ALIGN(jBox, FieldJ::DataBoxType); /* shared memory EM-field device databoxes */ - PMACC_ALIGN(cachedE, DataBox>); - PMACC_ALIGN(cachedB, DataBox>); + PMACC_ALIGN( + cachedE, + DataBox>); + PMACC_ALIGN( + cachedB, + DataBox>); public: /* host constructor initializing member : random number generator */ @@ -137,8 +141,8 @@ namespace picongpu jBox = jBox.shift(blockCell); /* caching of E and B fields */ - cachedB = CachedBox::create<0, ValueType_B>(worker, BlockArea()); - cachedE = CachedBox::create<1, ValueType_E>(worker, BlockArea()); + cachedB = CachedBox::create<0, SharedDataBoxMapping, ValueType_B>(worker, BlockArea()); + cachedE = CachedBox::create<1, SharedDataBoxMapping, ValueType_E>(worker, BlockArea()); /* instance of nvidia assignment operator */ pmacc::math::operation::Assign assign; diff --git a/include/picongpu/particles/synchrotronPhotons/PhotonCreator.hpp b/include/picongpu/particles/synchrotronPhotons/PhotonCreator.hpp index 42eff385466..e564d4db047 100644 --- a/include/picongpu/particles/synchrotronPhotons/PhotonCreator.hpp +++ b/include/picongpu/particles/synchrotronPhotons/PhotonCreator.hpp @@ -96,8 +96,12 @@ namespace picongpu PMACC_ALIGN(eBox, FieldE::DataBoxType); PMACC_ALIGN(bBox, FieldB::DataBoxType); /* shared memory EM-field device databoxes */ - PMACC_ALIGN(cachedE, DataBox>); - PMACC_ALIGN(cachedB, DataBox>); + PMACC_ALIGN( + cachedE, + DataBox>); + PMACC_ALIGN( + cachedB, + DataBox>); PMACC_ALIGN(curF_1, SynchrotronFunctions::SyncFuncCursor); PMACC_ALIGN(curF_2, SynchrotronFunctions::SyncFuncCursor); @@ -143,8 +147,8 @@ namespace picongpu DINLINE void collectiveInit(const T_Worker& worker, const DataSpace& blockCell) { /* caching of E and B fields */ - cachedB = CachedBox::create<0, ValueType_B>(worker, BlockArea()); - cachedE = CachedBox::create<1, ValueType_E>(worker, BlockArea()); + cachedB = CachedBox::create<0, SharedDataBoxMapping, ValueType_B>(worker, BlockArea()); + cachedE = CachedBox::create<1, SharedDataBoxMapping, ValueType_E>(worker, BlockArea()); /* instance of nvidia assignment operator */ pmacc::math::operation::Assign assign; diff --git a/include/pmacc/cuSTL/algorithm/functor/GetComponent.hpp b/include/pmacc/cuSTL/algorithm/functor/GetComponent.hpp index 82d191cdc1e..7cc0d52c555 100644 --- a/include/pmacc/cuSTL/algorithm/functor/GetComponent.hpp +++ b/include/pmacc/cuSTL/algorithm/functor/GetComponent.hpp @@ -42,15 +42,15 @@ namespace pmacc } template - HDINLINE Type& operator()(T_Worker const&, Array& array) const + HDINLINE Type& operator()(T_Worker const&, Array&& array) const { - return array[m_component]; + return std::forward(array)[m_component]; } template - HDINLINE Type& operator()(Array& array) const + HDINLINE Type& operator()(Array&& array) const { - return array[m_component]; + return std::forward(array)[m_component]; } }; diff --git a/include/pmacc/cuSTL/cursor/Cursor.hpp b/include/pmacc/cuSTL/cursor/Cursor.hpp index 367adb44913..f5fb03b4f9a 100644 --- a/include/pmacc/cuSTL/cursor/Cursor.hpp +++ b/include/pmacc/cuSTL/cursor/Cursor.hpp @@ -35,6 +35,21 @@ namespace pmacc { namespace cursor { + namespace detail + { + template + struct ValueType + { + using type = std::remove_reference_t; + }; + + template + struct ValueType> + { + using type = typename Accessor::ValueType; + }; + } // namespace detail + /** A cursor is used to access a single datum and to jump to another one. * It is always located at a certain datum. Think of a generalized iterator. * @tparam _Accessor Policy functor class that is called inside operator*(). @@ -51,7 +66,7 @@ namespace pmacc { public: using Reference = typename _Accessor::Reference; - using ValueType = std::remove_reference_t; + using ValueType = typename detail::ValueType<_Accessor>::type; using Accessor = _Accessor; using Navigator = _Navigator; using Marker = _Marker; diff --git a/include/pmacc/cuSTL/cursor/accessor/TwistAxesAccessor.hpp b/include/pmacc/cuSTL/cursor/accessor/TwistAxesAccessor.hpp index e5290091207..106825ce915 100644 --- a/include/pmacc/cuSTL/cursor/accessor/TwistAxesAccessor.hpp +++ b/include/pmacc/cuSTL/cursor/accessor/TwistAxesAccessor.hpp @@ -31,7 +31,7 @@ namespace pmacc template struct TwistAxesAccessor { - using Reference = typename math::result_of::TwistComponents::type; + using Reference = decltype(math::twistComponents(*std::declval())); /** Returns a reference to the result of '*cursor' (with twisted axes). * diff --git a/include/pmacc/identifier/value_identifier.hpp b/include/pmacc/identifier/value_identifier.hpp index 3c15e7d4fe0..4980c26822c 100644 --- a/include/pmacc/identifier/value_identifier.hpp +++ b/include/pmacc/identifier/value_identifier.hpp @@ -49,13 +49,15 @@ */ #define value_identifier(in_type, name, in_default) \ identifier( \ - name, using type = in_type; static HDINLINE type getValue() \ - { return in_default; } static std::string getName() { return std::string(#name); }) + name, using type = in_type; static HDINLINE type getValue() { \ + return in_default; \ + } static std::string getName() { return std::string(#name); }) /** getValue() is defined constexpr * @} */ #define value_identifier_constexpr(in_type, name, in_default) \ identifier( \ - name, using type = in_type; static constexpr HDINLINE type getValue() \ - { return in_default; } static std::string getName() { return std::string(#name); }) + name, using type = in_type; static constexpr HDINLINE type getValue() { \ + return in_default; \ + } static std::string getName() { return std::string(#name); }) diff --git a/include/pmacc/lockstep/Kernel.hpp b/include/pmacc/lockstep/Kernel.hpp index 6a46b40990f..d89743e7109 100644 --- a/include/pmacc/lockstep/Kernel.hpp +++ b/include/pmacc/lockstep/Kernel.hpp @@ -22,6 +22,7 @@ #pragma once #include "pmacc/eventSystem/EventSystem.hpp" +#include "pmacc/eventSystem/events/kernelEvents.hpp" #include "pmacc/lockstep/Worker.hpp" #include "pmacc/lockstep/WorkerCfg.hpp" #include "pmacc/types.hpp" diff --git a/include/pmacc/mappings/kernel/MappingDescription.hpp b/include/pmacc/mappings/kernel/MappingDescription.hpp index cca652a7675..57b04225cb9 100644 --- a/include/pmacc/mappings/kernel/MappingDescription.hpp +++ b/include/pmacc/mappings/kernel/MappingDescription.hpp @@ -30,6 +30,8 @@ #include +#include + namespace pmacc { /** @@ -134,5 +136,4 @@ namespace pmacc PMACC_ALIGN(gridSuperCells, DataSpace); PMACC_ALIGN(guardingSuperCells, DataSpace); }; - } // namespace pmacc diff --git a/include/pmacc/math/operation/Assign.hpp b/include/pmacc/math/operation/Assign.hpp index b93e45f286a..c7a03e1b24f 100644 --- a/include/pmacc/math/operation/Assign.hpp +++ b/include/pmacc/math/operation/Assign.hpp @@ -32,15 +32,15 @@ namespace pmacc struct Assign { template - HDINLINE void operator()(Dst& dst, const Src& src) const + HDINLINE void operator()(Dst&& dst, const Src& src) const { - dst = src; + std::forward(dst) = src; } template - HDINLINE void operator()(const T_Worker&, Dst& dst, const Src& src) const + HDINLINE void operator()(const T_Worker&, Dst&& dst, const Src& src) const { - dst = src; + std::forward(dst) = src; } }; } // namespace operation diff --git a/include/pmacc/math/vector/TwistComponents.hpp b/include/pmacc/math/vector/TwistComponents.hpp index 98c71f99e78..0309da31527 100644 --- a/include/pmacc/math/vector/TwistComponents.hpp +++ b/include/pmacc/math/vector/TwistComponents.hpp @@ -50,9 +50,8 @@ namespace pmacc T_Dim, T_Accessor, math::StackedNavigator>, - T_Storage>&; + T_Storage>; }; - } // namespace result_of /** Returns a reference of vector with twisted axes. @@ -68,13 +67,17 @@ namespace pmacc * @return reference of the input vector with twisted axes. */ template - HDINLINE typename result_of::TwistComponents::type twistComponents(T_Vector& vector) + HDINLINE auto& twistComponents(T_Vector& vector) { - /* The reinterpret_cast is valid because the target type is the same as the - * input type except its navigator policy which does not occupy any memory though. - */ - return reinterpret_cast::type>(vector); + // cast to reference with new navigator + return reinterpret_cast::type&>(vector); } + template + HDINLINE auto twistComponents(T_Vector&& vector) + { + // construct new vector (with reference semantic) with new navigator + return typename result_of::TwistComponents::type(std::move(vector)); + } } // namespace math } // namespace pmacc diff --git a/include/pmacc/math/vector/Vector.hpp b/include/pmacc/math/vector/Vector.hpp index fa7d9531ef2..fc00f04fabc 100644 --- a/include/pmacc/math/vector/Vector.hpp +++ b/include/pmacc/math/vector/Vector.hpp @@ -36,6 +36,8 @@ #include #include +#include + namespace pmacc { namespace math @@ -76,6 +78,34 @@ namespace pmacc } }; + template + struct Vector_llama_components + { + static_assert(llama::isRecordRef); + + static constexpr bool isConst = false; + static constexpr int dim = T_Dim; + using type = T_Type; + + RecordRef rr; + + HDINLINE + type& operator[](const int idx) + { + return boost::mp11::mp_with_index( + idx, + [&](auto ic) -> decltype(auto) { return rr(llama::RecordCoord{}); }); + } + + HDINLINE + const type& operator[](const int idx) const + { + return boost::mp11::mp_with_index( + idx, + [&](auto ic) -> decltype(auto) { return rr(llama::RecordCoord{}); }); + } + }; + } // namespace detail namespace tag @@ -90,7 +120,7 @@ namespace pmacc typename T_Navigator = StandardNavigator, typename T_Storage = detail::Vector_components> struct Vector - : private T_Storage + : public T_Storage , protected T_Accessor , protected T_Navigator { @@ -110,6 +140,11 @@ namespace pmacc { } + HDINLINE + constexpr explicit Vector(Storage s) : Storage{std::move(s)} + { + } + HDINLINE constexpr Vector(const type x) { @@ -137,6 +172,20 @@ namespace pmacc HDINLINE constexpr Vector(const Vector& other) = default; + // template< + // typename T_OtherType, + // int T_OtherDim, + // typename T_OtherAccessor, + // typename T_OtherNavigator, + // typename T_OtherStorage> + // friend class Vector; + + template + HDINLINE Vector(const Vector& other) + : Storage{static_cast(other)} + { + } + template HDINLINE Vector(const Vector& other) : Storage{} @@ -533,6 +582,12 @@ namespace pmacc } }; + template + inline constexpr bool isVector = false; + + template + inline constexpr bool isVector> = true; + template std::ostream& operator<<(std::ostream& s, const Vector& vec) { @@ -774,6 +829,37 @@ namespace pmacc template HDINLINE T_Vector basisVector(); + template + using VectorWithLlamaStorage = Vector< + typename V::type, + V::dim, + typename V::Accessor, + typename V::Navigator, + detail::Vector_llama_components>; + + template + HDINLINE auto makeVectorWithLlamaStorage(LlamaRecordRef rr) + { + return VectorWithLlamaStorage{{rr}}; + } + + namespace detail + { + template + struct ReplaceVectorImpl + { + using type = T; + }; + + template + struct ReplaceVectorImpl> + { + using type = T_Type[T_dim]; + }; + } // namespace detail + + template + using ReplaceVector = typename detail::ReplaceVectorImpl::type; } // namespace math namespace result_of diff --git a/include/pmacc/memory/boxes/CachedBox.hpp b/include/pmacc/memory/boxes/CachedBox.hpp index 2c96485e7f8..74c61e82b7a 100644 --- a/include/pmacc/memory/boxes/CachedBox.hpp +++ b/include/pmacc/memory/boxes/CachedBox.hpp @@ -30,18 +30,18 @@ namespace pmacc { namespace CachedBox { - template + template DINLINE auto create(T_Worker const& worker, const BlockDescription_ block) { using OffsetOrigin = typename BlockDescription_::OffsetOrigin; - using Type = DataBox>; + using Type = DataBox>; return Type{Type::init(worker)}.shift(DataSpace{OffsetOrigin::toRT()}); } - template + template DINLINE auto create(T_Worker const& worker, const ValueType_& value, const BlockDescription_ block) { - return create(worker); + return create(worker); } } // namespace CachedBox } // namespace pmacc diff --git a/include/pmacc/memory/boxes/DataBox.hpp b/include/pmacc/memory/boxes/DataBox.hpp index 405abb56643..a35be82db14 100644 --- a/include/pmacc/memory/boxes/DataBox.hpp +++ b/include/pmacc/memory/boxes/DataBox.hpp @@ -22,7 +22,12 @@ #pragma once +#include "SharedBox.hpp" +#include "pmacc/cuSTL/cursor/Cursor.hpp" #include "pmacc/dimensions/DataSpace.hpp" +#include "pmacc/memory/shared/Allocate.hpp" + +#include namespace pmacc { @@ -71,4 +76,138 @@ namespace pmacc return result; } }; -} // namespace pmacc + + namespace internal + { + template + HDINLINE auto toAE(math::CT::Vector) + { + constexpr auto dim = math::CT::Vector::dim; + using IndexType = typename math::CT::Vector::type; + if constexpr(dim == 1) + return llama::ArrayExtents{}; + else if constexpr(dim == 2) + return llama::ArrayExtents{}; + else if constexpr(dim == 3) + return llama::ArrayExtents{}; + } + + // LLAMA and DataSpace indices have the same semantic, fast moving index is first. + HDINLINE auto toAI(DataSpace<1> idx) + { + using IndexType = typename DataSpace<1>::type; + return llama::ArrayIndex{idx[0]}; + } + + HDINLINE auto toAI(DataSpace<2> idx) + { + using IndexType = typename DataSpace<2>::type; + return llama::ArrayIndex{idx[1], idx[0]}; + } + + HDINLINE auto toAI(DataSpace<3> idx) + { + using IndexType = typename DataSpace<3>::type; + return llama::ArrayIndex{idx[2], idx[1], idx[0]}; + } + + template + struct LlamaAccessor + { + static constexpr auto dim = DataBox::Dim; + + using Reference = decltype(std::declval()(DataSpace{})); + using ValueType = typename DataBox::ValueType; + + HDINLINE decltype(auto) operator()(DataSpace idx) const + { + return db(idx); + } + + DataBox db; // A cursor can outlive its DataBox, so it must carry on a copy of it. + }; + + template + struct DataspaceNavigator + { + template + HDINLINE auto operator()(DataSpace ds, const Jump& jump) const + { + return ds + jump; + } + }; + + template + using LlamaCursor + = cursor::Cursor, DataspaceNavigator, DataSpace>; + } // namespace internal + + // handle DataBox wrapping SharedBox with LLAMA + template + struct DataBox> + { + using SB = SharedBox; + + static constexpr std::uint32_t Dim = T_dim; + using ValueType = T_TYPE; + using RefValueType = ValueType&; + using Size = T_SizeVector; + + using SplitRecordDim = llama::TransformLeaves; + using ArrayExtents = decltype(internal::toAE(T_SizeVector{})); + + using Mapping = typename T_Mapping::template fn; + // using Mapping = boost::mp11::mp_at_c< + // boost::mp11::mp_list, + // static_cast(T_Mapping)>; + + using View = llama::View; + + View view; + + HDINLINE DataBox() = default; + + HDINLINE DataBox(SB sb) + : view{ + Mapping{{}}, + llama::Array{const_cast(reinterpret_cast(sb.fixedPointer))}} + { + } + + HDINLINE decltype(auto) operator()(DataSpace idx = {}) const + { + auto&& v = const_cast(view)(internal::toAI(idx + offset)); + using ReturnType = std::remove_reference_t; + if constexpr(math::isVector && llama::isRecordRef) + return math::makeVectorWithLlamaStorage(v); + else + return v; + } + + HDINLINE auto toCursor() const + { + return internal::LlamaCursor{ + internal::LlamaAccessor{*this}, + internal::DataspaceNavigator{}, + DataSpace{}}; + } + + HDINLINE DataBox shift(const DataSpace& offset) const + { + DataBox result(*this); + result.offset += offset; + return result; + } + + template + static DINLINE SB init(T_Worker const& worker) + { + auto& mem_sh + = memory::shared::allocate::type::value>>( + worker); + return {mem_sh.data()}; + } + + DataSpace offset{}; + }; +} // namespace pmacc \ No newline at end of file diff --git a/include/pmacc/memory/boxes/SharedBox.hpp b/include/pmacc/memory/boxes/SharedBox.hpp index 8f95dc4e867..3ef86ca3994 100644 --- a/include/pmacc/memory/boxes/SharedBox.hpp +++ b/include/pmacc/memory/boxes/SharedBox.hpp @@ -21,36 +21,12 @@ #pragma once -#include "pmacc/math/Vector.hpp" -#include "pmacc/memory/Array.hpp" -#include "pmacc/memory/shared/Allocate.hpp" -#include "pmacc/types.hpp" +#include "pmacc/mappings/kernel/MappingDescription.hpp" -#include "pmacc/cuSTL/cursor/compile-time/BufferCursor.hpp" +#include namespace pmacc { - namespace detail - { - template - HDINLINE auto& subscript(T_TYPE* p, int const idx, std::integral_constant) - { - return p[idx]; - } - - template - HDINLINE auto* subscript(T_TYPE* p, int const idx, std::integral_constant) - { - return p + idx * T_Vector::x::value; - } - - template - HDINLINE auto* subscript(T_TYPE* p, int const idx, std::integral_constant) - { - return p + idx * (T_Vector::x::value * T_Vector::y::value); - } - } // namespace detail - /** create shared memory on gpu * * @tparam T_TYPE type of memory objects @@ -59,79 +35,9 @@ namespace pmacc * (is needed if more than one instance of shared memory in one kernel is used) * @tparam T_dim dimension of the memory (supports DIM1,DIM2 and DIM3) */ - template + template struct SharedBox { - static constexpr std::uint32_t Dim = T_dim; - - using ValueType = T_TYPE; - using RefValueType = ValueType&; - using Size = T_Vector; - - HDINLINE - SharedBox(ValueType* pointer = nullptr) : fixedPointer(pointer) - { - } - - HDINLINE SharedBox(SharedBox const&) = default; - - using ReducedType1D = T_TYPE&; - using ReducedType2D = SharedBox, T_id>; - using ReducedType3D = SharedBox, T_id>; - using ReducedType - = std::conditional_t>; - - HDINLINE ReducedType operator[](const int idx) const - { - ///@todo(bgruber): inline and replace this by if constexpr in C++17 - return {detail::subscript(fixedPointer, idx, std::integral_constant{})}; - } - - /*!return the first value in the box (list) - * @return first value - */ - HDINLINE RefValueType operator*() - { - return *fixedPointer; - } - - HDINLINE ValueType const* getPointer() const - { - return fixedPointer; - } - HDINLINE ValueType* getPointer() - { - return fixedPointer; - } - - using CursorPitch1d = math::CT::Int<>; - using CursorPitch2d = math::CT::Int; - using CursorPitch3d = math::CT:: - Int; - using CursorPitch - = std::conditional_t>; - - HDINLINE - cursor::CT::BufferCursor toCursor() const - { - return {const_cast(this->fixedPointer)}; - } - - /** create a shared memory box - * - * This call synchronizes a block and must be called from all threads and - * not inside a if clauses - */ - template - static DINLINE SharedBox init(T_Worker const& worker) - { - auto& mem_sh - = memory::shared::allocate::type::value>>( - worker); - return {mem_sh.data()}; - } - - protected: - PMACC_ALIGN(fixedPointer, ValueType*); + T_TYPE* fixedPointer; }; } // namespace pmacc diff --git a/include/pmacc/particles/ParticleDescription.hpp b/include/pmacc/particles/ParticleDescription.hpp index 3d6f268b84b..080b5090555 100644 --- a/include/pmacc/particles/ParticleDescription.hpp +++ b/include/pmacc/particles/ParticleDescription.hpp @@ -61,7 +61,8 @@ namespace pmacc typename T_HandleGuardRegion = HandleGuardRegion, typename T_MethodsList = bmpl::vector0<>, - typename T_FrameExtensionList = bmpl::vector0<>> + typename T_FrameExtensionList = bmpl::vector0<>, + typename T_ParticleFrameMapping = llama::mapping::BindSoA> struct ParticleDescription { using Name = T_Name; @@ -71,6 +72,7 @@ namespace pmacc using HandleGuardRegion = T_HandleGuardRegion; using MethodsList = typename ToSeq::type; using FrameExtensionList = typename ToSeq::type; + using FrameMapping = T_ParticleFrameMapping; using ThisType = ParticleDescription< Name, SuperCellSize, @@ -78,7 +80,8 @@ namespace pmacc FlagsList, HandleGuardRegion, MethodsList, - FrameExtensionList>; + FrameExtensionList, + FrameMapping>; // Compile-time check uniqueness of attributes and flags PMACC_CASSERT_MSG( @@ -107,7 +110,8 @@ namespace pmacc typename OldParticleDescription::FlagsList, typename OldParticleDescription::HandleGuardRegion, typename OldParticleDescription::MethodsList, - typename OldParticleDescription::FrameExtensionList>; + typename OldParticleDescription::FrameExtensionList, + typename OldParticleDescription::FrameMapping>; }; /** Get ParticleDescription with a new FrameExtensionSeq @@ -127,7 +131,8 @@ namespace pmacc typename OldParticleDescription::FlagsList, typename OldParticleDescription::HandleGuardRegion, typename OldParticleDescription::MethodsList, - typename ToSeq::type>; + typename ToSeq::type, + typename OldParticleDescription::FrameMapping>; }; } // namespace pmacc diff --git a/include/pmacc/particles/memory/dataTypes/Particle.hpp b/include/pmacc/particles/memory/dataTypes/Particle.hpp index 2f540b53bc3..0c1087e89c9 100644 --- a/include/pmacc/particles/memory/dataTypes/Particle.hpp +++ b/include/pmacc/particles/memory/dataTypes/Particle.hpp @@ -48,6 +48,8 @@ #include +#include + namespace pmacc { namespace pmath = pmacc::math; @@ -128,20 +130,18 @@ namespace pmacc * @return result of operator[] of the Frame */ template - HDINLINE auto& operator[](const T_Key key) + HDINLINE decltype(auto) operator[](const T_Key key) { PMACC_CASSERT_MSG_TYPE(key_not_available, T_Key, traits::HasIdentifier::type::value); - - return frame->getIdentifier(key)[idx]; + return frame->get(idx, key); } /** const version of method operator(const T_Key) */ template - HDINLINE const auto& operator[](const T_Key key) const + HDINLINE decltype(auto) operator[](const T_Key key) const { PMACC_CASSERT_MSG_TYPE(key_not_available, T_Key, traits::HasIdentifier::type::value); - - return frame->getIdentifier(key)[idx]; + return frame->get(idx, key); } HDINLINE diff --git a/include/pmacc/particles/memory/frames/Frame.hpp b/include/pmacc/particles/memory/frames/Frame.hpp index ad5ce79e788..5204a3205db 100644 --- a/include/pmacc/particles/memory/frames/Frame.hpp +++ b/include/pmacc/particles/memory/frames/Frame.hpp @@ -34,16 +34,94 @@ #include "pmacc/traits/HasIdentifier.hpp" #include "pmacc/types.hpp" +#include +#include #include #include #include #include #include +#include + namespace pmacc { namespace pmath = pmacc::math; + namespace detail + { + template + using MakeLlamaField = llama::Field::type::type>; + + template + using ValueTypeSeqToList = + typename boost::mpl::copy>>::type; + + template + using RecordDimFromValueTypeSeq = boost::mp11:: + mp_rename>, llama::Record>; + + template + inline constexpr auto nonTypeArgOf = nullptr; // = delete; + + template typename T, auto I> + inline constexpr auto nonTypeArgOf> = I; + + template + struct ViewHolder + { + static constexpr std::size_t particlesPerFrame + = nonTypeArgOf; // T_ParticleDescription::SuperCellSize + using FrameMapping = typename T_ParticleDescription::FrameMapping; + + using RawRecordDim = RecordDimFromValueTypeSeq; + using RecordDim = llama::TransformLeaves; + using IndexType = int; // TODO(bgruber): where do I get this type from? + using ArrayExtents = llama::ArrayExtents; + using Mapping = boost::mp11::mp_if_c< + particlesPerFrame == 1, + llama::mapping::One, + typename FrameMapping::template fn>; + static_assert(Mapping::blobCount == 1, "Only frame mappings with a single blob are supported"); + using LlamaViewType = llama::View>; + + LlamaViewType view; + }; + + template + struct LlamaParticleAttribute + { + template + auto operator=(const LlamaParticleAttribute& lpa) -> LlamaParticleAttribute& + { + vr = lpa.vr; + return *this; + } + + template + auto operator=(LlamaParticleAttribute&& lpa) -> LlamaParticleAttribute& + { + vr = lpa.vr; + return *this; + } + + template + auto operator=(T&& t) -> LlamaParticleAttribute& + { + vr.store(std::forward(t)); + return *this; + } + + template + operator T() const + { + return vr.template loadAs(); + } + + VirtualRecord vr; + }; + } // namespace detail + /** Frame is a storage for arbitrary number >0 of Particles with attributes * * @tparam T_CreatePairOperator unary template operator to create a boost pair @@ -61,8 +139,7 @@ namespace pmacc template struct Frame : public InheritLinearly - , protected pmath::MapTuple< - typename SeqToMap::type> + , public detail::ViewHolder , public InheritLinearly>>::type> @@ -75,8 +152,7 @@ namespace pmacc using FlagList = typename ParticleDescription::FlagsList; using FrameExtensionList = typename ParticleDescription::FrameExtensionList; using ThisType = Frame; - /* definition of the MapTupel where we inherit from*/ - using BaseType = pmath::MapTuple::type>; + using Map = typename SeqToMap::type; /* type of a single particle*/ using ParticleType = pmacc::Particle; @@ -93,25 +169,33 @@ namespace pmacc return ParticleType(*this, idx); } - /** access attribute with a identifier - * - * @param T_Key instance of identifier type - * (can be an alias, value_identifier or any other class) - * @return result of operator[] of MapTupel - */ - template - HDINLINE auto& getIdentifier(const T_Key) + template + static HDINLINE decltype(auto) at(Frame& f, uint32_t i, const T_Key key) { using Key = typename GetKeyFromAlias::type; - return BaseType::operator[](Key()); + auto&& v = f.view(i)(Key{}); + + using OldDstType = typename traits::Resolve::type::type; + using ReturnType = std::remove_reference_t; + + if constexpr(pmath::isVector && llama::isRecordRef) + return pmath::makeVectorWithLlamaStorage(v); + else if constexpr(llama::isRecordRef) + return detail::LlamaParticleAttribute{v}; + else + return v; } - /** const version of method getIdentifier(const T_Key) */ template - HDINLINE const auto& getIdentifier(const T_Key) const + HDINLINE decltype(auto) get(uint32_t i, const T_Key) { - using Key = typename GetKeyFromAlias::type; - return BaseType::operator[](Key()); + return at(*this, i, T_Key{}); + } + + template + HDINLINE decltype(auto) get(uint32_t i, const T_Key) const + { + return at(*this, i, T_Key{}); } HINLINE static std::string getName() diff --git a/share/picongpu/benchmarks/SPEC/include/picongpu/param/memory.param b/share/picongpu/benchmarks/SPEC/include/picongpu/param/memory.param index 57973d60e50..8e28ebc088d 100644 --- a/share/picongpu/benchmarks/SPEC/include/picongpu/param/memory.param +++ b/share/picongpu/benchmarks/SPEC/include/picongpu/param/memory.param @@ -112,4 +112,39 @@ namespace picongpu */ constexpr bool fieldTmpSupportGatherCommunication = false; + // TODO(bgruber): how can be communicate that the vector should be split? + // using AoS = llama::mapping::AoS< + // ArrayExtents, + // RawRecordDim, + // true, + // llama::mapping::LinearizeArrayDimsCpp, + // llama::mapping::FlattenRecordDimMinimizePadding>; + // using AoSSplit = llama::mapping::AoS< + // ArrayExtents, + // RecordDim, + // true, + // llama::mapping::LinearizeArrayDimsCpp, + // llama::mapping::FlattenRecordDimMinimizePadding>; + // using SoA = llama::mapping::SoA; + // using SoASplit = llama::mapping::SoA; + // using AoSoA16 = llama::mapping::AoSoA; + // using AoSoA32 = llama::mapping::AoSoA; + // using AoSoA64 = llama::mapping::AoSoA; + + // using ParticleFrameMapping = llama::mapping::BindAoS<>; + using ParticleFrameMapping = llama::mapping::BindSoA; + // using ParticleFrameMapping = llama::mapping::BindAoSoA<32>; + + // TODO(bgruber): how can be communicate that the vector should be split? + // using AoSSplit = llama::mapping::AoS; + // using AoSSplitFortran + // = llama::mapping::AoS; + // using SoASplit = llama::mapping::SoA; + // using SoASplitFortran + // = llama::mapping::SoA; + + using SharedDataBoxMapping = llama::mapping::BindAoS<>; + // using SharedDataBoxMapping = llama::mapping::BindSoA; + // using SharedDataBoxMapping = llama::mapping::BindAoSoA<32>; } // namespace picongpu diff --git a/share/picongpu/examples/FieldAbsorberTest/include/picongpu/param/memory.param b/share/picongpu/examples/FieldAbsorberTest/include/picongpu/param/memory.param index 7a93d049e67..b4588ac1f55 100644 --- a/share/picongpu/examples/FieldAbsorberTest/include/picongpu/param/memory.param +++ b/share/picongpu/examples/FieldAbsorberTest/include/picongpu/param/memory.param @@ -100,4 +100,6 @@ namespace picongpu */ constexpr bool fieldTmpSupportGatherCommunication = true; + using ParticleFrameMapping = llama::mapping::BindSoA; + using SharedDataBoxMapping = llama::mapping::BindAoS; } // namespace picongpu diff --git a/share/picongpu/examples/FoilLCT/include/picongpu/param/memory.param b/share/picongpu/examples/FoilLCT/include/picongpu/param/memory.param index a3d715dbdb2..fc76a1a2d67 100644 --- a/share/picongpu/examples/FoilLCT/include/picongpu/param/memory.param +++ b/share/picongpu/examples/FoilLCT/include/picongpu/param/memory.param @@ -114,4 +114,6 @@ namespace picongpu */ constexpr bool fieldTmpSupportGatherCommunication = true; + using ParticleFrameMapping = llama::mapping::BindSoA; + using SharedDataBoxMapping = llama::mapping::BindAoS; } // namespace picongpu diff --git a/share/picongpu/examples/KelvinHelmholtz/include/picongpu/param/memory.param b/share/picongpu/examples/KelvinHelmholtz/include/picongpu/param/memory.param index ba21628f45d..d149549bd01 100644 --- a/share/picongpu/examples/KelvinHelmholtz/include/picongpu/param/memory.param +++ b/share/picongpu/examples/KelvinHelmholtz/include/picongpu/param/memory.param @@ -114,4 +114,6 @@ namespace picongpu */ constexpr bool fieldTmpSupportGatherCommunication = true; + using ParticleFrameMapping = llama::mapping::BindSoA; + using SharedDataBoxMapping = llama::mapping::BindAoS; } // namespace picongpu diff --git a/share/picongpu/examples/WeibelTransverse/include/picongpu/param/memory.param b/share/picongpu/examples/WeibelTransverse/include/picongpu/param/memory.param index 51b536b4e8a..403ed2dbca1 100644 --- a/share/picongpu/examples/WeibelTransverse/include/picongpu/param/memory.param +++ b/share/picongpu/examples/WeibelTransverse/include/picongpu/param/memory.param @@ -114,4 +114,6 @@ namespace picongpu */ constexpr bool fieldTmpSupportGatherCommunication = true; + using ParticleFrameMapping = llama::mapping::BindSoA; + using SharedDataBoxMapping = llama::mapping::BindAoS; } // namespace picongpu diff --git a/share/picongpu/pypicongpu/template/include/picongpu/param/memory.param b/share/picongpu/pypicongpu/template/include/picongpu/param/memory.param index 80db20fb5ab..cf8e826be25 100644 --- a/share/picongpu/pypicongpu/template/include/picongpu/param/memory.param +++ b/share/picongpu/pypicongpu/template/include/picongpu/param/memory.param @@ -114,4 +114,6 @@ namespace picongpu */ constexpr bool fieldTmpSupportGatherCommunication = true; + using ParticleFrameMapping = llama::mapping::BindSoA; + using SharedDataBoxMapping = llama::mapping::BindAoS; } // namespace picongpu diff --git a/share/picongpu/tests/CollisionsBeamRelaxation/include/picongpu/param/memory.param b/share/picongpu/tests/CollisionsBeamRelaxation/include/picongpu/param/memory.param index 1d71aee7304..c0c341be2f2 100644 --- a/share/picongpu/tests/CollisionsBeamRelaxation/include/picongpu/param/memory.param +++ b/share/picongpu/tests/CollisionsBeamRelaxation/include/picongpu/param/memory.param @@ -114,4 +114,6 @@ namespace picongpu */ constexpr bool fieldTmpSupportGatherCommunication = true; + using ParticleFrameMapping = llama::mapping::BindSoA; + using SharedDataBoxMapping = llama::mapping::BindAoS; } // namespace picongpu diff --git a/share/picongpu/tests/CollisionsThermalisation/include/picongpu/param/memory.param b/share/picongpu/tests/CollisionsThermalisation/include/picongpu/param/memory.param index 1d71aee7304..c0c341be2f2 100644 --- a/share/picongpu/tests/CollisionsThermalisation/include/picongpu/param/memory.param +++ b/share/picongpu/tests/CollisionsThermalisation/include/picongpu/param/memory.param @@ -114,4 +114,6 @@ namespace picongpu */ constexpr bool fieldTmpSupportGatherCommunication = true; + using ParticleFrameMapping = llama::mapping::BindSoA; + using SharedDataBoxMapping = llama::mapping::BindAoS; } // namespace picongpu diff --git a/share/pmacc/examples/gameOfLife2D/include/Evolution.hpp b/share/pmacc/examples/gameOfLife2D/include/Evolution.hpp index bc16c56b366..c1c3b9a5786 100644 --- a/share/pmacc/examples/gameOfLife2D/include/Evolution.hpp +++ b/share/pmacc/examples/gameOfLife2D/include/Evolution.hpp @@ -71,7 +71,7 @@ namespace gol using Type = typename T_BoxReadOnly::ValueType; using SuperCellSize = typename T_Mapping::SuperCellSize; using BlockArea = SuperCellDescription, math::CT::Int<1, 1>>; - auto cache = CachedBox::create<0, Type>(worker, BlockArea()); + auto cache = CachedBox::create<0, SharedDataBoxMapping, Type>(worker, BlockArea()); Space const block(mapper.getSuperCellIndex(Space(cupla::blockIdx(worker.getAcc())))); Space const blockCell = block * T_Mapping::SuperCellSize::toRT();