Skip to content

Commit

Permalink
Merge pull request ComputationalRadiationPhysics#890 from psychocoder…
Browse files Browse the repository at this point in the history
…HPC/fix-DSBlockDimBug

close ComputationalRadiationPhysics#889 field solver DS out of memory access
  • Loading branch information
ax3l committed May 27, 2015
2 parents cf4e054 + 8240679 commit a16bea8
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,26 @@ struct ConditionCheck<DirSplitting, T_Dummy>
class DirSplitting : private ConditionCheck<fieldSolver::FieldSolver>
{
private:
template<typename CursorE, typename CursorB, typename GridSize>
template<typename OrientationTwist,typename CursorE, typename CursorB, typename GridSize>
void propagate(CursorE cursorE, CursorB cursorB, GridSize gridSize) const
{
typedef SuperCellSize BlockDim;
using namespace cursor::tools;
using namespace PMacc::math::tools;

PMACC_AUTO(gridSizeTwisted,twistVectorAxes<OrientationTwist>(gridSize));

/* twist components of the supercell */
typedef PMacc::math::CT::Int<
PMacc::math::CT::At<SuperCellSize,typename OrientationTwist::x>::type::value,
PMacc::math::CT::At<SuperCellSize,typename OrientationTwist::y>::type::value,
PMacc::math::CT::At<SuperCellSize,typename OrientationTwist::z>::type::value
> BlockDim;

algorithm::kernel::ForeachBlock<BlockDim> foreach;
foreach(zone::SphericZone<3>(PMacc::math::Size_t<3>(BlockDim::x::value, gridSize.y(), gridSize.z())),
cursor::make_NestedCursor(cursorE),
cursor::make_NestedCursor(cursorB),
DirSplittingKernel<BlockDim>((int)gridSize.x()));
foreach(zone::SphericZone<3>(PMacc::math::Size_t<3>(BlockDim::x::value, gridSizeTwisted.y(), gridSizeTwisted.z())),
cursor::make_NestedCursor(twistVectorFieldAxes<OrientationTwist>(cursorE)),
cursor::make_NestedCursor(twistVectorFieldAxes<OrientationTwist>(cursorB)),
DirSplittingKernel<BlockDim>((int)gridSizeTwisted.x()));
}
public:
DirSplitting(MappingDesc) {}
Expand Down Expand Up @@ -107,25 +117,30 @@ class DirSplitting : private ConditionCheck<fieldSolver::FieldSolver>

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

propagate(fieldE_coreBorder.origin(),

typedef PMacc::math::CT::Int<0,1,2> Orientation_X;
propagate<Orientation_X>(
fieldE_coreBorder.origin(),
fieldB_coreBorder.origin(),
fieldE_coreBorder.size());
gridSize);

__setTransactionEvent(fieldE.asyncCommunication(__getTransactionEvent()));
__setTransactionEvent(fieldB.asyncCommunication(__getTransactionEvent()));

typedef PMacc::math::CT::Int<1,2,0> Orientation_Y;
propagate(twistVectorFieldAxes<Orientation_Y>(fieldE_coreBorder.origin()),
twistVectorFieldAxes<Orientation_Y>(fieldB_coreBorder.origin()),
twistVectorAxes<Orientation_Y>(gridSize));
propagate<Orientation_Y>(
fieldE_coreBorder.origin(),
fieldB_coreBorder.origin(),
gridSize);

__setTransactionEvent(fieldE.asyncCommunication(__getTransactionEvent()));
__setTransactionEvent(fieldB.asyncCommunication(__getTransactionEvent()));

typedef PMacc::math::CT::Int<2,0,1> Orientation_Z;
propagate(twistVectorFieldAxes<Orientation_Z>(fieldE_coreBorder.origin()),
twistVectorFieldAxes<Orientation_Z>(fieldB_coreBorder.origin()),
twistVectorAxes<Orientation_Z>(gridSize));
propagate<Orientation_Z>(
fieldE_coreBorder.origin(),
fieldB_coreBorder.origin(),
gridSize);

if (laserProfile::INIT_TIME > float_X(0.0))
dc.getData<FieldE > (FieldE::getName(), true).laserManipulation(currentStep);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ struct DirSplittingKernel
{
typedef void result_type;

int totalLength;
PMACC_ALIGN(totalLength,int);
DirSplittingKernel(int totalLength) : totalLength(totalLength) {}

template<typename CursorE, typename CursorB >
Expand Down

0 comments on commit a16bea8

Please sign in to comment.