Skip to content

Commit a16bea8

Browse files
committed
Merge pull request ComputationalRadiationPhysics#890 from psychocoderHPC/fix-DSBlockDimBug
close ComputationalRadiationPhysics#889 field solver DS out of memory access
2 parents cf4e054 + 8240679 commit a16bea8

File tree

2 files changed

+30
-15
lines changed

2 files changed

+30
-15
lines changed

src/picongpu/include/fields/MaxwellSolver/DirSplitting/DirSplitting.hpp

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,26 @@ struct ConditionCheck<DirSplitting, T_Dummy>
7070
class DirSplitting : private ConditionCheck<fieldSolver::FieldSolver>
7171
{
7272
private:
73-
template<typename CursorE, typename CursorB, typename GridSize>
73+
template<typename OrientationTwist,typename CursorE, typename CursorB, typename GridSize>
7474
void propagate(CursorE cursorE, CursorB cursorB, GridSize gridSize) const
7575
{
76-
typedef SuperCellSize BlockDim;
76+
using namespace cursor::tools;
77+
using namespace PMacc::math::tools;
78+
79+
PMACC_AUTO(gridSizeTwisted,twistVectorAxes<OrientationTwist>(gridSize));
80+
81+
/* twist components of the supercell */
82+
typedef PMacc::math::CT::Int<
83+
PMacc::math::CT::At<SuperCellSize,typename OrientationTwist::x>::type::value,
84+
PMacc::math::CT::At<SuperCellSize,typename OrientationTwist::y>::type::value,
85+
PMacc::math::CT::At<SuperCellSize,typename OrientationTwist::z>::type::value
86+
> BlockDim;
7787

7888
algorithm::kernel::ForeachBlock<BlockDim> foreach;
79-
foreach(zone::SphericZone<3>(PMacc::math::Size_t<3>(BlockDim::x::value, gridSize.y(), gridSize.z())),
80-
cursor::make_NestedCursor(cursorE),
81-
cursor::make_NestedCursor(cursorB),
82-
DirSplittingKernel<BlockDim>((int)gridSize.x()));
89+
foreach(zone::SphericZone<3>(PMacc::math::Size_t<3>(BlockDim::x::value, gridSizeTwisted.y(), gridSizeTwisted.z())),
90+
cursor::make_NestedCursor(twistVectorFieldAxes<OrientationTwist>(cursorE)),
91+
cursor::make_NestedCursor(twistVectorFieldAxes<OrientationTwist>(cursorB)),
92+
DirSplittingKernel<BlockDim>((int)gridSizeTwisted.x()));
8393
}
8494
public:
8595
DirSplitting(MappingDesc) {}
@@ -107,25 +117,30 @@ class DirSplitting : private ConditionCheck<fieldSolver::FieldSolver>
107117

108118
PMacc::math::Size_t<3> gridSize = fieldE_coreBorder.size();
109119

110-
propagate(fieldE_coreBorder.origin(),
120+
121+
typedef PMacc::math::CT::Int<0,1,2> Orientation_X;
122+
propagate<Orientation_X>(
123+
fieldE_coreBorder.origin(),
111124
fieldB_coreBorder.origin(),
112-
fieldE_coreBorder.size());
125+
gridSize);
113126

114127
__setTransactionEvent(fieldE.asyncCommunication(__getTransactionEvent()));
115128
__setTransactionEvent(fieldB.asyncCommunication(__getTransactionEvent()));
116129

117130
typedef PMacc::math::CT::Int<1,2,0> Orientation_Y;
118-
propagate(twistVectorFieldAxes<Orientation_Y>(fieldE_coreBorder.origin()),
119-
twistVectorFieldAxes<Orientation_Y>(fieldB_coreBorder.origin()),
120-
twistVectorAxes<Orientation_Y>(gridSize));
131+
propagate<Orientation_Y>(
132+
fieldE_coreBorder.origin(),
133+
fieldB_coreBorder.origin(),
134+
gridSize);
121135

122136
__setTransactionEvent(fieldE.asyncCommunication(__getTransactionEvent()));
123137
__setTransactionEvent(fieldB.asyncCommunication(__getTransactionEvent()));
124138

125139
typedef PMacc::math::CT::Int<2,0,1> Orientation_Z;
126-
propagate(twistVectorFieldAxes<Orientation_Z>(fieldE_coreBorder.origin()),
127-
twistVectorFieldAxes<Orientation_Z>(fieldB_coreBorder.origin()),
128-
twistVectorAxes<Orientation_Z>(gridSize));
140+
propagate<Orientation_Z>(
141+
fieldE_coreBorder.origin(),
142+
fieldB_coreBorder.origin(),
143+
gridSize);
129144

130145
if (laserProfile::INIT_TIME > float_X(0.0))
131146
dc.getData<FieldE > (FieldE::getName(), true).laserManipulation(currentStep);

src/picongpu/include/fields/MaxwellSolver/DirSplitting/DirSplitting.kernel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ struct DirSplittingKernel
3636
{
3737
typedef void result_type;
3838

39-
int totalLength;
39+
PMACC_ALIGN(totalLength,int);
4040
DirSplittingKernel(int totalLength) : totalLength(totalLength) {}
4141

4242
template<typename CursorE, typename CursorB >

0 commit comments

Comments
 (0)