Important PMacc Classes

This is very, very small selection of classes of interest to get you started.

Note

Please help adding more Doxygen doc strings to the classes described below. As an example, here is a listing of possible extensive docs that new developers find are missing: https://github.com/ComputationalRadiationPhysics/picongpu/issues/776

Environment

template <uint32_t T_dim>
class PMacc::Environment

Global Environment singleton for PMacc.

Inherits from PMacc::detail::Environment

Public Functions

PMacc::GridController<T_dim> &PMacc::EnvironmentGridController()

get the singleton GridController

Return
instance of GridController

PMacc::SubGrid<T_dim> &PMacc::EnvironmentSubGrid()

get the singleton SubGrid

Return
instance of SubGrid

PMacc::Filesystem<T_dim> &PMacc::EnvironmentFilesystem()

get the singleton Filesystem

Return
instance of Filesystem

void PMacc::EnvironmentinitDevices(DataSpace<T_dim> devices, DataSpace<T_dim> periodic)

create and initialize the environment of PMacc

Usage of MPI or device(accelerator) function calls before this method are not allowed.

Parameters
  • devices: number of devices per simulation dimension
  • periodic: periodicity each simulation dimension (0 == not periodic, 1 == periodic)

void PMacc::EnvironmentinitGrids(DataSpace<T_dim> globalDomainSize, DataSpace<T_dim> localDomainSize, DataSpace<T_dim> localDomainOffset)

initialize the computing domain information of PMacc

Parameters
  • globalDomainSize: size of the global simulation domain [cells]
  • localDomainSize: size of the local simulation domain [cells]
  • localDomainOffset: local domain offset [cells]

PMacc::EnvironmentEnvironment(const Environment&)
Environment &PMacc::Environmentoperator=(const Environment&)

Public Static Functions

static Environment<T_dim> &PMacc::Environmentget()

get the singleton Environment< DIM >

Return
instance of Environment<DIM >

DataConnector

class PMacc::DataConnector

Singleton class which collects and shares simulation data.

All members are kept as shared pointers, which allows their factories to be destroyed after sharing ownership with our DataConnector.

Public Functions

bool PMacc::DataConnectorhasId(SimulationDataId id)

Returns if data with identifier id is shared.

Return
if dataset with id is registered
Parameters
  • id: id of the Dataset to query

void PMacc::DataConnectorinitialise(AbstractInitialiser &initialiser, uint32_t currentStep)

Initialises all Datasets using initialiser.

After initialising, the Datasets will be invalid.

Parameters
  • initialiser: class used for initialising Datasets
  • currentStep: current simulation step

void PMacc::DataConnectorshare(const std::shared_ptr<ISimulationData> &data)

Registers a new Dataset with data and identifier id.

If a Dataset with identifier id already exists, a runtime_error is thrown. (Check with DataConnector::hasId when necessary.)

Parameters
  • data: simulation data to share ownership

void PMacc::DataConnectorunshare(SimulationDataId id)

End sharing a dataset with identifier id.

Parameters
  • id: id of the dataset to remove

void PMacc::DataConnectorclean()

Unshare all associated datasets.

template <class TYPE>
std::shared_ptr<TYPE> PMacc::DataConnectorget(SimulationDataId id, bool noSync = false)

Returns shared pointer to managed data.

Reference to data in Dataset with identifier id and type TYPE is returned. If the Dataset status in invalid, it is automatically synchronized. Increments the reference counter to the dataset specified by id. This reference has to be released after all read/write operations before the next synchronize()/getData() on this data are done using releaseData().

Return
returns a reference to the data of type TYPE
Template Parameters
  • TYPE: if of the data to load
Parameters
  • id: id of the Dataset to load from
  • noSync: indicates that no synchronization should be performed, regardless of dataset status

void PMacc::DataConnectorreleaseData(SimulationDataId)

Indicate a data set gotten temporarily via.

See
getData is not used anymore

Parameters
  • id: id for the dataset previously acquired using getData()

Friends

friend PMacc::DataConnector::detail::Environment

DataSpace

template <unsigned DIM>
class PMacc::DataSpace

A DIM-dimensional data space.

DataSpace describes a DIM-dimensional data space with a specific size for each dimension. It only describes the space and does not hold any actual data.

Template Parameters
  • DIM: dimension (1-3) of the dataspace

Inherits from PMacc::math::Vector< int, DIM >

Public Types

typedef math::Vector<int, DIM> PMacc::DataSpaceBaseType

Public Functions

HDINLINE PMacc::DataSpaceDataSpace()

default constructor.

Sets size of all dimensions to 0.

HDINLINE PMacc::DataSpaceDataSpace(dim3 value)

constructor.

Sets size of all dimensions from cuda dim3.

HDINLINE PMacc::DataSpaceDataSpace(uint3 value)

constructor.

Sets size of all dimensions from cuda uint3 (e.g. threadIdx/blockIdx)

HDINLINE PMacc::DataSpaceDataSpace(const DataSpace<DIM> &value)
HDINLINE PMacc::DataSpaceDataSpace(int x)

Constructor for DIM1-dimensional DataSpace.

Parameters
  • x: size of first dimension

HDINLINE PMacc::DataSpaceDataSpace(int x, int y)

Constructor for DIM2-dimensional DataSpace.

Parameters
  • x: size of first dimension
  • y: size of second dimension

HDINLINE PMacc::DataSpaceDataSpace(int x, int y, int z)

Constructor for DIM3-dimensional DataSpace.

Parameters
  • x: size of first dimension
  • y: size of second dimension
  • z: size of third dimension

HDINLINE PMacc::DataSpaceDataSpace(const BaseType &vec)
HDINLINE PMacc::DataSpaceDataSpace(const math::Size_t<DIM> &vec)
HDINLINE int PMacc::DataSpace::getDim() const

Returns number of dimensions (DIM) of this DataSpace.

Return
number of dimensions

HINLINE bool PMacc::DataSpace::isOneDimensionGreaterThan(const DataSpace < DIM > & other) const

Evaluates if one dimension is greater than the respective dimension of other.

Return
true if one dimension is greater, false otherwise
Parameters

HDINLINE PMacc::DataSpaceoperator math::Size_t<DIM>() const
HDINLINE PMacc::DataSpaceoperator dim3() const

Public Static Functions

static HDINLINE DataSpace<DIM> PMacc::DataSpace::create(int value = 1)

Give DataSpace where all dimensions set to init value.

Return
the new DataSpace
Parameters
  • value: value which is setfor all dimensions

Public Static Attributes

constexpr int PMacc::DataSpaceDim =DIM

Vector

Warning

doxygenclass: Cannot find class “PMacc::Vector” in doxygen xml output for project “PIConGPU” from directory: ../xml

SuperCell

template <class TYPE>
class PMacc::SuperCell

Public Functions

HDINLINE PMacc::SuperCellSuperCell()
HDINLINE TYPE* PMacc::SuperCell::FirstFramePtr()
HDINLINE TYPE* PMacc::SuperCell::LastFramePtr()
HDINLINE const TYPE* PMacc::SuperCell::FirstFramePtr() const
HDINLINE const TYPE* PMacc::SuperCell::LastFramePtr() const
HDINLINE bool PMacc::SuperCell::mustShift()
HDINLINE void PMacc::SuperCell::setMustShift(bool value)
HDINLINE lcellId_t PMacc::SuperCell::getSizeLastFrame()
HDINLINE void PMacc::SuperCell::setSizeLastFrame(lcellId_t size)
PMacc::SuperCellPMACC_ALIGN(firstFramePtr, TYPE *)
PMacc::SuperCellPMACC_ALIGN(lastFramePtr, TYPE *)

GridBuffer

template <class TYPE, unsigned DIM, class BORDERTYPE = TYPE>
class PMacc::GridBuffer

GridBuffer represents a DIM-dimensional buffer which exists on the host as well as on the device.

GridBuffer combines a HostBuffer and a DeviceBuffer with equal sizes. Additionally, it allows sending data from and receiving data to these buffers. Buffers consist of core data which may be surrounded by border data.

Template Parameters
  • TYPE: datatype for internal Host- and DeviceBuffer
  • DIM: dimension of the buffers
  • BORDERTYPE: optional type for border data in the buffers. TYPE is used by default.

Inherits from PMacc::HostDeviceBuffer< TYPE, DIM >

Public Types

typedef Parent::DataBoxType PMacc::GridBufferDataBoxType

Public Functions

PMacc::GridBufferGridBuffer(const GridLayout<DIM> &gridLayout, bool sizeOnDevice = false)

Constructor.

Parameters
  • gridLayout: layout of the buffers, including border-cells
  • sizeOnDevice: if true, size information exists on device, too.

PMacc::GridBufferGridBuffer(const DataSpace<DIM> &dataSpace, bool sizeOnDevice = false)

Constructor.

Parameters
  • dataSpace: DataSpace representing buffer size without border-cells
  • sizeOnDevice: if true, internal buffers must store their size additionally on the device (as we keep this information coherent with the host, it influences performance on host-device copies, but some algorithms on the device might need to know the size of the buffer)

PMacc::GridBufferGridBuffer(DeviceBuffer<TYPE, DIM> &otherDeviceBuffer, const GridLayout<DIM> &gridLayout, bool sizeOnDevice = false)

Constructor.

Parameters
  • otherDeviceBuffer: DeviceBuffer which should be used instead of creating own DeviceBuffer
  • gridLayout: layout of the buffers, including border-cells
  • sizeOnDevice: if true, internal buffers must store their size additionally on the device (as we keep this information coherent with the host, it influences performance on host-device copies, but some algorithms on the device might need to know the size of the buffer)

PMacc::GridBufferGridBuffer(HostBuffer<TYPE, DIM> &otherHostBuffer, const DataSpace<DIM> &offsetHost, DeviceBuffer<TYPE, DIM> &otherDeviceBuffer, const DataSpace<DIM> &offsetDevice, const GridLayout<DIM> &gridLayout, bool sizeOnDevice = false)
virtual PMacc::GridBuffer~GridBuffer()

Destructor.

void PMacc::GridBufferaddExchange(uint32_t dataPlace, const Mask &receive, DataSpace<DIM> guardingCells, uint32_t communicationTag, bool sizeOnDeviceSend, bool sizeOnDeviceReceive)

Add Exchange in GridBuffer memory space.

An Exchange is added to this GridBuffer. The exchange buffers use the same memory as this GridBuffer.

Parameters
  • dataPlace: place where received data is stored [GUARD | BORDER] if dataPlace=GUARD than copy other BORDER to my GUARD if dataPlace=BORDER than copy other GUARD to my BORDER
  • receive: a Mask which describes the directions for the exchange
  • guardingCells: number of guarding cells in each dimension
  • communicationTag: unique tag/id for communication
  • sizeOnDeviceSend: if true, internal send buffers must store their size additionally on the device (as we keep this information coherent with the host, it influences performance on host-device copies, but some algorithms on the device might need to know the size of the buffer)
  • sizeOnDeviceReceive: if true, internal receive buffers must store their size additionally on the device

void PMacc::GridBufferaddExchange(uint32_t dataPlace, const Mask &receive, DataSpace<DIM> guardingCells, uint32_t communicationTag, bool sizeOnDevice = false)

Add Exchange in GridBuffer memory space.

An Exchange is added to this GridBuffer. The exchange buffers use the same memory as this GridBuffer.

Parameters
  • dataPlace: place where received data is stored [GUARD | BORDER] if dataPlace=GUARD than copy other BORDER to my GUARD if dataPlace=BORDER than copy other GUARD to my BORDER
  • receive: a Mask which describes the directions for the exchange
  • guardingCells: number of guarding cells in each dimension
  • communicationTag: unique tag/id for communication
  • sizeOnDevice: if true, internal buffers must store their size additionally on the device (as we keep this information coherent with the host, it influences performance on host-device copies, but some algorithms on the device might need to know the size of the buffer)

void PMacc::GridBufferaddExchangeBuffer(const Mask &receive, const DataSpace<DIM> &dataSpace, uint32_t communicationTag, bool sizeOnDeviceSend, bool sizeOnDeviceReceive)

Add Exchange in dedicated memory space.

An Exchange is added to this GridBuffer. The exchange buffers use the their own memory instead of using the GridBuffer’s memory space.

Parameters
  • receive: a Mask which describes the directions for the exchange
  • dataSpace: size of the newly created exchange buffer in each dimension
  • communicationTag: unique tag/id for communication
  • sizeOnDeviceSend: if true, internal send buffers must store their size additionally on the device (as we keep this information coherent with the host, it influences performance on host-device copies, but some algorithms on the device might need to know the size of the buffer)
  • sizeOnDeviceReceive: if true, internal receive buffers must store their size additionally on the device

void PMacc::GridBufferaddExchangeBuffer(const Mask &receive, const DataSpace<DIM> &dataSpace, uint32_t communicationTag, bool sizeOnDevice = false)

Add Exchange in dedicated memory space.

An Exchange is added to this GridBuffer. The exchange buffers use the their own memory instead of using the GridBuffer’s memory space.

Parameters
  • receive: a Mask which describes the directions for the exchange
  • dataSpace: size of the newly created exchange buffer in each dimension
  • communicationTag: unique tag/id for communication
  • sizeOnDevice: if true, internal buffers must store their size additionally on the device (as we keep this information coherent with the host, it influences performance on host-device copies, but some algorithms on the device might need to know the size of the buffer)

bool PMacc::GridBufferhasSendExchange(uint32_t ex) const

Returns whether this GridBuffer has an Exchange for sending in ex direction.

Return
true if send exchanges with ex direction exist, otherwise false
Parameters
  • ex: exchange direction to query

bool PMacc::GridBufferhasReceiveExchange(uint32_t ex) const

Returns whether this GridBuffer has an Exchange for receiving from ex direction.

Return
true if receive exchanges with ex direction exist, otherwise false
Parameters
  • ex: exchange direction to query

Exchange<BORDERTYPE, DIM> &PMacc::GridBuffergetSendExchange(uint32_t ex) const

Returns the Exchange for sending data in ex direction.

Returns an Exchange which for sending data from this GridBuffer in the direction described by ex.

Return
the Exchange for sending data
Parameters
  • ex: the direction to query

Exchange<BORDERTYPE, DIM> &PMacc::GridBuffergetReceiveExchange(uint32_t ex) const

Returns the Exchange for receiving data from ex direction.

Returns an Exchange which for receiving data to this GridBuffer from the direction described by ex.

Return
the Exchange for receiving data
Parameters
  • ex: the direction to query

Mask PMacc::GridBuffergetSendMask() const

Returns the Mask describing send exchanges.

Return
Mask for send exchanges

Mask PMacc::GridBuffergetReceiveMask() const

Returns the Mask describing receive exchanges.

Return
Mask for receive exchanges

EventTask PMacc::GridBuffercommunication()

Starts sync data from own device buffer to neighbor device buffer.

Asynchronously starts synchronization data from internal DeviceBuffer using added Exchange buffers. This operation runs sequential to other code but intern asynchronous

EventTask PMacc::GridBufferasyncCommunication(EventTask serialEvent)

Starts sync data from own device buffer to neighbor device buffer.

Asynchronously starts synchronization data from internal DeviceBuffer using added Exchange buffers.

EventTask PMacc::GridBufferasyncSend(EventTask serialEvent, uint32_t sendEx)
EventTask PMacc::GridBufferasyncReceive(EventTask serialEvent, uint32_t recvEx)
GridLayout<DIM> PMacc::GridBuffergetGridLayout()

Returns the GridLayout describing this GridBuffer.

Return
the layout of this buffer

Protected Attributes

bool PMacc::GridBufferhasOneExchange
uint32_t PMacc::GridBufferlastUsedCommunicationTag
GridLayout<DIM> PMacc::GridBuffergridLayout
Mask PMacc::GridBuffersendMask
Mask PMacc::GridBufferreceiveMask
template<>
ExchangeIntern<BORDERTYPE, DIM> *PMacc::GridBuffer<TYPE, DIM, BORDERTYPE>sendExchanges[27]
template<>
ExchangeIntern<BORDERTYPE, DIM> *PMacc::GridBuffer<TYPE, DIM, BORDERTYPE>receiveExchanges[27]
template<>
EventTask PMacc::GridBuffer<TYPE, DIM, BORDERTYPE>receiveEvents[27]
template<>
EventTask PMacc::GridBuffer<TYPE, DIM, BORDERTYPE>sendEvents[27]
uint32_t PMacc::GridBuffermaxExchange

SimulationFieldHelper

template <class CellDescription>
class PMacc::SimulationFieldHelper

Public Types

typedef CellDescription PMacc::SimulationFieldHelperMappingDesc

Public Functions

PMacc::SimulationFieldHelperSimulationFieldHelper(CellDescription description)
virtual PMacc::SimulationFieldHelper~SimulationFieldHelper()
virtual void PMacc::SimulationFieldHelperreset(uint32_t currentStep) = 0

Reset is as well used for init.

virtual void PMacc::SimulationFieldHelpersyncToDevice() = 0

Synchronize data from host to device.

Protected Attributes

CellDescription PMacc::SimulationFieldHelpercellDescription

ParticlesBase

template <typename T_ParticleDescription, class T_MappingDesc, typename T_DeviceHeap>
class PMacc::ParticlesBase

Inherits from PMacc::SimulationFieldHelper< T_MappingDesc >

Public Types

enum [anonymous]::ParticlesBase__anonymous23

Values:

PMacc::ParticlesBaseDim = MappingDesc::Dim
PMacc::ParticlesBaseExchanges = traits::NumberOfExchanges<Dim>::value
PMacc::ParticlesBaseTileSize = math::CT::volume<typename MappingDesc::SuperCellSize>::type::value
typedef ParticlesBuffer<ParticleDescription, typename MappingDesc::SuperCellSize, T_DeviceHeap, MappingDesc::Dim> PMacc::ParticlesBaseBufferType
typedef BufferType::FrameType PMacc::ParticlesBaseFrameType
typedef BufferType::FrameTypeBorder PMacc::ParticlesBaseFrameTypeBorder
typedef BufferType::ParticlesBoxType PMacc::ParticlesBaseParticlesBoxType
typedef ParticleDescription::HandleGuardRegion PMacc::ParticlesBaseHandleGuardRegion
typedef ParticlesTag PMacc::ParticlesBaseSimulationDataTag

Public Functions

void PMacc::ParticlesBasefillAllGaps()
void PMacc::ParticlesBasefillBorderGaps()
void PMacc::ParticlesBasedeleteGuardParticles(uint32_t exchangeType)
template <uint32_t T_area>
void PMacc::ParticlesBasedeleteParticlesInArea()
void PMacc::ParticlesBasebashParticles(uint32_t exchangeType)
void PMacc::ParticlesBaseinsertParticles(uint32_t exchangeType)
ParticlesBoxType PMacc::ParticlesBasegetDeviceParticlesBox()
ParticlesBoxType PMacc::ParticlesBasegetHostParticlesBox(const int64_t memoryOffset)
BufferType &PMacc::ParticlesBasegetParticlesBuffer()
void PMacc::ParticlesBasereset(uint32_t currentStep)

Reset is as well used for init.

Protected Functions

PMacc::ParticlesBaseParticlesBase(const std::shared_ptr<T_DeviceHeap> &deviceHeap, MappingDesc description)
virtual PMacc::ParticlesBase~ParticlesBase()
template <uint32_t AREA>
void PMacc::ParticlesBaseshiftParticles()
template <uint32_t AREA>
void PMacc::ParticlesBasefillGaps()

Protected Attributes

BufferType *PMacc::ParticlesBaseparticlesBuffer

ParticleDescription

Warning

doxygenclass: Cannot find class “PMacc::ParticleDescription” in doxygen xml output for project “PIConGPU” from directory: ../xml

ParticleBox

Warning

doxygenclass: Cannot find class “PMacc::ParticleBox” in doxygen xml output for project “PIConGPU” from directory: ../xml

Frame

Warning

doxygenclass: Cannot find class “PMacc::Frame” in doxygen xml output for project “PIConGPU” from directory: ../xml

IPlugin

class PMacc::IPlugin

Inherits from PMacc::INotify

Subclassed by picongpu::ISimulationPlugin, picongpu::ISimulationStarter, PMacc::SimulationHelper< DIM >, PMacc::SimulationHelper< simDim >

Public Functions

PMacc::IPluginIPlugin()
virtual PMacc::IPlugin~IPlugin()
virtual void PMacc::IPluginload()
virtual void PMacc::IPluginunload()
bool PMacc::IPluginisLoaded()
virtual void PMacc::IPlugincheckpoint(uint32_t currentStep, const std::string checkpointDirectory) = 0

Notifies plugins that a (restartable) checkpoint should be created for this timestep.

Parameters
  • currentStep: cuurent simulation iteration step
  • checkpointDirectory: common directory for checkpoints

virtual void PMacc::IPluginrestart(uint32_t restartStep, const std::string restartDirectory) = 0

Restart notification callback.

Parameters
  • restartStep: simulation iteration step to restart from
  • restartDirectory: common restart directory (contains checkpoints)

virtual void PMacc::IPluginpluginRegisterHelp(po::options_description &desc) = 0

Register command line parameters for this plugin.

Parameters are parsed and set prior to plugin load.

Parameters
  • desc: boost::program_options description

virtual std::string PMacc::IPluginpluginGetName() const = 0

Return the name of this plugin for status messages.

Return
plugin name

virtual void PMacc::IPluginonParticleLeave(const std::string&, const int32_t)

Called each timestep if particles are leaving the global simulation volume.

This method is only called for species which are marked with the GuardHandlerCallPlugins policy in their descpription.

The order in which the plugins are called is undefined, so this means read-only access to the particles.

Parameters
  • speciesName: name of the particle species
  • direction: the direction the particles are leaving the simulation

uint32_t PMacc::IPlugingetLastCheckpoint() const

When was the plugin checkpointed last?

Return
last checkpoint’s time step

void PMacc::IPluginsetLastCheckpoint(uint32_t currentStep)

Remember last checkpoint call.

Parameters
  • currentStep: current simulation iteration step

Protected Functions

virtual void PMacc::IPluginpluginLoad()
virtual void PMacc::IPluginpluginUnload()

Protected Attributes

bool PMacc::IPluginloaded
uint32_t PMacc::IPluginlastCheckpoint

PluginConnector

class PMacc::PluginConnector

Plugin registration and management class.

Public Functions

void PMacc::PluginConnectorregisterPlugin(IPlugin *plugin)

Register a plugin for loading/unloading and notifications.

Plugins are loaded in the order they are registered and unloaded in reverse order. To trigger plugin notifications, call

See
setNotificationPeriod after registration.
Parameters
  • plugin: plugin to register

void PMacc::PluginConnectorloadPlugins()

Calls load on all registered, not loaded plugins.

void PMacc::PluginConnectorunloadPlugins()

Unloads all registered, loaded plugins.

std::list<po::options_description> PMacc::PluginConnectorregisterHelp()

Publishes command line parameters for registered plugins.

Return
list of boost program_options command line parameters

void PMacc::PluginConnectorsetNotificationPeriod(INotify *notifiedObj, uint32_t period)

Set the notification period.

Parameters
  • notifiedObj: the object to notify, e.g. an IPlugin instance
  • period: notification period

void PMacc::PluginConnectornotifyPlugins(uint32_t currentStep)

Notifies plugins that data should be dumped.

Parameters
  • currentStep: current simulation iteration step

void PMacc::PluginConnectorcheckpointPlugins(uint32_t currentStep, const std::string checkpointDirectory)

Notifies plugins that a restartable checkpoint should be dumped.

Parameters
  • currentStep: current simulation iteration step
  • checkpointDirectory: common directory for checkpoints

void PMacc::PluginConnectorrestartPlugins(uint32_t restartStep, const std::string restartDirectory)

Notifies plugins that a restart is required.

Parameters
  • restartStep: simulation iteration to restart from
  • restartDirectory: common restart directory (contains checkpoints)

template <typename Plugin>
std::vector<Plugin *> PMacc::PluginConnectorgetPluginsFromType()

Get a vector of pointers of all registered plugin instances of a given type.

Return
vector of plugin pointers
Template Parameters
  • Plugin: type of plugin

std::list<IPlugin *> PMacc::PluginConnectorgetAllPlugins() const

Return a copied list of pointers to all registered plugins.

Friends

friend PMacc::PluginConnector::detail::Environment

SimulationHelper

template <unsigned DIM>
class PMacc::SimulationHelper

Abstract base class for simulations.

Use this helper class to write your own concrete simulations by binding pure virtual methods.

Template Parameters
  • DIM: base dimension for the simulation (2-3)

Inherits from PMacc::IPlugin

Public Functions

PMacc::SimulationHelperSimulationHelper()

Constructor.

virtual PMacc::SimulationHelper~SimulationHelper()
virtual void PMacc::SimulationHelperrunOneStep(uint32_t currentStep) = 0

Must describe one iteration (step).

This function is called automatically.

virtual void PMacc::SimulationHelperinit() = 0

Initialize simulation.

Does hardware selections/reservations, memory allocations and initializes data structures as empty.

virtual uint32_t PMacc::SimulationHelperfillSimulation() = 0

Fills simulation with initial data after init()

Return
returns the first step of the simulation (can be >0 for, e.g., restarts from checkpoints)

virtual void PMacc::SimulationHelperresetAll(uint32_t currentStep) = 0

Reset the simulation to a state such as it was after init() but for a specific time step.

Can be used to call fillSimulation() again.

virtual void PMacc::SimulationHelpermovingWindowCheck(uint32_t currentStep) = 0

Check if moving window work must do.

If no moving window is needed the implementation of this function can be empty

Parameters
  • currentStep: simulation step

virtual void PMacc::SimulationHelperdumpOneStep(uint32_t currentStep)

Notifies registered output classes.

This function is called automatically.

Parameters
  • currentStep: simulation step

GridController<DIM> &PMacc::SimulationHelpergetGridController()
void PMacc::SimulationHelperdumpTimes(TimeIntervall &tSimCalculation, TimeIntervall&, double &roundAvg, uint32_t currentStep)
void PMacc::SimulationHelperstartSimulation()

Begin the simulation.

virtual void PMacc::SimulationHelperpluginRegisterHelp(po::options_description &desc)

Register command line parameters for this plugin.

Parameters are parsed and set prior to plugin load.

Parameters
  • desc: boost::program_options description

std::string PMacc::SimulationHelperpluginGetName() const

Return the name of this plugin for status messages.

Return
plugin name

void PMacc::SimulationHelperpluginLoad()
void PMacc::SimulationHelperpluginUnload()
void PMacc::SimulationHelperrestart(uint32_t restartStep, const std::string restartDirectory)

Restart notification callback.

Parameters
  • restartStep: simulation iteration step to restart from
  • restartDirectory: common restart directory (contains checkpoints)

void PMacc::SimulationHelpercheckpoint(uint32_t currentStep, const std::string checkpointDirectory)

Notifies plugins that a (restartable) checkpoint should be created for this timestep.

Parameters
  • currentStep: cuurent simulation iteration step
  • checkpointDirectory: common directory for checkpoints

Protected Functions

std::vector<uint32_t> PMacc::SimulationHelperreadCheckpointMasterFile()

Reads the checkpoint master file if any and returns all found checkpoint steps.

Return
vector of found checkpoints steps in order they appear in the file

Protected Attributes

uint32_t PMacc::SimulationHelperrunSteps
uint32_t PMacc::SimulationHelpersoftRestarts

Presentations: loop the whole simulation softRestarts times from initial step to runSteps.

uint32_t PMacc::SimulationHelpercheckpointPeriod
std::string PMacc::SimulationHelpercheckpointDirectory
uint32_t PMacc::SimulationHelpernumCheckpoints
int32_t PMacc::SimulationHelperrestartStep
std::string PMacc::SimulationHelperrestartDirectory
bool PMacc::SimulationHelperrestartRequested
const std::string PMacc::SimulationHelperCHECKPOINT_MASTER_FILE
std::string PMacc::SimulationHelperauthor

ForEach

template <typename T_MPLSeq, typename T_Functor, typename T_Accessor = compileTime::accessors::Identity< >>
struct PMacc::algorithms::forEach::ForEach

Compile-Time for each for Boost::MPL Type Lists.

Example: MPLSeq = boost::mpl::vector<int,float> Functor = any unary lambda functor Accessor = lambda operation identity

Template Parameters
  • T_MPLSeq: A mpl sequence that can be accessed by mpl::begin, mpl::end, mpl::next
  • T_Functor: An unary lambda functor with a HDINLINE void operator()(…) method _1 is substituted by Accessor’s result using boost::mpl::apply with elements from T_MPLSeq. The maximum number of parameters for the operator() is limited by PMACC_MAX_FUNCTOR_OPERATOR_PARAMS
  • T_Accessor: An unary lambda operation

definition: F(X) means boost::apply<F,X>

call: ForEach<MPLSeq,Functor,Accessor>()(42); unrolled code: Functor(Accessor(int))(42); Functor(Accessor(float))(42);

Public Types

typedef bmpl::transform<T_MPLSeq, ReplacePlaceholder<bmpl::_1>>::type PMacc::algorithms::forEach::ForEachSolvedFunctors
typedef boost::mpl::begin<SolvedFunctors>::type PMacc::algorithms::forEach::ForEachbegin
typedef boost::mpl::end<SolvedFunctors>::type PMacc::algorithms::forEach::ForEachend
typedef detail::CallFunctorOfIterator<begin, end> PMacc::algorithms::forEach::ForEachNextCall
typedef detail::CallFunctorOfIterator<end, end> PMacc::algorithms::forEach::ForEachFunctor

Public Functions

template <typename… T_Types>
PMACC_NO_NVCC_HDWARNING HDINLINE void PMacc::algorithms::forEach::ForEach::operator()(const T_Types &... ts) const
template <typename… T_Types>
PMACC_NO_NVCC_HDWARNING HDINLINE void PMacc::algorithms::forEach::ForEach::operator()(const T_Types &... ts)
template <typename X>
struct PMacc::algorithms::forEach::ForEachReplacePlaceholder

Inherits from boost::mpl::apply1< T_Functor, bmpl::apply1< T_Accessor, X >::type >

Kernel Start

template <typename T_KernelFunctor>
struct PMacc::exec::Kernel

wrapper for the user kernel functor

contains debug information like filename and line of the kernel call

Public Functions

HINLINE PMacc::exec::KernelKernel(T_KernelFunctor const &kernelFunctor, std::string const &file = std::string(), size_t const line = 0)

Return
Parameters
  • gridExtent: grid extent configuration for the kernel
  • blockExtent: block extent configuration for the kernel
  • sharedMemByte: dynamic shared memory used by the kernel (in byte )

template <typename T_VectorGrid, typename T_VectorBlock>
HINLINE auto PMacc::exec::Kernel::operator()(T_VectorGrid const & gridExtent, T_VectorBlock const & blockExtent, size_t const sharedMemByte = 0) const

configured kernel object

this objects contains the functor and the starting parameter

Template Parameters
  • T_VectorGrid: type which defines the grid extents (type must be castable to CUDA dim3)
  • T_VectorBlock: type which defines the block extents (type must be castable to CUDA dim3)
Parameters
  • gridExtent: grid extent configuration for the kernel
  • blockExtent: block extent configuration for the kernel
  • sharedMemByte: dynamic shared memory used by the kernel (in byte)

Public Members

T_KernelFunctor const PMacc::exec::Kernelm_kernelFunctor

functor

std::string const PMacc::exec::Kernelm_file

file name from where the kernel is called

size_t const PMacc::exec::Kernelm_line

line number in the file

PMACC_KERNEL(...)

create a kernel object out of a functor instance

this macro add the current filename and line number to the kernel object

Parameters
  • ...: instance of kernel functor

Struct Factory

Syntax to generate structs with all members inline. Allows to conveniently switch between variable and constant defined members without the need to declare or initialize them externally. See for example PIConGPU’s density.param for usage.

PMACC_STRUCT(name, ...)

generate a struct with static and dynamic members

PMACC_STRUCT(StructAlice,
    // constant member variable
    (PMACC_C_VALUE(float, varFoo, -1.0))
    // lvalue member variable
    (PMACC_VALUE(float, varFoo, -1.0))
    // constant vector member variable
    (PMACC_C_VECTOR_DIM(double, 3, vectorBarC, 1.134e-5, 1.134e-5, 1.134e-5))
    // lvalue vector member variable
    (PMACC_VECTOR_DIM(double, 3, vectorBarC, 1.134e-5, 1.134e-5, 1.134e-5))
    // constant string member variable
    (PMACC_C_STRING(someString, "anythingYouWant: even spaces!"))
    // plain C++ member
    PMACC_EXTENT(
        using float_64 = double;
        static constexpr int varBar = 42;
    );
);
Note
do not forget the surrounding parenthesize for each element of a sequence
Parameters

PMACC_C_VECTOR_DIM(type, dim, name, ...)

create static const member vector that needs no memory inside of the struct

PMACC_C_VECTOR_DIM(float_64, simDim, center_SI, 1.134e-5, 1.134e-5, 1.134e-5);
// is syntactically equivalent to
static const Vector<float_64,simDim> center_SI = Vector<float_64,simDim>(1.134e-5, 1.134e-5, 1.134e-5);
Parameters
  • type: type of an element
  • dim: number of vector components
  • name: member variable name
  • ...: enumeration of init values (number of components must be greater or equal than dim)

PMACC_C_VALUE(type, name, value)

create static constexpr member

PMACC_C_VALUE(float_64, power_SI, 2.0);
// is syntactically equivalent to
static constexpr float_64 power_SI = float_64(2.0);
Parameters
  • type: type of the member
  • name: member variable name
  • value: init value

PMACC_VALUE(type, name, initValue)

create changeable member

PMACC_VALUE(float_64, power_SI, 2.0);
// is the equivalent of
float_64 power_SI(2.0);
Parameters
  • type: type of the member
  • name: member variable name
  • value: init value

PMACC_VECTOR(type, name, ...)

create changeable member vector

PMACC_VECTOR(float2_64, center_SI, 1.134e-5, 1.134e-5);
// is the equivalent of
float2_64 center_SI(1.134e-5, 1.134e-5);
Parameters
  • type: type of an element
  • name: member variable name
  • ...: enumeration of init values

PMACC_VECTOR_DIM(type, dim, name, ...)

create changeable member vector

PMACC_VECTOR_DIM(float_64, simDim, center_SI, 1.134e-5, 1.134e-5, 1.134e-5);
// is the equivalent of
Vector<float_64,3> center_SI(1.134e-5, 1.134e-5, 1.134e-5);
Parameters
  • type: type of an element
  • dim: number of vector components
  • name: member variable name
  • ...: enumeration of init values (number of components must be equal to dim)

PMACC_C_STRING(name, initValue)

create static const character string

PMACC_C_STRING(filename, "fooFile.txt");
// is syntactically equivalent to
static const char* filename = (char*)"fooFile.txt";
Parameters
  • name: member variable name
  • char_string: character string

PMACC_EXTENT(...)

create any code extension

PMACC_EXTENT(typedef float FooFloat;)
// is the equivalent of
typedef float FooFloat;
Parameters
  • ...: any code

Identifier

Construct unique types, e.g. to name, access and assign default values to particle species’ attributes. See for example PIConGPU’s speciesAttributes.param for usage.

value_identifier(in_type, name, in_default)

define a unique identifier with name, type and a default value

The created identifier has the following options: getValue() - return the user defined value getName() - return the name of the identifier ::type - get type of the value

Parameters
  • in_type: type of the value
  • name: name of identifier
  • in_value: user defined value of in_type (can be a constructor of a class)

e.g. value_identifier(float,length,0.0f) typedef length::type value_type; // is float value_type x = length::getValue(); //set x to 0.f printf(“Identifier name: %s”,length::getName()); //print Identifier name: length

to create a instance of this value_identifier you can use: length() or length_

alias(name)

create an alias

an alias is a unspecialized type of an identifier or a value_identifier

example: alias(aliasName); //create type varname

Parameters
  • name: name of alias

to specialize an alias do: aliasName<valueIdentifierName> to create an instance of this alias you can use: aliasName(); or aliasName_

get type which is represented by the alias typedef typename traits::Resolve<name>::type resolved_type;