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

Adds compatibility to isaac glm PR #3498

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 42 additions & 27 deletions include/picongpu/plugins/IsaacPlugin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,7 @@ namespace picongpu
ISAAC_HOST_DEVICE_INLINE isaac_float_dim<feature_dim> operator[](const isaac_int3& nIndex) const
{
auto value = shifted[nIndex.z][nIndex.y][nIndex.x];
isaac_float_dim<feature_dim> result
= {isaac_float(value.x()), isaac_float(value.y()), isaac_float(value.z())};
return result;
return isaac_float_dim<feature_dim>(value.x(), value.y(), value.z());
}
};

Expand Down Expand Up @@ -178,8 +176,7 @@ namespace picongpu
ISAAC_HOST_DEVICE_INLINE isaac_float_dim<feature_dim> operator[](const isaac_int3& nIndex) const
{
auto value = shifted[nIndex.z][nIndex.y][nIndex.x];
isaac_float_dim<feature_dim> result = {isaac_float(value.x())};
return result;
return isaac_float_dim<feature_dim>(value.x());
}
};

Expand Down Expand Up @@ -209,7 +206,7 @@ namespace picongpu
ISAAC_HOST_DEVICE_INLINE void next()
{
// iterate particles look for next frame
i++;
++i;
if(i >= frameSize)
{
frame = pb.getNextFrame(frame);
Expand All @@ -233,22 +230,20 @@ namespace picongpu
float3_X const absoluteOffset(particle[position_] + float3_X(frameCellOffset));

// calculate scaled position
float3_X const pos(
isaac_float3 const pos(
absoluteOffset.x() * (1._X / float_X(MappingDesc::SuperCellSize::x::value)),
absoluteOffset.y() * (1._X / float_X(MappingDesc::SuperCellSize::y::value)),
absoluteOffset.z() * (1._X / float_X(MappingDesc::SuperCellSize::z::value))
absoluteOffset.z() * (1._X / float_X(MappingDesc::SuperCellSize::z::value)));

);

return {pos[0], pos[1], pos[2]};
return pos;
}

// returns particle momentum as color attribute
ISAAC_HOST_DEVICE_INLINE isaac_float_dim<feature_dim> getAttribute() const
{
auto const particle = frame[i];
float3_X const mom = particle[momentum_];
return {mom[0], mom[1], mom[2]};
return isaac_float_dim<feature_dim>(mom[0], mom[1], mom[2]);
}


Expand Down Expand Up @@ -374,8 +369,7 @@ namespace picongpu
class IsaacPlugin : public ILightweightPlugin
{
public:
typedef boost::mpl::int_<simDim> SimDim;
static const size_t textureDim = 1024;
static const ISAAC_IDX_TYPE textureDim = 1024;
using SourceList = bmpl::
transform<boost::fusion::result_of::as_list<Fields_Seq>::type, Transformoperator<bmpl::_1>>::type;
// create compile time particle list
Expand All @@ -387,12 +381,9 @@ namespace picongpu
cupla::Acc,
cupla::AccStream,
cupla::KernelDim,
SimDim,
ParticleList,
SourceList,
DataSpace<simDim>,
textureDim,
float3_X,
#if(ISAAC_STEREO == 0)
isaac::DefaultController,
isaac::DefaultCompositor
Expand Down Expand Up @@ -440,10 +431,20 @@ namespace picongpu
if(movingWindow)
{
Window window(MovingWindow::getInstance().getWindow(currentStep));
visualization->updatePosition(window.localDimensions.offset);
visualization->updateLocalSize(window.localDimensions.size);
visualization->updateLocalParticleSize(
window.localDimensions.size / MappingDesc::SuperCellSize::toRT());
isaac_size3 position;
isaac_size3 local_size;
isaac_size3 particle_size;

for(ISAAC_IDX_TYPE i = 0; i < 3; ++i)
{
position[i] = window.localDimensions.offset[i];
local_size[i] = window.localDimensions.size[i];
particle_size[i]
= window.localDimensions.size[i] / MappingDesc::SuperCellSize::toRT()[i];
}
visualization->updatePosition(position);
visualization->updateLocalSize(local_size);
visualization->updateLocalParticleSize(particle_size);
visualization->updateBounding();
}
if(rank == 0 && visualization->kernel_time)
Expand Down Expand Up @@ -575,8 +576,11 @@ namespace picongpu
MPI_Comm_size(MPI_COMM_WORLD, &numProc);
if(MovingWindow::getInstance().isEnabled())
movingWindow = true;
float_X minCellSize = math::min(cellSize[0], math::min(cellSize[1], cellSize[2]));
float3_X cellSizeFactor = cellSize / minCellSize;
isaac_float minCellSize = math::min(cellSize[0], math::min(cellSize[1], cellSize[2]));
isaac_float3 cellSizeFactor(
cellSize[0] / minCellSize,
cellSize[1] / minCellSize,
cellSize[2] / minCellSize);

const SubGrid<simDim>& subGrid = Environment<simDim>::get().SubGrid();

Expand All @@ -585,6 +589,17 @@ namespace picongpu
isaac_for_each_params(sources, SourceInitIterator(), cellDescription, movingWindow);
isaac_for_each_params(particleSources, ParticleSourceInitIterator(), movingWindow);

isaac_size3 global_size;
isaac_size3 local_size;
isaac_size3 particle_size;
isaac_size3 position;
for(ISAAC_IDX_TYPE i = 0; i < 3; ++i)
{
global_size[i] = MovingWindow::getInstance().getWindow(0).globalDimensions.size[i];
local_size[i] = subGrid.getLocalDomain().size[i];
particle_size[i] = subGrid.getLocalDomain().size[i] / SuperCellSize::toRT()[i];
position[i] = subGrid.getLocalDomain().offset[i];
}
visualization = new VisualizationType(
cupla::manager::Device<cupla::AccHost>::get().current(),
cupla::manager::Device<cupla::AccDev>::get().current(),
Expand All @@ -594,10 +609,10 @@ namespace picongpu
url,
port,
framebuffer_size,
MovingWindow::getInstance().getWindow(0).globalDimensions.size,
subGrid.getLocalDomain().size,
subGrid.getLocalDomain().size / SuperCellSize::toRT(),
subGrid.getLocalDomain().offset,
global_size,
local_size,
particle_size,
position,
particleSources,
sources,
cellSizeFactor);
Expand Down