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 Environment : public pmacc::detail::Environment

Global Environment singleton for PMacc.

Public Functions

pmacc::GridController<T_dim> &GridController()

get the singleton GridController

Return

instance of GridController

pmacc::SubGrid<T_dim> &SubGrid()

get the singleton SubGrid

Return

instance of SubGrid

pmacc::Filesystem<T_dim> &Filesystem()

get the singleton Filesystem

Return

instance of Filesystem

void initDevices(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 initGrids(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]

Environment(const Environment&)
Environment &operator=(const Environment&)

Public Static Functions

static Environment<T_dim> &get()

get the singleton Environment< DIM >

Return

instance of Environment<DIM >

DataConnector

class 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 hasId(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 initialise(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 share(const std::shared_ptr<ISimulationData> &data)

Register a new Dataset and share its ownership.

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

Parameters
  • data: simulation data to share ownership

void consume(std::unique_ptr<ISimulationData> data)

Register a new Dataset and transfer its ownership.

If a Dataset with the same id already exists, a runtime_error is thrown. (Check with DataConnector::hasId when necessary.) The only difference from share() is transfer of ownership.

Parameters
  • data: simulation data to transfer ownership

void deregister(SimulationDataId id)

End sharing a dataset with identifier id.

Parameters
  • id: id of the dataset to remove

void clean()

Unshare all associated datasets.

template<class TYPE>
std::shared_ptr<TYPE> get(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 releaseData(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 T_Dim>
class DataSpace : public pmacc::math::Vector<int, T_Dim>

A T_Dim-dimensional data space.

DataSpace describes a T_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
  • T_Dim: dimension (1-3) of the dataspace

Public Types

template<>
using BaseType = math::Vector<int, T_Dim>

Public Functions

HDINLINE DataSpace()

default constructor.

Sets size of all dimensions to 0.

HDINLINE DataSpace(dim3 value)

constructor.

Sets size of all dimensions from cuda dim3.

HDINLINE DataSpace(uint3 value)

constructor.

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

HDINLINE DataSpace(const DataSpace<T_Dim> &value)
HDINLINE DataSpace(int x)

Constructor for DIM1-dimensional DataSpace.

Parameters
  • x: size of first dimension

HDINLINE DataSpace(int x, int y)

Constructor for DIM2-dimensional DataSpace.

Parameters
  • x: size of first dimension

  • y: size of second dimension

HDINLINE DataSpace(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 DataSpace(const BaseType &vec)
HDINLINE DataSpace(const math::Size_t<T_Dim> &vec)
HDINLINE int pmacc::DataSpace::getDim() const

Returns number of dimensions (T_Dim) of this DataSpace.

Return

number of dimensions

HINLINE bool pmacc::DataSpace::isOneDimensionGreaterThan(const DataSpace < T_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 operator math::Size_t<T_Dim>() const
HDINLINE operator dim3() const

Public Static Functions

static HDINLINE DataSpace<T_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 Dim = T_Dim

Vector

Warning

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

SuperCell

template<class T_FrameType>
class SuperCell

Public Functions

HDINLINE SuperCell()
HDINLINE T_FrameType* pmacc::SuperCell::FirstFramePtr()
HDINLINE T_FrameType* pmacc::SuperCell::LastFramePtr()
HDINLINE T_FrameType const* pmacc::SuperCell::FirstFramePtr() const
HDINLINE T_FrameType const* pmacc::SuperCell::LastFramePtr() const
HDINLINE bool pmacc::SuperCell::mustShift() const
HDINLINE void pmacc::SuperCell::setMustShift(bool const value)
HDINLINE uint32_t pmacc::SuperCell::getSizeLastFrame() const
HDINLINE uint32_t pmacc::SuperCell::getNumParticles() const
HDINLINE void pmacc::SuperCell::setNumParticles(uint32_t const size)
PMACC_ALIGN(firstFramePtr, T_FrameType *)
PMACC_ALIGN(lastFramePtr, T_FrameType *)

GridBuffer

template<class TYPE, unsigned DIM, class BORDERTYPE = TYPE>
class GridBuffer : public pmacc::HostDeviceBuffer<TYPE, DIM>

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.

Public Types

typedef Parent::DataBoxType DataBoxType

Public Functions

GridBuffer(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.

GridBuffer(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)

GridBuffer(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)

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

Destructor.

void addExchange(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 addExchange(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 addExchangeBuffer(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 addExchangeBuffer(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 hasSendExchange(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 hasReceiveExchange(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> &getSendExchange(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> &getReceiveExchange(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 getSendMask() const

Returns the Mask describing send exchanges.

Return

Mask for send exchanges

Mask getReceiveMask() const

Returns the Mask describing receive exchanges.

Return

Mask for receive exchanges

EventTask communication()

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 asyncCommunication(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 asyncSend(EventTask serialEvent, uint32_t sendEx)
EventTask asyncReceive(EventTask serialEvent, uint32_t recvEx)
GridLayout<DIM> getGridLayout()

Returns the GridLayout describing this GridBuffer.

Return

the layout of this buffer

Protected Attributes

bool hasOneExchange
uint32_t lastUsedCommunicationTag
GridLayout<DIM> gridLayout
Mask sendMask
Mask receiveMask
template<>
ExchangeIntern<BORDERTYPE, DIM> *sendExchanges[27]
template<>
ExchangeIntern<BORDERTYPE, DIM> *receiveExchanges[27]
template<>
EventTask receiveEvents[27]
template<>
EventTask sendEvents[27]
uint32_t maxExchange

SimulationFieldHelper

template<class CellDescription>
class SimulationFieldHelper

Public Types

typedef CellDescription MappingDesc

Public Functions

SimulationFieldHelper(CellDescription description)
virtual ~SimulationFieldHelper()
virtual void reset(uint32_t currentStep) = 0

Reset is as well used for init.

virtual void syncToDevice() = 0

Synchronize data from host to device.

CellDescription getCellDescription() const

Protected Attributes

CellDescription cellDescription

ParticlesBase

template<typename T_ParticleDescription, class T_MappingDesc, typename T_DeviceHeap>
class ParticlesBase : public pmacc::SimulationFieldHelper<T_MappingDesc>

Public Types

enum [anonymous]

Values:

Dim = MappingDesc::Dim
Exchanges = traits::NumberOfExchanges<Dim>::value
TileSize = math::CT::volume<typename MappingDesc::SuperCellSize>::type::value
typedef ParticlesBuffer<ParticleDescription, typename MappingDesc::SuperCellSize, T_DeviceHeap, MappingDesc::Dim> BufferType
typedef BufferType::FrameType FrameType
typedef BufferType::FrameTypeBorder FrameTypeBorder
typedef BufferType::ParticlesBoxType ParticlesBoxType
typedef ParticleDescription::HandleGuardRegion HandleGuardRegion
typedef ParticlesTag SimulationDataTag

Public Functions

void fillAllGaps()
void fillBorderGaps()
void deleteGuardParticles(uint32_t exchangeType)
template<uint32_t T_area>
void deleteParticlesInArea()
void copyGuardToExchange(uint32_t exchangeType)

copy guard particles to intermediate exchange buffer

Copy all particles from the guard of a direction to the device exchange buffer.

Warning

This method resets the number of particles in the processed supercells even if there are particles left in the supercell and does not guarantee that the last frame is contiguous filled. Call fillAllGaps afterwards if you need a valid number of particles and a contiguously filled last frame.

void insertParticles(uint32_t exchangeType)
ParticlesBoxType getDeviceParticlesBox()
ParticlesBoxType getHostParticlesBox(const int64_t memoryOffset)
BufferType &getParticlesBuffer()
void reset(uint32_t currentStep)

Reset is as well used for init.

Protected Functions

ParticlesBase(const std::shared_ptr<T_DeviceHeap> &deviceHeap, MappingDesc description)
virtual ~ParticlesBase()
template<uint32_t AREA>
void shiftParticles()
template<uint32_t AREA>
void fillGaps()

Protected Attributes

BufferType *particlesBuffer

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 IPlugin : public pmacc::INotify

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

Public Functions

IPlugin()
virtual ~IPlugin()
virtual void load()
virtual void unload()
bool isLoaded()
virtual void checkpoint(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 restart(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 pluginRegisterHelp(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 pluginGetName() const = 0

Return the name of this plugin for status messages.

Return

plugin name

virtual void onParticleLeave(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 getLastCheckpoint() const

When was the plugin checkpointed last?

Return

last checkpoint’s time step

void setLastCheckpoint(uint32_t currentStep)

Remember last checkpoint call.

Parameters
  • currentStep: current simulation iteration step

Protected Functions

virtual void pluginLoad()
virtual void pluginUnload()

Protected Attributes

bool loaded
uint32_t lastCheckpoint

PluginConnector

class PluginConnector

Plugin registration and management class.

Public Functions

void registerPlugin(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 loadPlugins()

Calls load on all registered, not loaded plugins.

void unloadPlugins()

Unloads all registered, loaded plugins.

std::list<po::options_description> registerHelp()

Publishes command line parameters for registered plugins.

Return

list of boost program_options command line parameters

void setNotificationPeriod(INotify *notifiedObj, std::string const &period)

Set the notification period.

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

  • period: notification period

void notifyPlugins(uint32_t currentStep)

Notifies plugins that data should be dumped.

Parameters
  • currentStep: current simulation iteration step

void checkpointPlugins(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 restartPlugins(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 *> getPluginsFromType()

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 *> getAllPlugins() const

Return a copied list of pointers to all registered plugins.

Friends

friend pmacc::PluginConnector::detail::Environment

SimulationHelper

template<unsigned DIM>
class SimulationHelper : public pmacc::IPlugin

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)

Public Types

template<>
using SeqOfTimeSlices = std::vector<pluginSystem::TimeSlice>

Public Functions

SimulationHelper()

Constructor.

virtual ~SimulationHelper()
virtual void runOneStep(uint32_t currentStep) = 0

Must describe one iteration (step).

This function is called automatically.

virtual void init() = 0

Initialize simulation.

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

virtual uint32_t fillSimulation() = 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 resetAll(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 movingWindowCheck(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 dumpOneStep(uint32_t currentStep)

Notifies registered output classes.

This function is called automatically.

Parameters
  • currentStep: simulation step

GridController<DIM> &getGridController()
void dumpTimes(TimeIntervall &tSimCalculation, TimeIntervall&, double &roundAvg, uint32_t currentStep)
void startSimulation()

Begin the simulation.

virtual void pluginRegisterHelp(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 pluginGetName() const

Return the name of this plugin for status messages.

Return

plugin name

void pluginLoad()
void pluginUnload()
void restart(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 checkpoint(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> readCheckpointMasterFile()

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 runSteps
uint32_t softRestarts

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

std::string checkpointPeriod
SeqOfTimeSlices seqCheckpointPeriod
std::string checkpointDirectory
uint32_t numCheckpoints
int32_t restartStep
std::string restartDirectory
bool restartRequested
const std::string CHECKPOINT_MASTER_FILE
std::string author

ForEach

Warning

doxygenstruct: Cannot find class “meta::ForEach” in doxygen xml output for project “PIConGPU” from directory: ../xml

Kernel Start

template<typename T_KernelFunctor>
struct Kernel

wrapper for the user kernel functor

contains debug information like filename and line of the kernel call

Public Types

template<>
using KernelType = T_KernelFunctor

Public Functions

HINLINE Kernel(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 m_kernelFunctor

functor

std::string const m_file

file name from where the kernel is called

size_t const m_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;