Doxygen API Reference#

See Original Doxygen output if preferred.

Sphinx API Reference#

template<typename T>
struct AccessGeneric#

Generic base type for an access descriptor around an object of type T.

Subclassed by NESO::Particles::Access::Add< T >, NESO::Particles::Access::Max< T >, NESO::Particles::Access::Min< T >, NESO::Particles::Access::Read< T >, NESO::Particles::Access::Write< T >

Public Members

T obj#
template<typename T>
struct Add : public NESO::Particles::Access::AccessGeneric<T>#

Atomic add access descriptor.

template<typename T>
struct Add#
#include <cell_dat.hpp>

Access:CellDat::Add<T> add access cellwise.

Public Functions

Add() = default#

Pointer to underlying data for the array.

inline T fetch_add(const int row, const int col, const T value)#

Public Members

T ***ptr#
int cell#
template<typename T>
struct Add#
#include <cell_dat_const.hpp>

Access:CellDatConst::Read<T> and Access:CellDatConst::Add<T> are the kernel argument types for accessing CellDatConst data in a kernel.

Public Functions

Add() = default#

Pointer to underlying data for the array.

inline T fetch_add(const int row, const int col, const T value)#

Public Members

T *ptr#
int nrow#
template<typename T>
struct Add#
#include <global_array.hpp>

Access:GlobalArray::Read<T> and Access:GlobalArray::Add<T> are the kernel argument types for accessing GlobalArray data in a kernel.

Public Functions

Add() = default#

Pointer to underlying data for the array.

inline void add(const int component, const T value)#

This does not return a value as the returned value would be a partial sum on this MPI rank.

Public Members

T *ptr#
template<typename T>
struct Add#
#include <local_array.hpp>

ParticleLoop access type for LocalArray Add access.

Public Functions

Add() = default#

Pointer to underlying data for the array.

inline T fetch_add(const int component, const T value)#

The local array is local to the MPI rank where the partial sum is a meaningful value.

Public Members

T *ptr#
struct Add#
#include <product_matrix.hpp>

ParticleLoop access type for ProductMatrix Add access.

Public Functions

Add() = default#
inline REAL fetch_add_real(const int product, const int property, const int component, const REAL value)#

Atomically increment a REAL product property.

Parameters:
  • product – The index of the product to access, i.e. the row in the product matrix.

  • property – The particle property to access using the ordering REAL ParticleProp instances were passed to the ProductMatrixSpec

  • component – The component of the property to access.

  • value – Value to increment property value by.

Returns:

Value prior to increment.

inline INT fetch_add_int(const int product, const int property, const int component, const INT value)#

Atomically increment a INT product property.

Parameters:
  • product – The index of the product to access, i.e. the row in the product matrix.

  • property – The particle property to access using the ordering INT ParticleProp instances were passed to the ProductMatrixSpec

  • component – The component of the property to access.

  • value – Value to increment property value by.

Returns:

Value prior to increment.

Public Members

REAL *ptr_real#
INT *ptr_int#
int const *offsets_real#
int const *offsets_int#
int num_products#
template<typename KEY_TYPE, typename VALUE_TYPE, INT WIDTH>
struct BlockedBinaryNode#

Generic node in a tree where each node stores an array of VALUE_TYPE elements of length WIDTH. BlockedBinaryTree is the class that actually creates the tree. This type should be trivially copyable to the device.

Public Functions

inline void reset()#

Reset the node to a default state with no child nodes and no data held.

inline bool is_node(const KEY_TYPE node_key)#

Test if the node corresponds to the input node key.#

Parameters:

node_key – Node key to test.

Returns:

True if this node corresponds to the input node key.

inline BlockedBinaryNode<KEY_TYPE, VALUE_TYPE, WIDTH> *next(const KEY_TYPE node_key)#

Assuming a node does not match a requested node key, return the child branch which might contain the node. If the node key matches the current node returns the current node.

Parameters:

node_key – Node key currently being searched for.

Returns:

Pointer to child node (may be nullptr).

inline bool get_location(const KEY_TYPE key, bool **leaf_set, VALUE_TYPE **value)#

For a given global key find the leaf location for the value and the bool that indicates if the value is set. If the key is not in the tree return false.

Parameters:
  • key[in] Global key to find location of value for.

  • leaf_set[inout] Return location that points to the flag that indicates if the value is set.

  • value[inout] Return location for a pointer to the value.

Returns:

True if the key is located in the tree otherwise false. The leaf_set and value parameters only contain meaningful values if the return value is true.

inline bool get(const KEY_TYPE key, VALUE_TYPE *value)#

For a given key find and return the stored value.

Parameters:
  • key[in] Input global key to retrieve value for.

  • value[inout] Pointer to value, only valid if the key is found.

Returns:

True if the key is found in the tree otherwise false.

inline bool set(const KEY_TYPE key, const VALUE_TYPE value)#

For a given key store the corresponding value in the tree. This function assumes that the node is already allocated and placed in the tree according to the node_key.

Parameters:
  • key – Global key to store value against.

  • value – Input value to store pointed to by key.

  • Returns – true if the value was successfully stored. A return value of false indicates the node which should store the value is not present in the tree.

inline void add_node(BlockedBinaryNode<KEY_TYPE, VALUE_TYPE, WIDTH> *node)#

Add an allocated node to the tree under a given node key. The node_key member of the added node will be used to determine tree placement.

Parameters:

node – Node to place into the tree.

Public Members

KEY_TYPE node_key#

The starting key this node in the tree holds, i.e. with WIDTH=8 node 2 holds keys [8,15].

BlockedBinaryNode<KEY_TYPE, VALUE_TYPE, WIDTH> *lhs#

Pointer to the node which forms the left hand branch from this node. May be nullptr if this node does not exist.

BlockedBinaryNode<KEY_TYPE, VALUE_TYPE, WIDTH> *rhs#

Pointer to the node which forms the right hand branch from this node. May be nullptr if this node does not exist.

bool exists[WIDTH]#

Bools that indicate if the entries in the data member are actual values.

VALUE_TYPE data[WIDTH]#

The storage for the values the tree holds.

Public Static Functions

static inline KEY_TYPE get_node_key(const KEY_TYPE key)#

For a given input key (in the global key space) get the node key which contains the values for the key.

Parameters:

key – Input key to index into the tree with.

Returns:

Node key that indicates the node in the tree which contains the key.

static inline KEY_TYPE get_leaf_key(const KEY_TYPE key)#

For a given input key (in the global key space) get the leaf key which can be used to index into the data member on the node which contains the key - see get_node_key.

Parameters:

key – Input key to index into container.

Returns:

Index into data member that corresponds to the input key.

template<typename KEY_TYPE, typename VALUE_TYPE, INT WIDTH>
class BlockedBinaryTree#

Create a blocked key-value map with a given block size. This class creates the tree and provides methods to get and set key-value pairs.

Public Functions

inline ~BlockedBinaryTree()#
inline BlockedBinaryTree(SYCLTargetSharedPtr sycl_target)#

Create a new tree on a given SYCL device.

inline void add(const KEY_TYPE key, const VALUE_TYPE value)#

Add a key-value pair to the container.

Parameters:
  • key – Key to add to container.

  • value – Value to add to container under given key.

inline bool host_get(const KEY_TYPE key, VALUE_TYPE *value)#

Host callable method to retrieve the value that corresponds to a given key.

Parameters:
  • key[in] Key to retrieve value for.

  • value[inout] Pointer to value type in which to place output value.

Returns:

True if the key is found in the container otherwise false.

Public Members

SYCLTargetSharedPtr sycl_target#

The SYCLTarget on which the tree is allocated.

BlockedBinaryNode<KEY_TYPE, VALUE_TYPE, WIDTH> *root#

The root node of the tree.

Protected Attributes

std::map<KEY_TYPE, BlockedBinaryNode<KEY_TYPE, VALUE_TYPE, WIDTH>*> nodes#
template<typename T>
class BufferBase#
#include <compute_target.hpp>

Subclassed by NESO::Particles::BufferDevice< int >, NESO::Particles::BufferDevice< REAL >, NESO::Particles::BufferDevice< REAL *** >, NESO::Particles::BufferDevice< INT *** >, NESO::Particles::BufferDevice< INT >, NESO::Particles::BufferDevice< REAL *const *const * >, NESO::Particles::BufferDevice< INT *const *const * >, NESO::Particles::BufferDevice< char >, NESO::Particles::BufferHost< int >, NESO::Particles::BufferHost< REAL *** >, NESO::Particles::BufferHost< INT *** >, NESO::Particles::BufferHost< MPI_Request >, NESO::Particles::BufferHost< MPI_Status >, NESO::Particles::BufferHost< INT >, NESO::Particles::BufferHost< REAL >, NESO::Particles::BufferHost< REAL *const *const * >, NESO::Particles::BufferHost< INT *const *const * >, NESO::Particles::BufferHost< char >, NESO::Particles::BufferDevice< T >, NESO::Particles::BufferHost< T >, NESO::Particles::BufferShared< T >

Public Functions

inline std::size_t size_bytes()#

Get the size of the allocation in bytes.

Returns:

size of buffer in bytes.

inline int realloc_no_copy(const std::size_t size)#

Reallocate the buffer to hold at least the requested number of elements. May or may not reduce the buffer size if called with a size less than the current allocation. Current contents is not copied to the new buffer.

Parameters:

size – Minimum number of elements this buffer should be able to hold.

inline sycl::event set_async(const std::vector<T> &data)#

Asynchronously set the values in the buffer to those in a std::vector.

Parameters:

data – Input vector to copy values from.

Returns:

Event to wait on before using new values in the buffer.

inline void set(const std::vector<T> &data)#

Set the values in the buffer to those in a std::vector. Blocks until the copy is complete.

Parameters:

data – Input vector to copy values from.

inline sycl::event get_async(std::vector<T> &data)#

Asynchronously get the values in the buffer into a std::vector.

Parameters:

data[inout] Input vector to copy values from buffer into.

Returns:

Event to wait on before using new values in the std::vector.

inline void get(std::vector<T> &data)#

Get the values in the buffer into a std::vector. Blocks until copy is complete.

Parameters:

data[inout] Input vector to copy values from buffer into.

inline std::vector<T> get()#

Get the values in the buffer into a std::vector.

Returns:

std::vector of values in the buffer.

Public Members

SYCLTargetSharedPtr sycl_target#

Compute device used by the instance.

T *ptr#

SYCL USM pointer to data.

std::size_t size#

Number of elements allocated.

Protected Functions

inline virtual T *malloc_wrapper(const std::size_t num_bytes) = 0#
inline virtual void free_wrapper(T *ptr) = 0#
inline void generic_init()#
inline void generic_free()#
inline BufferBase(SYCLTargetSharedPtr sycl_target, std::size_t size)#
inline void assert_allocated()#
template<typename T>
class BufferDevice : public NESO::Particles::BufferBase<T>#
#include <compute_target.hpp>

Container around USM device allocated memory that can be resized.

Public Functions

BufferDevice(const BufferDevice &st) = delete#

Disable (implicit) copies.

BufferDevice &operator=(BufferDevice const &a) = delete#

Disable (implicit) copies.

inline BufferDevice(SYCLTargetSharedPtr &sycl_target, size_t size)#

Create a new BufferDevice of a given number of elements.

Parameters:
  • sycl_target – SYCLTargetSharedPtr to use as compute device.

  • size – Number of elements.

inline BufferDevice(SYCLTargetSharedPtr sycl_target, const std::vector<T> &vec)#

Create a new BufferDevice from a std::vector. Note, this does not operate like a sycl::buffer and is a copy of the source vector.

Parameters:
  • sycl_target – SYCLTargetSharedPtr to use as compute device.

  • vec – Input vector to copy data from.

inline ~BufferDevice()#

Protected Functions

inline virtual T *malloc_wrapper(const std::size_t num_bytes) override#
inline virtual void free_wrapper(T *ptr) override#
template<typename T>
class BufferDeviceHost#
#include <compute_target.hpp>

Wrapper around a BufferDevice and a BufferHost to store data on the device and the host. To be used as an alternative to BufferShared where the programmer wants to explicitly handle when data is copied between the device and the host.

Public Functions

BufferDeviceHost(const BufferDeviceHost &st) = delete#

Disable (implicit) copies.

BufferDeviceHost &operator=(BufferDeviceHost const &a) = delete#

Disable (implicit) copies.

inline ~BufferDeviceHost()#
inline BufferDeviceHost(SYCLTargetSharedPtr sycl_target, size_t size)#

Create a new BufferDeviceHost of the request size on the requested compute target.

Parameters:
  • sycl_target – SYCLTargetSharedPtr to use as compute device.

  • size – Number of elements to initially allocate on the device and host.

inline BufferDeviceHost(SYCLTargetSharedPtr sycl_target, const std::vector<T> &vec)#

Create a new BufferDeviceHost from a std::vector. Note, this does not operate like a sycl::buffer and is a copy of the source vector.

Parameters:
  • sycl_target – SYCLTargetSharedPtr to use as compute device.

  • vec – Input vector to copy data from.

inline size_t size_bytes()#

Get the size in bytes of the allocation on the host and device.

Returns:

Number of bytes allocated on the host and device.

inline int realloc_no_copy(const size_t size)#

Reallocate both the device and host buffers to hold at least the requested number of elements. May or may not reduce the buffer size if called with a size less than the current allocation. Current contents is not copied to the new buffer.

Parameters:

size – Minimum number of elements this buffer should be able to hold.

inline void host_to_device()#

Copy the contents of the host buffer to the device buffer.

inline void device_to_host()#

Copy the contents of the device buffer to the host buffer.

inline sycl::event async_host_to_device()#

Start an asynchronous copy of the host data to the device buffer.

Returns:

sycl::event to wait on for completion of data movement.

inline sycl::event async_device_to_host()#

Start an asynchronous copy of the device data to the host buffer.

Returns:

sycl::event to wait on for completion of data movement.

Public Members

SYCLTargetSharedPtr sycl_target#

Compute device used by the instance.

size_t size#

Size of the allocation on device and host.

BufferDevice<T> d_buffer#

Wrapped BufferDevice.

BufferHost<T> h_buffer#

Wrapped BufferHost.

template<typename T>
class BufferHost : public NESO::Particles::BufferBase<T>#
#include <compute_target.hpp>

Container around USM host allocated memory that can be resized.

Public Functions

BufferHost(const BufferHost &st) = delete#

Disable (implicit) copies.

BufferHost &operator=(BufferHost const &a) = delete#

Disable (implicit) copies.

inline BufferHost(SYCLTargetSharedPtr sycl_target, size_t size)#

Create a new BufferHost of a given number of elements.

Parameters:
  • sycl_target – SYCLTargetSharedPtr to use as compute device.

  • size – Number of elements.

inline BufferHost(SYCLTargetSharedPtr sycl_target, const std::vector<T> &vec)#

Create a new BufferHost from a std::vector. Note, this does not operate like a sycl::buffer and is a copy of the source vector.

Parameters:
  • sycl_target – SYCLTargetSharedPtr to use as compute device.

  • vec – Input vector to copy data from.

inline ~BufferHost()#

Protected Functions

inline virtual T *malloc_wrapper(const std::size_t num_bytes) override#
inline virtual void free_wrapper(T *ptr) override#
template<typename T>
class BufferShared : public NESO::Particles::BufferBase<T>#
#include <compute_target.hpp>

Container around USM shared allocated memory that can be resized.

Public Functions

BufferShared(const BufferShared &st) = delete#

Disable (implicit) copies.

BufferShared &operator=(BufferShared const &a) = delete#

Disable (implicit) copies.

inline BufferShared(SYCLTargetSharedPtr sycl_target, size_t size)#

Create a new DeviceShared of a given number of elements.

Parameters:
  • sycl_target – SYCLTargetSharedPtr to use as compute device.

  • size – Number of elements.

inline BufferShared(SYCLTargetSharedPtr sycl_target, const std::vector<T> &vec)#

Create a new BufferShared from a std::vector. Note, this does not operate like a sycl::buffer and is a copy of the source vector.

Parameters:
  • sycl_target – SYCLTargetSharedPtr to use as compute device.

  • vec – Input vector to copy data from.

inline ~BufferShared()#

Protected Functions

inline virtual T *malloc_wrapper(const std::size_t num_bytes) override#
inline virtual void free_wrapper(T *ptr) override#
class CartesianCellBin#
#include <cell_binning.hpp>

Bin particle positions into the cells of a CartesianHMesh.

Public Functions

CartesianCellBin(const CartesianCellBin &st) = delete#

Disable (implicit) copies.

CartesianCellBin &operator=(CartesianCellBin const &a) = delete#

Disable (implicit) copies.

inline ~CartesianCellBin()#
inline CartesianCellBin(SYCLTargetSharedPtr sycl_target, CartesianHMeshSharedPtr mesh, ParticleDatSharedPtr<REAL> position_dat, ParticleDatSharedPtr<INT> cell_id_dat)#

Create instance to bin particles into cells of a CartesianHMesh.

Parameters:
  • sycl_target – SYCLTargetSharedPtr to use as compute device.

  • mesh – CartesianHMeshSharedPtr to containing the particles.

  • position_dat – ParticleDat with components equal to the mesh dimension containing particle positions.

  • cell_id_dat – ParticleDat to write particle cell ids to.

inline void execute()#

Apply the cell binning kernel to each particle stored on this MPI rank. Particles must be within the domain region owned by this MPI rank.

Private Members

BufferDevice<int> d_cell_counts#
BufferDevice<int> d_cell_starts#
BufferDevice<int> d_cell_ends#
SYCLTargetSharedPtr sycl_target#
CartesianHMeshSharedPtr mesh#
ParticleDatSharedPtr<REAL> position_dat#
ParticleDatSharedPtr<INT> cell_id_dat#
ParticleLoopSharedPtr loop#
class CartesianHMesh : public NESO::Particles::HMesh#
#include <mesh_interface.hpp>

Example mesh that duplicates a MeshHierarchy as a HMesh for examples and testing.

Public Functions

CartesianHMesh(const CartesianHMesh &st) = delete#

Disable (implicit) copies.

CartesianHMesh &operator=(CartesianHMesh const &a) = delete#

Disable (implicit) copies.

inline CartesianHMesh(MPI_Comm comm, const int ndim, std::vector<int> &dims, const double extent = 1.0, const int subdivision_order = 1, const int stencil_width = 0)#

Construct a mesh over a given MPI communicator with a specified shape.

Parameters:
  • comm – MPI Communicator to use for decomposition.

  • ndim – Number of dimensions.

  • dims – Number of coarse cells in each dimension.

  • extent – Width of each coarse cell in each dimension.

  • subdivision_order – Number of times to subdivide each coarse cell to produce the fine cells.

  • stencil_width – Width of the stencil, in number of cells, used to determine MPI neighbours.

inline virtual MPI_Comm get_comm()#

Get the MPI communicator of the mesh.

Returns:

MPI communicator.

inline virtual int get_ndim()#

Get the number of dimensions of the mesh.

Returns:

Number of mesh dimensions.

inline virtual std::vector<int> &get_dims()#

Get the Mesh dimensions.

Returns:

Mesh dimensions.

inline virtual int get_subdivision_order()#

Get the subdivision order of the mesh.

Returns:

Subdivision order.

inline virtual double get_cell_width_coarse()#

Get the mesh width of the coarse cells in the MeshHierarchy.

Returns:

MeshHierarchy coarse cell width.

inline virtual double get_cell_width_fine()#

Get the mesh width of the fine cells in the MeshHierarchy.

Returns:

MeshHierarchy fine cell width.

inline virtual double get_inverse_cell_width_coarse()#

Get the inverse mesh width of the coarse cells in the MeshHierarchy.

Returns:

MeshHierarchy inverse coarse cell width.

inline virtual double get_inverse_cell_width_fine()#

Get the inverse mesh width of the fine cells in the MeshHierarchy.

Returns:

MeshHierarchy inverse fine cell width.

inline virtual int get_ncells_coarse()#

Get the global number of coarse cells.

Returns:

Global number of coarse cells.

inline virtual int get_ncells_fine()#

Get the number of fine cells per coarse cell.

Returns:

Number of fine cells per coarse cell.

inline virtual int get_cell_count()#
Returns:

The number of “cell” NESO-Particles should consider.

inline int get_cart_cell_count()#
Returns:

The number of Cartesian cells owned by this MPI rank.

inline virtual std::shared_ptr<MeshHierarchy> get_mesh_hierarchy()#

Get the MeshHierarchy instance placed over the mesh.

Returns:

MeshHierarchy placed over the mesh.

inline void mesh_tuple_to_mh_tuple(const INT *index_mesh, INT *index_mh)#

Convert a mesh index (index_x, index_y, …) for this cartesian mesh to the format for a MeshHierarchy: (coarse_x, coarse_y,.., fine_x, fine_y,…).

Parameters:
  • index_mesh – Input tuple index on mesh.

  • index_mh – Output tuple index on MeshHierarchy.

inline virtual void free()#

Free the mesh and any associated communicators.

inline virtual std::vector<int> &get_local_communication_neighbours()#

Get a std::vector of MPI ranks which should be used to setup local communication patterns.

Returns:

std::vector of MPI ranks.

inline virtual void get_point_in_subdomain(double *point)#

Get a point in the domain that should be in, or at least close to, the sub-domain on this MPI process. Useful for parallel initialisation.

Parameters:

point – Pointer to array of size equal to at least the number of mesh dimensions.

inline std::vector<std::array<int, 3>> get_owned_cells()#

Get a vector of the cells owned by this MPI rank.

Returns:

vector of owned cells in order of the cell ids of the cells.

Public Members

int cell_starts[3] = {0, 0, 0}#

Holds the first cell this rank owns in each dimension.

int cell_ends[3] = {1, 1, 1}#

Holds the last cell+1 this ranks owns in each dimension.

std::vector<int> cell_counts = {0, 0, 0}#

Global number of cells in each dimension.

int cell_counts_local[3] = {0, 0, 0}#

Local number of cells in each dimension.

double global_extents[3] = {0.0, 0.0, 0.0}#

Global extents of the mesh.

int stencil_width#

Width of the stencil used to determine which MPI ranks are neighbours.

const int ndim#

Number of dimensions of the mesh.

std::vector<int> &dims#

Vector holding the number of coarse cells in each dimension.

const int subdivision_order#

Subdivision order to determine number of fine cells per coarse cell.

const double cell_width_coarse#

Width of coarse cells, uniform in all dimensions.

const double cell_width_fine#

Width of fine cells, uniform in all dimensions.

const double inverse_cell_width_coarse#

Inverse of the coarse cell width.

const double inverse_cell_width_fine#

Inverse of the fine cell width.

const int ncells_coarse#

Global number of coarse cells.

const int ncells_fine#

Number of coarse cells per fine cell.

bool single_cell_mode#

Is this mesh running in a mode where it exposes one NP cell per MPI rank.

Private Members

int cell_count#
MPI_Comm comm#
MPI_Comm comm_cart#
int periods[3] = {1, 1, 1}#
int coords[3] = {0, 0, 0}#
int mpi_dims[3] = {0, 0, 0}#
std::shared_ptr<MeshHierarchy> mesh_hierarchy#
bool allocated = false#
std::vector<int> neighbour_ranks#
class CartesianHMeshLocalMapperT : public NESO::Particles::LocalMapper#
#include <cartesian_mesh.hpp>

LocalMapper for CartesianHMesh. Maps particle positions within the stencil width of each MPI subdomain to the owning rank.

Public Functions

CartesianHMeshLocalMapperT(const CartesianHMeshLocalMapperT &st) = delete#

Disable (implicit) copies.

CartesianHMeshLocalMapperT &operator=(CartesianHMeshLocalMapperT const &a) = delete#

Disable (implicit) copies.

inline CartesianHMeshLocalMapperT(SYCLTargetSharedPtr sycl_target, CartesianHMeshSharedPtr mesh)#

Construct a new mapper instance to map local particle positions to owing ranks.

Parameters:
  • sycl_target – SYCLTargetSharedPtr to use as compute device.

  • meshCartesianHMesh instance this mapping is based on.

inline virtual void map(ParticleGroup &particle_group, const int map_cell = -1)#

Map positions to owning MPI ranks. Positions should be within the domain prior to calling map, i.e. particles should be within the domain extents.

Parameters:

particle_groupParticleGroup to use.

inline virtual void particle_group_callback(ParticleGroup &particle_group)#

No-op implementation of callback.

Parameters:

particle_groupParticleGroup.

Public Members

CartesianHMeshSharedPtr mesh#

CartesianHMesh on which the lookup is based.

Protected Attributes

SYCLTargetSharedPtr sycl_target#
int ndim#
REAL cell_width_fine#
REAL inverse_cell_width_fine#
std::unique_ptr<BufferDeviceHost<int>> dh_cell_lookups[3]#
std::unique_ptr<BufferDeviceHost<int*>> dh_cell_lookup#
std::unique_ptr<BufferDeviceHost<int>> dh_rank_map#
std::unique_ptr<BufferDeviceHost<int>> dh_dims#
std::unique_ptr<BufferDeviceHost<int>> dh_cell_counts#
class CartesianPeriodic#

Periodic boundary conditions implementation designed to work with a CartesianHMesh.

Public Functions

CartesianPeriodic(const CartesianPeriodic &st) = delete#

Disable (implicit) copies.

CartesianPeriodic &operator=(CartesianPeriodic const &a) = delete#

Disable (implicit) copies.

inline ~CartesianPeriodic()#
inline CartesianPeriodic(SYCLTargetSharedPtr sycl_target, std::shared_ptr<CartesianHMesh> mesh, ParticleDatSharedPtr<REAL> position_dat)#

Construct instance to apply periodic boundary conditions to particles within the passed ParticleDat.

Parameters:
  • sycl_targetSYCLTarget to use as compute device.

  • mesh – CartedianHMesh instance to use a domain for the particles.

  • position_dat – ParticleDat containing particle positions.

inline CartesianPeriodic(std::shared_ptr<CartesianHMesh> mesh, ParticleGroupSharedPtr particle_group)#

Construct instance to apply periodic boundary conditions to particles within the passed ParticleDat.

Parameters:
  • mesh – CartedianHMesh instance to use a domain for the particles.

  • particle_groupParticleGroup to apply periodic boundary conditions to.

inline void execute()#

Apply periodic boundary conditions to the particle positions in the ParticleDat this instance was created with.

Private Members

BufferDevice<REAL> d_extents#
SYCLTargetSharedPtr sycl_target#
std::shared_ptr<CartesianHMesh> mesh#
ParticleDatSharedPtr<REAL> position_dat#
ParticleLoopSharedPtr pbc_loop#
template<typename T>
class CellDat#
#include <cell_dat.hpp>

Store data on each cell where the number of columns required per cell is constant but the number of rows is variable. Data is stored in a column major manner with a new device pointer per column.

Public Functions

CellDat(const CellDat &st) = delete#

Disable (implicit) copies.

CellDat &operator=(CellDat const &a) = delete#

Disable (implicit) copies.

inline ~CellDat()#
inline CellDat(SYCLTargetSharedPtr sycl_target, const int ncells, const int ncol)#

Create new CellDat on a specified compute target with a specified number of cells and number of columns per cell.

Parameters:
  • sycl_target – SYCLTargetSharedPtr to use as compute device.

  • ncells – Number of cells (fixed).

  • ncol – Number of columns in each cell (fixed).

template<typename U>
inline void reduce_nrow(const U *h_nrow_required)#

Pass a number of nrows for each cell where the user promises the new number of rows are equal to or less than the current number of rows.

inline void set_nrow(const INT cell, const INT nrow_required)#

Set the number of rows required in a provided cell. This will realloc if needed and copy the existing data into the new space. May not shrink the array if the requested size is smaller than the existing size. wait_set_nrow should be called before using the dat.

inline void wait_set_nrow()#

Wait for set_nrow to complete

inline int compute_nrow_max()#

Recompute nrow_max from current row counts.

Returns:

The maximum number of rows across all cells.

inline int get_nrow_max()#

Get the maximum number of rows across all cells.

Returns:

The maximum number of rows across all cells.

inline int get_nrow_min()#

Get the minimum number of rows across all cells.

Returns:

The minimum number of rows across all cells.

inline CellData<T> get_cell(const int cell)#

Get the contents of a provided cell on the host as a CellData instance.

Parameters:

cell – Cell to get data from.

Returns:

Cell contents of specified cell as CellData instance.

inline T get_value(const int cell, const int row, const int col)#

Get a value from a cell, row and column.

Parameters:
  • cell – Cell index.

  • row – Row index.

  • col – Column index.

Returns:

Value at location.

inline void set_value(const int cell, const int row, const int col, const T value)#

Set a value directly using cell, row, column and value.

Parameters:
  • cell – Cell index.

  • row – Row index.

  • col – Column index.

  • value – Value to set at location.

inline void get_cell_async(const int cell, CellDataT<T> &cell_data, EventStack &event_stack)#

Get the contents of a provided cell on the host as a CellData instance.

Parameters:
  • cell – Cell to get data from.

  • cell_dataCellDataT instance to populate, must be sufficiently sized.

  • event_stackEventStack instance to call wait on for copy.

inline void set_cell(const int cell, CellData<T> cell_data)#

Set the contents of a cell on the device using a CellData instance.

Parameters:
  • cell – Cell index to set data in.

  • cell_data – New cell data to set.

inline void set_cell_async(const int cell, CellDataT<T> &cell_data, EventStack &event_stack)#

Set the contents of a cell on the device using a CellData instance.

Parameters:
  • cell – Cell index to set data in.

  • cell_data – New cell data to set.

  • event_stackEventStack instance to wait on.

inline T ***device_ptr()#

Get the root device pointer for the data storage. Data can be accessed on the device in SYCL kernels with access like: d[cell_index][column_index][row_index]

Returns:

Device pointer that can be used to access the underlying data.

inline void print(int start = -1, int end = -1)#

Helper function to print the contents of all cells or a specified range of cells.

Parameters:
  • start – (optional) First cell to print.

  • end – (option) Last cell minus one to print.

inline size_t row_size()#

Number of bytes to store a row of this CellDat

Returns:

Number of bytes required to store a row.

Public Members

SYCLTargetSharedPtr sycl_target#

Compute device used by the instance.

const int ncells#

Number of cells.

std::vector<INT> nrow#

Number of rows in each cell.

const int ncol#

Number of columns, uniform across all cells.

std::vector<INT> nrow_alloc#

Number of rows currently allocated for each cell.

Protected Functions

inline void add_write_callback(std::function<void(const int)> fn)#
inline void set_nrow_inner(const INT cell, const INT nrow_required)#
inline T ***impl_get()#

Non-const pointer to underlying device data. Intended for friend access from ParticleLoop.

inline T *const *const *impl_get_const()#

Const pointer to underlying device data. Intended for friend access from ParticleLoop.

inline T *col_device_ptr(const int cell, const int col)#

Get the device pointer for a column in a cell.

Parameters:
  • cell – Cell index to get pointer for.

  • col – Column in cell to get pointer for.

Returns:

Device pointer to data for the specified column.

Protected Attributes

std::function<void(const int)> write_callback#

Private Members

T ***d_ptr#
std::vector<T**> h_ptr_cells#
std::vector<T*> h_ptr_cols#
int nrow_max = -1#
int nrow_min = -1#
EventStack stack_events#
std::stack<T*> stack_ptrs#

Friends

friend class ParticleLoop
friend class ParticleDatT
friend class ParticlePacker
friend T ***create_loop_arg(ParticleLoopImplementation::ParticleLoopGlobalInfo *global_info, sycl::handler &cgh, Access::Add<CellDat<T>*> &a)#
friend T ***create_loop_arg(ParticleLoopImplementation::ParticleLoopGlobalInfo *global_info, sycl::handler &cgh, Access::Write<CellDat<T>*> &a)#
friend T *const *const *create_loop_arg(ParticleLoopImplementation::ParticleLoopGlobalInfo *global_info, sycl::handler &cgh, Access::Read<CellDat<T>*> &a)#
template<typename T>
class CellDataT#
#include <cell_data.hpp>

Container for the data within a single cell stored on the host. Data is store column wise. The data is typically particle data for a single ParticleDat for a single cell and exists as a 2D data structure.

Public Functions

CellDataT(const CellDataT &st) = delete#

Disable (implicit) copies.

CellDataT &operator=(CellDataT const &a) = delete#

Disable (implicit) copies.

inline CellDataT(SYCLTargetSharedPtr sycl_target, const int nrow, const int ncol)#

Create a new, empty and uninitialised container for 2D data of the specified shape.

Parameters:
  • sycl_target – SYCLTargetSharedPtr to use as compute device.

  • nrow – Number of rows.

  • ncol – Number of columns.

inline std::vector<T> &operator[](int col)#

Subscript operator for cell data. Data should be indexed by column then row. e.g. CellData cell_data; T value = *cell_data[col][row];

inline T &at(const int row, const int col)#

Access data with more standard (row, column) indexing.

Parameters:
  • row – Row to access.

  • col – Column to access.

Returns:

reference to accessed element.

inline void print()#

Print the contents of the CellDataT instance.

Public Members

const int nrow#

Number of rows in the 2D data structure.

const int ncol#

Number of columns in the 2D data structure.

std::vector<std::vector<T>> data#

2D data.

Private Functions

inline std::string format(INT value)#
inline std::string format(REAL value)#
inline std::string format(char value)#

Private Members

SYCLTargetSharedPtr sycl_target#
template<typename T>
class CellDatConst#
#include <cell_dat_const.hpp>

Container that allocates on the device a matrix of fixed size nrow X ncol for N cells. Data stored in column major format. i.e. Data order from slowest to fastest is: cell, column, row.

Public Functions

CellDatConst(const CellDatConst &st) = delete#

Disable (implicit) copies.

CellDatConst &operator=(CellDatConst const &a) = delete#

Disable (implicit) copies.

inline ~CellDatConst()#
inline void fill(const T value)#

Fill all the entries with a given value.

Parameters:

value – Value to place in all entries.

inline CellDatConst(SYCLTargetSharedPtr sycl_target, const int ncells, const int nrow, const int ncol)#

Create new CellDatConst on the specified compute target with a fixed cell count, fixed number of rows per cell and fixed number of columns per cell.

Parameters:
  • sycl_target – SYCLTargetSharedPtr to use as compute device.

  • ncells – Number of cells.

  • nrow – Number of rows.

  • ncol – Number of columns.

inline int idx(const int cell, const int row, const int col)#

Helper function to index into the stored data. Note column major format.

Parameters:
  • cell – Cell index to index into.

  • row – Row to access.

  • col – Column to access.

Returns:

Linear index into data structure for the specified row and column.

inline T *device_ptr()#

Get the device pointer for the underlying data. Only accessible on the device.

Returns:

Returns a device pointer on the compute target.

inline CellData<T> get_cell(const int cell)#

Get the data stored in a provided cell on the host as a CellData instance.

Parameters:

cell – Cell to access the underlying data for.

Returns:

Cell data for cell.

inline void set_cell(const int cell, CellData<T> cell_data)#

Set the data in a cell using a CellData instance.

Parameters:
  • cell – Cell to set data for.

  • cell_data – Source data.

inline T get_value(const int cell, const int row, const int col)#

Get a value from a cell, row and column.

Parameters:
  • cell – Cell index.

  • row – Row index.

  • col – Column index.

Returns:

Value at location.

inline void set_value(const int cell, const int row, const int col, const T value)#

Set a value directly using cell, row, column and value.

Parameters:
  • cell – Cell index.

  • row – Row index.

  • col – Column index.

  • value – Value to set at location.

Public Members

SYCLTargetSharedPtr sycl_target#

Compute device used by the instance.

const int ncells#

Number of cells, labeled 0,…,N-1.

const int nrow#

Number of rows in each cell.

const int ncol#

Number of columns in each cell.

Protected Functions

inline CellDatConstDeviceType<T> impl_get()#

Non-const pointer to underlying device data. Intended for friend access from ParticleLoop.

inline CellDatConstDeviceTypeConst<T> impl_get_const()#

Const pointer to underlying device data. Intended for friend access from ParticleLoop.

Private Members

T *d_ptr#
const int stride#

Friends

friend class ParticleLoop
friend CellDatConstDeviceTypeConst<T> create_loop_arg(ParticleLoopImplementation::ParticleLoopGlobalInfo *global_info, sycl::handler &cgh, Access::Read<CellDatConst<T>*> &a)#
friend CellDatConstDeviceType<T> create_loop_arg(ParticleLoopImplementation::ParticleLoopGlobalInfo *global_info, sycl::handler &cgh, Access::Add<CellDatConst<T>*> &a)#
friend CellDatConstDeviceType<T> create_loop_arg(ParticleLoopImplementation::ParticleLoopGlobalInfo *global_info, sycl::handler &cgh, Access::Min<CellDatConst<T>*> &a)#
friend CellDatConstDeviceType<T> create_loop_arg(ParticleLoopImplementation::ParticleLoopGlobalInfo *global_info, sycl::handler &cgh, Access::Max<CellDatConst<T>*> &a)#
template<typename T>
struct CellDatConstDeviceType#
#include <cell_dat_const.hpp>

Type the implementation methods return;

Public Members

T *ptr#
int stride#
int nrow#
template<typename T>
struct CellDatConstDeviceTypeConst#
#include <cell_dat_const.hpp>

Public Members

T const *ptr#
int stride#
int nrow#
class CellMove#
#include <cell_dat_move.hpp>

CellMove is the implementation that moves particles between cells. When a particle moves to a new cell the corresponding data is moved to the new cell in all the ParticleDat instances.

Public Functions

CellMove(const CellMove &st) = delete#

Disable (implicit) copies.

CellMove &operator=(CellMove const &a) = delete#

Disable (implicit) copies.

inline ~CellMove()#
inline CellMove(SYCLTargetSharedPtr sycl_target, const int ncell, LayerCompressor &layer_compressor, std::map<Sym<REAL>, ParticleDatSharedPtr<REAL>> &particle_dats_real, std::map<Sym<INT>, ParticleDatSharedPtr<INT>> &particle_dats_int)#

Create a cell move instance to move particles between cells.

Parameters:
  • sycl_target – SYCLTargetSharedPtr to use as compute device.

  • ncell – Total number of cells.

  • layer_compressorLayerCompressor to use to compress ParticleDat instances.

  • particle_dats_real – Container of REAL ParticleDat.

  • particle_dats_int – Container of INT ParticleDat.

inline void set_cell_id_dat(ParticleDatSharedPtr<INT> cell_id_dat)#

Set the ParticleDat to use as a source for cell ids.

Parameters:

cell_id_dat – ParticleDat to use for cell ids.

inline void move()#

Move particles between cells (on this MPI rank) using the cell ids on the particles.

Public Members

SYCLTargetSharedPtr sycl_target#

Compute device used by the instance.

Private Functions

inline void get_particle_dat_info()#

Private Members

const int ncell#
ParticleDatSharedPtr<INT> cell_id_dat#
std::map<Sym<REAL>, ParticleDatSharedPtr<REAL>> &particle_dats_real#
std::map<Sym<INT>, ParticleDatSharedPtr<INT>> &particle_dats_int#
BufferHost<int> h_npart_cell#
BufferDevice<int> d_npart_cell#
BufferDevice<int> d_cells_old#
BufferDevice<int> d_cells_new#
BufferDevice<int> d_layers_old#
BufferDevice<int> d_layers_new#
BufferHost<int> h_move_count#
BufferDevice<int> d_move_count#
int num_dats_real = 0#
int num_dats_int = 0#
BufferHost<REAL***> h_particle_dat_ptr_real#
BufferHost<INT***> h_particle_dat_ptr_int#
BufferHost<int> h_particle_dat_ncomp_real#
BufferHost<int> h_particle_dat_ncomp_int#
BufferDevice<REAL***> d_particle_dat_ptr_real#
BufferDevice<INT***> d_particle_dat_ptr_int#
BufferDevice<int> d_particle_dat_ncomp_real#
BufferDevice<int> d_particle_dat_ncomp_int#
LayerCompressor &layer_compressor#
ErrorPropagate ep_bad_cell_indices#
template<template<typename...> class T, typename U>
class ColumnMajorColumnAccessor#
#include <access.hpp>

One of a pair of classes that enable indexing like foo[row][col] for an object foo which stores data in a column major format.

Public Functions

inline ColumnMajorColumnAccessor(T<U> &base, const int &stride, const int &rowx)#

Create new instance to underlying data structure of type T<U> which stores 2D data in a column major format using a given stride.

Parameters:
  • base – Object to index into.

  • stride – Number of rows in the 2D object.

  • rowx – Row to access.

inline U &operator[](const int &colx)#

Access element at column, row is provided in the constructor.

Parameters:

colx – Column to access.

Private Members

T<U> &base#
const int &stride#
const int &rowx#
template<template<typename...> class T, typename U>
class ColumnMajorRowAccessor#
#include <access.hpp>

One of a pair of classes that enable indexing like foo[row][col] for an object foo which stores data in a column major format.

Public Functions

inline ColumnMajorRowAccessor(T<U> &base, const int &stride)#

Create new instance to underlying data structure of type T<U> which stores 2D data in a column major format using a given stride.

Parameters:
  • base – Object to index into.

  • stride – Number of rows in the 2D object.

inline ColumnMajorColumnAccessor<T, U> operator[](const int &rowx)#

Returns a ColumnMajorColumnAccessor instance which defines a subscript operator that can be used to access any column of the specified row.

Parameters:

rowx – Row to provide access to.

Private Members

T<U> &base#
const int &stride#
class CommPair#
#include <communication.hpp>

Wrapper around a pair of inter and intra MPI Comms for shared memory purposes.

Public Functions

CommPair(const CommPair &st) = delete#

Disable (implicit) copies.

CommPair &operator=(CommPair const &a) = delete#

Disable (implicit) copies.

inline ~CommPair()#
inline CommPair()#
inline CommPair(MPI_Comm comm_parent)#

Create a new set of inter and intra shared memory region communicators from a parent communicator. Must be called collectively on the parent communicator.

Parameters:

comm_parent – MPI communicator to derive intra and inter communicators from.

inline void free()#

Free the communicators held by the CommPair instance.

Public Members

MPI_Comm comm_parent#

Parent (i.e. global for the simulation) MPI communicator.

MPI_Comm comm_inter#

Communicator between one rank on each shared memory region.

MPI_Comm comm_intra#

Communicator between the ranks in a shared memory region.

int rank_parent#

MPI rank in the parent communicator.

int rank_inter#

MPI rank in the inter shared memory region communicator.

int rank_intra#

MPI rank within the shared memory region communicator.

int size_parent#

Size of the parent communicator.

int size_inter#

Size of the inter shared memory communicator.

int size_intra#

Size of the intra shared memory communicator.

Private Members

bool allocated = false#
class DepartingIdentify#

Class to identify which particles are leaving and MPI rank based on which MPI rank is stored in the NESO_MPI_RANK ParticleDat

Public Functions

DepartingIdentify(const DepartingIdentify &st) = delete#

Disable (implicit) copies.

DepartingIdentify &operator=(DepartingIdentify const &a) = delete#

Disable (implicit) copies.

inline ~DepartingIdentify()#
inline DepartingIdentify(SYCLTargetSharedPtr sycl_target)#

Create a new instance of this class.

Parameters:

sycl_target – SYCLTargetSharedPtr to use as compute device.

inline void set_mpi_rank_dat(ParticleDatSharedPtr<INT> mpi_rank_dat)#

Set the ParticleDat that contains particle MPI ranks.

Parameters:

mpi_rank_dat – ParticleDat containing MPI ranks.

inline void identify(const int rank_component = 0)#

Identify particles which should be packed and sent to remote MPI ranks. The argument indicates which component of the MPI ranks dat that should be inspected for MPI rank. The intention is that component 0 indicates remote MPI ranks where the particle should be sent through a global communication pattern. Component 1 indicates a remote rank where the particle should be sent through a neighbour based “local” communication pattern. Negative MPI ranks are ignored.

Parameters:

rank_component – Component to inspect for MPI rank.

Public Members

BufferDeviceHost<int> dh_send_ranks#

Array of unique MPI ranks that particles should be sent to.

BufferDeviceHost<int> dh_send_counts_all_ranks#

Array of length equal to the communicator size indicating how many particles should be sent to each rank.

BufferDeviceHost<int> dh_send_rank_map#

Map from MPI ranks to an index that orders the send ranks.

BufferDevice<int> d_pack_cells#

Array that contains the source cells of departing particles.

BufferDevice<int> d_pack_layers_src#

Array that contains the source layers (rows) of departing particles.

BufferDevice<int> d_pack_layers_dst#

Array that contains the destination layers in the packing buffer of departing particles.

BufferDeviceHost<int> dh_num_ranks_send#

Size one array to accumulate the number of remote ranks particles should be sent to.

BufferDeviceHost<int> dh_num_particle_send#

Size one array to accumulate the total number of leaving particles.

ParticleDatSharedPtr<INT> mpi_rank_dat#

ParticleDat containing MPI ranks.

Private Members

SYCLTargetSharedPtr sycl_target#
class DescendantProducts : public NESO::Particles::ProductMatrix#

Class to create M products from each parent particle. Products may inherit property values from the parent.

Public Functions

DescendantProducts() = default#
DescendantProducts &operator=(const DescendantProducts&) = default#
inline DescendantProducts(SYCLTargetSharedPtr sycl_target, std::shared_ptr<ProductMatrixSpec> spec, const int num_products_per_parent)#

Create an instance from a ProductMatrixSpec that defines which particle properties should be available for writing in the particle loop kernel.

Parameters:
  • sycl_target – Compute device on which products will be made.

  • spec – Specification of properties which require specialisation in the creating kernel.

  • num_products_per_parent – The maximum number of products required per parent particle.

inline virtual void reset(const int num_particles) override#

Resize the container to hold space for the products of a number of parent particles.

Parameters:

num_particles – Number of parent particles space is required for.

Public Members

int num_products_per_parent#

The number of products this data structure is expecting per parent particle.

int num_particles#

The current number of parent particles the container is allocated for.

Protected Functions

inline DescendantProductsGet impl_get()#

Protected Attributes

std::shared_ptr<BufferDevice<INT>> d_parent_cells#
std::shared_ptr<BufferDevice<INT>> d_parent_layers#

Friends

friend class ParticleGroup
inline friend DescendantProductsGet create_loop_arg(ParticleLoopImplementation::ParticleLoopGlobalInfo *global_info, sycl::handler &cgh, Access::Write<DescendantProducts*> &a)#
struct DescendantProductsGet#

Public Members

ProductMatrixGet product_matrix_get#
int num_particles#
INT *d_parent_cells#
INT *d_parent_layers#
class Domain#
#include <domain.hpp>

A domain wraps a mesh with useful methods such as how to bin particles into local cells on that mesh type.

Public Functions

Domain(const Domain &st) = delete#

Disable (implicit) copies.

Domain &operator=(Domain const &a) = delete#

Disable (implicit) copies.

inline Domain(HMeshSharedPtr mesh, LocalMapperSharedPtr local_mapper = DummyLocalMapper())#

Construct a new Domain.

Parameters:
  • meshHMesh derived mesh object.

  • local_mapper – Object to map particle positions into mesh cells.

inline ~Domain()#

Public Members

HMeshSharedPtr mesh#

HMesh derived mesh instance.

LocalMapperSharedPtr local_mapper#

LocalMapper derived class instance to bin particles into mesh cells.

class DummyLocalMapperT : public NESO::Particles::LocalMapper#
#include <local_mapping.hpp>

Dummy LocalMapper implementation that does nothing to use as a default.

Public Functions

DummyLocalMapperT(const DummyLocalMapperT &st) = delete#

Disable (implicit) copies.

DummyLocalMapperT &operator=(DummyLocalMapperT const &a) = delete#

Disable (implicit) copies.

inline ~DummyLocalMapperT()#
inline DummyLocalMapperT()#

No-op Constructor.

inline virtual void map(ParticleGroup &particle_group, const int map_cell = -1)#

No-op implementation of map.

inline virtual void particle_group_callback(ParticleGroup &particle_group)#

No-op implementation of callback.

class ErrorPropagate#

Helper class to propagate errors thrown from inside a SYCL kernel

Public Functions

ErrorPropagate(const ErrorPropagate &st) = delete#

Disable (implicit) copies.

ErrorPropagate &operator=(ErrorPropagate const &a) = delete#

Disable (implicit) copies.

inline ~ErrorPropagate()#
inline ErrorPropagate(SYCLTargetSharedPtr sycl_target)#

Create a new instance to track assertions thrown in SYCL kernels.

Parameters:

sycl_target – SYCLTargetSharedPtr used for the kernel.

inline void reset()#

Reset the internal state. Useful if the instance is used to indicate events occurred in a parallel loop that are non fatal.

inline int *device_ptr()#

Get the int device pointer for use in a SYCL kernel. This pointer should be incremented atomically with some positive integer to indicate an error occured in the kernel.

inline void check_and_throw(const char *error_msg)#

Check the stored integer. If the integer is non-zero throw an error with the passed message.

Parameters:

error_msg – Message to throw if stored integer is non-zero.

inline int get_flag()#

Get the current value of the flag on the host.

Returns:

flag.

Private Members

SYCLTargetSharedPtr sycl_target#
BufferDeviceHost<int> dh_flag#
class EventStack#
#include <compute_target.hpp>

Helper class to hold a collection of sycl::event instances which can be waited on.

Public Functions

inline ~EventStack()#
inline EventStack()#

Create a new and empty stack of events.

inline void push(sycl::event e)#

Push a sycl::event onto the event stack.

inline void wait()#

Wait for all events held in the stack to complete before returning.

Private Members

std::stack<sycl::event> stack#
template<size_t N, size_t... S>
struct GenerateIntSequence#
#include <tuple.hpp>

Public Types

using type = typename GenerateIntSequence<N - 1, N - 1, S...>::type#
template<size_t... S>
struct GenerateIntSequence<0, S...>#
#include <tuple.hpp>

Public Types

using type = IntSequence<S...>#
template<size_t INDEX, typename T, typename ...U>
struct GetIndexType#
#include <tuple.hpp>

Public Types

using type = typename GetIndexType<INDEX - 1, U...>::type#
template<typename T, typename ...U>
struct GetIndexType<0, T, U...>#
#include <tuple.hpp>

Public Types

using type = T#
template<typename T>
class GlobalArray#
#include <global_array.hpp>

GlobalArray is an array type which can be accessed from kernels in read or atomic add mode. Post loop execution, with add access mode, the global array values are automatically reduced across the MPI communicator.

Public Functions

GlobalArray() = default#
GlobalArray<T> &operator=(const GlobalArray<T>&) = default#

Note that the copy operator creates shallow copies of the array.

inline GlobalArray(SYCLTargetSharedPtr sycl_target, const std::size_t size, const std::optional<T> init_value = std::nullopt)#

Create a new GlobalArray on a compute target and given size.

Parameters:
  • sycl_target – Device to create GlobalArray on.

  • size – Number of elements in array.

  • Default – value to initialise values to.

inline void fill(const T value)#

Fill the array with a value.

Parameters:

value – Value to fill the array with - not reduced across MPI ranks.

inline sycl::event get_async(std::vector<T> &data)#

Asynchronously get the values in the local array into a std::vector.

Parameters:

data[inout] Input vector to copy values from GlobalArray into.

Returns:

Event to wait on before using new values in the std::vector.

inline void get(std::vector<T> &data)#

Get the values in the local array into a std::vector. Blocks until copy is complete.

Parameters:

data[inout] Input vector to copy values from GlobalArray into.

inline std::vector<T> get()#

Get the values in the local array into a std::vector.

Returns:

std::vector of values in the GlobalArray.

Public Members

SYCLTargetSharedPtr sycl_target#

The SYCLTarget the GlobalArray is created on.

MPI_Comm comm#

The MPI communicator reductions are made over.

std::size_t size = {0}#

The number of elements in the array.

Protected Functions

inline GlobalArrayImplGetT<T> impl_get()#

Non-const pointer to underlying device data. Intended for friend access from ParticleLoop.

inline GlobalArrayImplGetConstT<T> impl_get_const()#

Const pointer to underlying device data. Intended for friend access from ParticleLoop.

inline void impl_post_loop_add()#

Post kernel execution reduction.

Protected Attributes

std::shared_ptr<BufferDeviceHost<T>> buffer#

Friends

friend class ParticleLoop
friend void post_loop(ParticleLoopImplementation::ParticleLoopGlobalInfo *global_info, Access::Add<GlobalArray<T>*> &arg)#
friend GlobalArrayImplGetConstT<T> create_loop_arg(ParticleLoopImplementation::ParticleLoopGlobalInfo *global_info, sycl::handler &cgh, Access::Read<GlobalArray<T>*> &a)#
friend GlobalArrayImplGetT<T> create_loop_arg(ParticleLoopImplementation::ParticleLoopGlobalInfo *global_info, sycl::handler &cgh, Access::Add<GlobalArray<T>*> &a)#
class GlobalMove#
#include <global_move.hpp>

Class to move particles on the global mesh.

Public Functions

GlobalMove(const GlobalMove &st) = delete#

Disable (implicit) copies.

GlobalMove &operator=(GlobalMove const &a) = delete#

Disable (implicit) copies.

inline void free()#
inline ~GlobalMove()#
inline GlobalMove(SYCLTargetSharedPtr sycl_target, LayerCompressor &layer_compressor, std::map<Sym<REAL>, ParticleDatSharedPtr<REAL>> &particle_dats_real, std::map<Sym<INT>, ParticleDatSharedPtr<INT>> &particle_dats_int)#

Construct a new global move instance to move particles between the cells of a MeshHierarchy.

Parameters:
  • sycl_target – SYCLTargetSharedPtr to use as compute device.

  • layer_compressorLayerCompressor to use to compress ParticleDat rows

  • particle_dats_real – Container of the REAL valued ParticleDats.

  • particle_dats_int – Container of the INT valued ParticleDats.

inline void set_mpi_rank_dat(ParticleDatSharedPtr<INT> mpi_rank_dat)#

Set the ParticleDat to use for MPI ranks.

Parameters:

mpi_rank_dat – ParticleDat to use for particle positions.

inline void move()#

Use the MPI ranks stored in the first component of the MPI rank dat to move particles between the MPI ranks that own cells in a MeshHierarchy. Particles are unpacked into cell 0 of the receiving MPI rank.

Public Members

SYCLTargetSharedPtr sycl_target#

Compute device used by the instance.

Private Members

std::map<Sym<REAL>, ParticleDatSharedPtr<REAL>> &particle_dats_real#
std::map<Sym<INT>, ParticleDatSharedPtr<INT>> &particle_dats_int#
ParticleDatSharedPtr<INT> mpi_rank_dat#
ParticlePacker particle_packer#
ParticleUnpacker particle_unpacker#
GlobalMoveExchange global_move_exchange#
DepartingIdentify departing_identify#
LayerCompressor &layer_compressor#
BufferDeviceHost<int> dh_send_rank_npart#
class GlobalMoveExchange#

This class handles the efficient and asynchronous exchange of particle counts and data between MPI ranks when moving particles between cells of the MeshHierarchy.

Public Functions

GlobalMoveExchange(const GlobalMoveExchange &st) = delete#

Disable (implicit) copies.

GlobalMoveExchange &operator=(GlobalMoveExchange const &a) = delete#

Disable (implicit) copies.

inline void free()#

Explicitly free a ParticleGroup without relying on out-of-scope.

inline ~GlobalMoveExchange()#
inline GlobalMoveExchange(SYCLTargetSharedPtr sycl_target)#

Construct a new instance to exchange particle counts and data.

Parameters:

sycl_target – SYCLTargetSharedPtr to use as compute device.

inline void npart_exchange_init()#

Initialise the start of a new epoch where global communication is identified. Collective on the communicator.

inline void npart_exchange_sendrecv(const int num_remote_send_ranks, BufferDeviceHost<int> &dh_send_ranks, BufferHost<int> &h_send_rank_npart)#

Communicate how many ranks will send particles to each rank. Collective on the communicator.

Parameters:
  • num_remote_send_ranks – Number of remote ranks particles will be sent to.

  • dh_send_ranks – Array of remote ranks particles will be sent to.

  • h_send_rank_npart – Array of particle counts that will be sent to each rank.

inline void npart_exchange_finalise()#

Finalise the communication which indicates to remote ranks the number of ranks that will send them particles.

inline void exchange_init(ParticlePacker &particle_packer, ParticleUnpacker &particle_unpacker)#

Start the exchange the particle data. Collective on the communicator.

Parameters:
inline void exchange_finalise(ParticleUnpacker &particle_unpacker)#

Finalise the exchange the particle data. Collective on the communicator.

Parameters:

particle_unpackerParticleUnpacker instance to use to unpack particle data.

Public Members

int num_remote_send_ranks#

Number of remote ranks to send particles to.

int num_remote_recv_ranks#

Number of remote ranks to recv particles from.

BufferHost<int> h_send_ranks#

Host array of MPI ranks to send particles to.

BufferHost<int> h_recv_ranks#

Host array of MPI ranks to recv particles from.

BufferHost<int> h_send_rank_npart#

Host array of particle counts for each send rank.

BufferHost<int> h_recv_rank_npart#

Host array of particle counts for each recv rank.

SYCLTargetSharedPtr sycl_target#

Compute device used by the instance.

Private Members

MPI_Comm comm#
MPI_Win recv_win#
int *recv_win_data#
MPI_Request mpi_request#
BufferHost<MPI_Request> h_send_requests#
BufferHost<MPI_Request> h_recv_requests#
BufferHost<MPI_Status> h_recv_status#
bool recv_win_allocated#
class H5Part#
#include <particle_io.hpp>

Public Functions

H5Part(const H5Part &st) = delete#

Disable (implicit) copies.

H5Part &operator=(H5Part const &a) = delete#

Disable (implicit) copies.

template<typename ...T>
inline H5Part(std::string filename, ParticleGroupSharedPtr particle_group, T... args)#

Construct a H5Part writer for a given set of ParticleDats described by Sym<type>(name) instances. Must be called collectively on the communicator.

Parameters:
  • filename – Output filename, e.g. “foo.h5part”.

  • particle_group – ParticleGroupSharedPtr instance.

  • args – Remaining arguments (variable length) should be sym instances indicating which ParticleDats are to be written.

inline void close()#

Close the H5Part writer. Must be called. Must be called collectively on the communicator.

inline void enable_multi_dim_mode()#

Write ParticleDats as 2D arrays in the HDF5 file.

inline void write(INT step_in = -1)#

Write the current particle data to the HDF5 file as a new time step. Must be called collectively on the communicator.

class HMesh#
#include <mesh_interface.hpp>

Abstract base class for mesh types over which a MeshHierarchy is placed.

Subclassed by NESO::Particles::CartesianHMesh, NESO::Particles::LocalDecompositionHMesh

Public Functions

inline virtual MPI_Comm get_comm() = 0#

Get the MPI communicator of the mesh.

Returns:

MPI communicator.

inline virtual int get_ndim() = 0#

Get the number of dimensions of the mesh.

Returns:

Number of mesh dimensions.

inline virtual std::vector<int> &get_dims() = 0#

Get the Mesh dimensions.

Returns:

Mesh dimensions.

inline virtual int get_subdivision_order() = 0#

Get the subdivision order of the mesh.

Returns:

Subdivision order.

inline virtual int get_cell_count() = 0#

Get the total number of cells in the mesh.

Returns:

Total number of mesh cells.

inline virtual double get_cell_width_coarse() = 0#

Get the mesh width of the coarse cells in the MeshHierarchy.

Returns:

MeshHierarchy coarse cell width.

inline virtual double get_cell_width_fine() = 0#

Get the mesh width of the fine cells in the MeshHierarchy.

Returns:

MeshHierarchy fine cell width.

inline virtual double get_inverse_cell_width_coarse() = 0#

Get the inverse mesh width of the coarse cells in the MeshHierarchy.

Returns:

MeshHierarchy inverse coarse cell width.

inline virtual double get_inverse_cell_width_fine() = 0#

Get the inverse mesh width of the fine cells in the MeshHierarchy.

Returns:

MeshHierarchy inverse fine cell width.

inline virtual int get_ncells_coarse() = 0#

Get the global number of coarse cells.

Returns:

Global number of coarse cells.

inline virtual int get_ncells_fine() = 0#

Get the number of fine cells per coarse cell.

Returns:

Number of fine cells per coarse cell.

inline virtual std::shared_ptr<MeshHierarchy> get_mesh_hierarchy() = 0#

Get the MeshHierarchy instance placed over the mesh.

Returns:

MeshHierarchy placed over the mesh.

inline virtual void free() = 0#

Free the mesh and associated communicators.

inline virtual std::vector<int> &get_local_communication_neighbours() = 0#

Get a std::vector of MPI ranks which should be used to setup local communication patterns.

Returns:

std::vector of MPI ranks.

inline virtual void get_point_in_subdomain(double *point) = 0#

Get a point in the domain that should be in, or at least close to, the sub-domain on this MPI process. Useful for parallel initialisation.

Parameters:

point – Pointer to array of size equal to at least the number of mesh dimensions.

template<size_t...>
struct IntSequence#
#include <tuple.hpp>
template<typename T>
struct KernelParameter#

The KernelParameter types define the types passed to the kernel for each data structure type for each access descriptor.

Public Types

using type = void#
template<typename T>
struct KernelParameter<Access::Add<CellDat<T>>>#
#include <cell_dat.hpp>

Public Types

using type = Access::CellDat::Add<T>#
template<typename T>
struct KernelParameter<Access::Add<CellDatConst<T>>>#
#include <cell_dat_const.hpp>

KernelParameter type for add access to a CellDatConst.

Public Types

using type = Access::CellDatConst::Add<T>#
template<typename T>
struct KernelParameter<Access::Add<GlobalArray<T>>>#
#include <global_array.hpp>

KernelParameter type for add access to a GlobalArray.

Public Types

using type = Access::GlobalArray::Add<T>#
template<typename T>
struct KernelParameter<Access::Add<LocalArray<T>>>#
#include <local_array.hpp>

KernelParameter type for add access to a LocalArray.

Public Types

using type = Access::LocalArray::Add<T>#
template<>
struct KernelParameter<Access::Add<ProductMatrix>>#
#include <product_matrix.hpp>

KernelParameter type for add access to a ProductMatrix.

Public Types

using type = Access::ProductMatrix::Add#
template<typename T>
struct KernelParameter<Access::Max<CellDatConst<T>>>#
#include <cell_dat_const.hpp>

KernelParameter type for max access to a CellDatConst.

Public Types

using type = Access::CellDatConst::Max<T>#
template<typename T>
struct KernelParameter<Access::Min<CellDatConst<T>>>#
#include <cell_dat_const.hpp>

KernelParameter type for min access to a CellDatConst.

Public Types

using type = Access::CellDatConst::Min<T>#
template<typename T>
struct KernelParameter<Access::Read<CellDat<T>>>#
#include <cell_dat.hpp>

Public Types

using type = Access::CellDat::Read<T>#
template<typename T>
struct KernelParameter<Access::Read<CellDatConst<T>>>#
#include <cell_dat_const.hpp>

KernelParameter type for read access to a CellDatConst.

Public Types

using type = Access::CellDatConst::Read<T>#
template<typename T>
struct KernelParameter<Access::Read<GlobalArray<T>>>#
#include <global_array.hpp>

KernelParameter type for read access to a GlobalArray.

Public Types

using type = Access::GlobalArray::Read<T>#
template<typename T>
struct KernelParameter<Access::Read<LocalArray<T>>>#
#include <local_array.hpp>

KernelParameter type for read access to a LocalArray.

Public Types

using type = Access::LocalArray::Read<T>#
template<typename T>
struct KernelParameter<Access::Read<ParticleDatT<T>>>#

KernelParameter type for read-only access to a ParticleDat.

Public Types

using type = Access::ParticleDat::Read<T>#
template<>
struct KernelParameter<Access::Read<ParticleLoopIndex>>#

KernelParameter type for read-only access to a ParticleLoopIndex.

Public Types

using type = Access::LoopIndex::Read#
template<>
struct KernelParameter<Access::Read<ProductMatrix>>#
#include <product_matrix.hpp>

KernelParameter type for read access to a ProductMatrix.

Public Types

using type = Access::ProductMatrix::Read#
template<typename T>
struct KernelParameter<Access::Read<Sym<T>>>#

KernelParameter type for read-only access to a ParticleDat - via Sym.

Public Types

using type = Access::ParticleDat::Read<T>#
template<typename T>
struct KernelParameter<Access::Read<SymVector<T>>>#
#include <sym_vector.hpp>

KernelParameter type for read-only access to a SymVector.

Public Types

using type = Access::SymVector::Read<T>#
template<typename T>
struct KernelParameter<Access::Write<CellDat<T>>>#
#include <cell_dat.hpp>

Public Types

using type = Access::CellDat::Write<T>#
template<>
struct KernelParameter<Access::Write<DescendantProducts>>#

KernelParameter type for write access to a DescendantProducts.

Public Types

using type = Access::DescendantProducts::Write#
template<typename T>
struct KernelParameter<Access::Write<LocalArray<T>>>#
#include <local_array.hpp>

KernelParameter type for write access to a LocalArray.

Public Types

using type = Access::LocalArray::Write<T>#
template<typename T>
struct KernelParameter<Access::Write<ParticleDatT<T>>>#

KernelParameter type for write access to a ParticleDat.

Public Types

using type = Access::ParticleDat::Write<T>#
template<>
struct KernelParameter<Access::Write<ProductMatrix>>#
#include <product_matrix.hpp>

KernelParameter type for write access to a ProductMatrix.

Public Types

using type = Access::ProductMatrix::Write#
template<typename T>
struct KernelParameter<Access::Write<Sym<T>>>#

KernelParameter type for write access to a ParticleDat - via Sym.

Public Types

using type = Access::ParticleDat::Write<T>#
template<typename T>
struct KernelParameter<Access::Write<SymVector<T>>>#
#include <sym_vector.hpp>

KernelParameter type for write access to a SymVector.

Public Types

using type = Access::SymVector::Write<T>#
template<template<typename> typename T, typename U>
struct KernelParameter<T<std::shared_ptr<U>>>#
#include <particle_loop.hpp>

Catch all for args passed as shared ptrs

Public Types

using type = typename KernelParameter<T<U>>::type#
class LayerCompressor#

A LayerCompressor is a tool to remove rows from ParticleDat instances that correspond to particle data where the particle has been removed. Particles are removed when they move between cells and when they are transferred to other MPI ranks. This ensures that particle data is not duplicated and that the particle data is contiguous.

Public Functions

LayerCompressor(const LayerCompressor &st) = delete#

Disable (implicit) copies.

LayerCompressor &operator=(LayerCompressor const &a) = delete#

Disable (implicit) copies.

inline ~LayerCompressor()#
inline LayerCompressor(SYCLTargetSharedPtr sycl_target, const int ncell, std::map<Sym<REAL>, ParticleDatSharedPtr<REAL>> &particle_dats_real, std::map<Sym<INT>, ParticleDatSharedPtr<INT>> &particle_dats_int)#

Construct a new layer compressor to compress all ParticleDat instances that are contained within the passed containers.

Parameters:
  • sycl_target – SYCLTargetSharedPtr to use as compute device.

  • ncell – Number of cells within each ParticleDat.

  • particle_dats_real – Container of ParticleDat instances of REAL type.

  • particle_dats_int – Container of ParticleDat instances of INT type.

inline void set_cell_id_dat(ParticleDatSharedPtr<INT> cell_id_dat)#

Set the ParticleDat which contains the cell ids of the particles. This is not a function which is expected to be called by a user.

Parameters:

cell_id_dat – ParticleDat containing particle cell ids.

template<typename T>
inline void compute_remove_compress_indicies(const int npart, T *usm_cells, T *usm_layers)#

For the specified N particles to remove at the given cells and rows (layers) compute the data migration required to keep the particle data contiguous.

Parameters:
  • npart – Number of particles which are to be removed.

  • usm_cells – Device accessible pointers to an array of length N that holds the cells of the particles that are to be removed.

  • usm_layers – Device accessible pointers to an array of length N that holds the layers of the particles that are to be removed.

template<typename T>
inline void remove_particles(const int npart, T *usm_cells, T *usm_layers)#

Remove particles from the ParticleDat instances.

Parameters:
  • npart – Number of particles to remove.

  • usm_cells – Device accessible pointer to the particle cells.

  • usm_layers – Device accessible pointer to the particle rows (layers).

Private Members

SYCLTargetSharedPtr sycl_target#
const int ncell#
BufferDevice<INT> d_remove_cells#
BufferDevice<INT> d_remove_layers#
BufferDevice<INT> d_compress_cells_old#
BufferDevice<INT> d_compress_cells_new#
BufferDevice<INT> d_compress_layers_old#
BufferDevice<INT> d_compress_layers_new#
BufferDevice<int> d_npart_cell#
BufferHost<int> h_npart_cell#
BufferDevice<int> d_move_counters#
ParticleDatSharedPtr<INT> cell_id_dat#
std::map<Sym<REAL>, ParticleDatSharedPtr<REAL>> &particle_dats_real#
std::map<Sym<INT>, ParticleDatSharedPtr<INT>> &particle_dats_int#
EventStack event_stack#
template<typename T>
class LocalArray#
#include <local_array.hpp>

Container to hold an array of values on each MPI rank.

Public Functions

LocalArray() = default#
LocalArray<T> &operator=(const LocalArray<T>&) = default#

Note that the copy operator creates shallow copies of the array.

inline LocalArray(SYCLTargetSharedPtr sycl_target, const std::size_t size, const std::optional<T> init_value = std::nullopt)#

Create a new LocalArray on a compute target and given size.

Parameters:
  • sycl_target – Device to create LocalArray on.

  • size – Number of elements in array.

  • Default – value to initialise values to.

inline void fill(const T value)#

Fill the array with a value.

Parameters:

value – Value to fill the array with.

inline LocalArray(SYCLTargetSharedPtr sycl_target, const std::vector<T> &data)#

Create a new LocalArray on a compute target and given size.

Parameters:
  • sycl_target – Device to create LocalArray on.

  • data – Vector to initialise array values to.

inline sycl::event set_async(const std::vector<T> &data)#

Asynchronously set the values in the local array to those in a std::vector.

Parameters:

data – Input vector to copy values from.

Returns:

Event to wait on before using new values in LocalArray.

inline void set(const std::vector<T> &data)#

Set the values in the local array to those in a std::vector. Blocks until the copy is complete.

Parameters:

data – Input vector to copy values from.

inline sycl::event get_async(std::vector<T> &data)#

Asynchronously get the values in the local array into a std::vector.

Parameters:

data[inout] Input vector to copy values from LocalArray into.

Returns:

Event to wait on before using new values in the std::vector.

inline void get(std::vector<T> &data)#

Get the values in the local array into a std::vector. Blocks until copy is complete.

Parameters:

data[inout] Input vector to copy values from LocalArray into.

inline std::vector<T> get()#

Get the values in the local array into a std::vector.

Returns:

std::vector of values in the LocalArray.

inline void realloc_no_copy(const size_t size)#

Reallocate the buffer to hold the requested number of elements. Current contents is not copied to the new buffer.

Parameters:

size – Number of elements this buffer should hold.

Public Members

SYCLTargetSharedPtr sycl_target#

The SYCLTarget the LocalArray is created on.

std::size_t size#

The number of elements in the array.

Protected Functions

inline LocalArrayImplGetT<T> impl_get()#

Non-const pointer to underlying device data. Intended for friend access from ParticleLoop.

inline LocalArrayImplGetConstT<T> impl_get_const()#

Const pointer to underlying device data. Intended for friend access from ParticleLoop.

Protected Attributes

std::shared_ptr<BufferDevice<T>> buffer#

Friends

friend class ParticleLoop
friend LocalArrayImplGetConstT<T> create_loop_arg(ParticleLoopImplementation::ParticleLoopGlobalInfo *global_info, sycl::handler &cgh, Access::Read<LocalArray<T>*> &a)#
friend LocalArrayImplGetT<T> create_loop_arg(ParticleLoopImplementation::ParticleLoopGlobalInfo *global_info, sycl::handler &cgh, Access::Write<LocalArray<T>*> &a)#
friend LocalArrayImplGetT<T> create_loop_arg(ParticleLoopImplementation::ParticleLoopGlobalInfo *global_info, sycl::handler &cgh, Access::Add<LocalArray<T>*> &a)#
class LocalDecompositionHMesh : public NESO::Particles::HMesh#

A simple HMesh type that does not attempt to build any global mapping data structures.

Public Functions

inline ~LocalDecompositionHMesh()#
inline LocalDecompositionHMesh(const int ndim, std::vector<double> origin, std::vector<double> extents, const int cell_count, MPI_Comm comm = MPI_COMM_WORLD)#

Create a new instance.

Parameters:
  • ndim – Number of dimensions.

  • origin – Origin to use.

  • extents – Cartesian extents of the domain.

  • cell_count – Number of cells in the mesh.

  • comm – MPI communicator to use.

inline virtual MPI_Comm get_comm()#

Get the MPI communicator of the mesh.

Returns:

MPI communicator.

inline virtual int get_ndim()#

Get the number of dimensions of the mesh.

Returns:

Number of mesh dimensions.

inline virtual std::vector<int> &get_dims()#

Get the Mesh dimensions.

Returns:

Mesh dimensions.

inline virtual int get_subdivision_order()#

Get the subdivision order of the mesh.

Returns:

Subdivision order.

inline virtual int get_cell_count()#

Get the total number of cells in the mesh on this MPI rank, i.e. the number of Nektar++ elements on this MPI rank.

Returns:

Total number of mesh cells on this MPI rank.

inline virtual double get_cell_width_coarse()#

Get the mesh width of the coarse cells in the MeshHierarchy.

Returns:

MeshHierarchy coarse cell width.

inline virtual double get_cell_width_fine()#

Get the mesh width of the fine cells in the MeshHierarchy.

Returns:

MeshHierarchy fine cell width.

inline virtual double get_inverse_cell_width_coarse()#

Get the inverse mesh width of the coarse cells in the MeshHierarchy.

Returns:

MeshHierarchy inverse coarse cell width.

inline virtual double get_inverse_cell_width_fine()#

Get the inverse mesh width of the fine cells in the MeshHierarchy.

Returns:

MeshHierarchy inverse fine cell width.

inline virtual int get_ncells_coarse()#

Get the global number of coarse cells.

Returns:

Global number of coarse cells.

inline virtual int get_ncells_fine()#

Get the number of fine cells per coarse cell.

Returns:

Number of fine cells per coarse cell.

inline virtual std::shared_ptr<MeshHierarchy> get_mesh_hierarchy()#

Get the MeshHierarchy instance placed over the mesh.

Returns:

MeshHierarchy placed over the mesh.

inline virtual void free()#

Free the mesh and associated communicators.

inline virtual std::vector<int> &get_local_communication_neighbours()#

Get a std::vector of MPI ranks which should be used to setup local communication patterns.

Returns:

std::vector of MPI ranks.

inline virtual void get_point_in_subdomain(double *point)#

Get a point in the domain that should be in, or at least close to, the sub-domain on this MPI process. Useful for parallel initialisation.

Parameters:

point – Pointer to array of size equal to at least the number of mesh dimensions.

Public Members

int ndim#

Number of dimensions (physical).

int subdivision_order#

Subdivision order of MeshHierarchy.

MPI_Comm comm#

MPI Communicator used.

std::shared_ptr<MeshHierarchy> mesh_hierarchy#

Underlying MeshHierarchy instance.

int cell_count#

Number of cells, i.e. Number of Nektar++ elements on this rank.

std::array<double, 3> global_origin#

Global origin of domain.

std::array<double, 3> global_extents#

Global extents of global bounding box.

std::vector<int> neighbour_ranks#

Vector of nearby ranks which local exchange patterns can be setup with.

class LocalMapper#
#include <local_mapping.hpp>

Abstract class to map positions to owning MPI ranks based on local information, i.e. halo cells. Could also use or set the cell id.

Subclassed by NESO::Particles::CartesianHMeshLocalMapperT, NESO::Particles::DummyLocalMapperT

Public Functions

inline virtual void map(ParticleGroup &particle_group, const int map_cell = -1) = 0#

This function maps particle positions to cells on the underlying mesh.

Parameters:

particle_groupParticleGroup containing particle positions.

inline virtual void particle_group_callback(ParticleGroup &particle_group) = 0#

Callback for ParticleGroup to execute for additional setup of the LocalMapper that may involve the ParticleGroup.

Parameters:

particle_groupParticleGroup instance.

class LocalMove#
#include <local_move.hpp>

Class to move particles between MPI ranks that are considered neighbours.

Public Functions

LocalMove(const LocalMove &st) = delete#

Disable (implicit) copies.

LocalMove &operator=(LocalMove const &a) = delete#

Disable (implicit) copies.

inline ~LocalMove()#
inline LocalMove(SYCLTargetSharedPtr sycl_target, LayerCompressor &layer_compressor, std::map<Sym<REAL>, ParticleDatSharedPtr<REAL>> &particle_dats_real, std::map<Sym<INT>, ParticleDatSharedPtr<INT>> &particle_dats_int, const int nranks = 0, const int *ranks = nullptr)#

Construct a new instance to move particles between neighbouring MPI ranks.

Parameters:
  • sycl_target – SYCLTargetSharedPtr to use as compute device.

  • layer_compressorLayerCompressor instance used to compress ParticleDat instances.

  • particle_dats_real – Container of REAL valued ParticleDat instances.

  • particle_dats_int – Container of INT valued ParticleDat instances.

  • nranks – Number of remote ranks to consider as neighbours that this rank could send to.

  • ranks – Remote ranks to consider as neighbours that this rank could send to.

inline void set_mpi_rank_dat(ParticleDatSharedPtr<INT> mpi_rank_dat)#

Set the ParticleDat to use for MPI ranks.

Parameters:

mpi_rank_dat – ParticleDat to use for particle positions.

inline void npart_exchange_sendrecv()#

Exchange the particle counts that will be send and received between neighbours.

inline void exchange_init()#

Start the communication that exchanges particle data between neighbouring ranks.

inline void exchange_finalise()#

Wait for the exchange of particle data to complete. Received data is ready to be unpacked on completion.

inline void move()#

Top level method that performs all the required steps to transfer particles between neighbouring MPI ranks.

Public Members

MPI_Comm comm#

The MPI communicator in use by the instance.

int num_remote_send_ranks#

Number of remote ranks this rank could send particles to.

int num_remote_recv_ranks#

Number of remote ranks this rank could receive from.

Private Members

SYCLTargetSharedPtr sycl_target#
std::map<Sym<REAL>, ParticleDatSharedPtr<REAL>> &particle_dats_real#
std::map<Sym<INT>, ParticleDatSharedPtr<INT>> &particle_dats_int#
ParticleDatSharedPtr<INT> mpi_rank_dat#
ParticlePacker particle_packer#
ParticleUnpacker particle_unpacker#
LayerCompressor &layer_compressor#
BufferHost<int> h_send_ranks#
BufferHost<int> h_recv_ranks#
BufferHost<MPI_Request> h_send_requests#
BufferHost<MPI_Request> h_recv_requests#
BufferHost<MPI_Status> h_status#
BufferDeviceHost<int> dh_send_rank_map#
BufferHost<int> h_send_rank_npart#
BufferHost<int> h_recv_rank_npart#
DepartingIdentify departing_identify#
int in_flight_sends#
int in_flight_recvs#
template<typename T>
struct LoopParameter#

The LoopParameter types define the type collected from a data structure prior to calling the loop. The loop is responsible for computing the kernel argument from the loop argument. e.g. in the ParticleDat case the LoopParameter is the pointer type that points to the data for all cells, layers and components.

Public Types

using type = void*#
template<typename T>
struct LoopParameter<Access::Add<CellDat<T>>>#
#include <cell_dat.hpp>

Public Types

using type = T***#
template<typename T>
struct LoopParameter<Access::Add<CellDatConst<T>>>#
#include <cell_dat_const.hpp>

Loop parameter for add access of a CellDatConst.

Public Types

using type = CellDatConstDeviceType<T>#
template<typename T>
struct LoopParameter<Access::Add<GlobalArray<T>>>#
#include <global_array.hpp>

Loop parameter for add access of a GlobalArray.

Public Types

using type = T*#
template<typename T>
struct LoopParameter<Access::Add<LocalArray<T>>>#
#include <local_array.hpp>

Loop parameter for add access of a LocalArray.

Public Types

using type = T*#
template<>
struct LoopParameter<Access::Add<ProductMatrix>>#
#include <product_matrix.hpp>

Loop parameter for add access of a ProductMatrix.

Public Types

using type = ProductMatrixGet#
template<typename T>
struct LoopParameter<Access::Max<CellDatConst<T>>>#
#include <cell_dat_const.hpp>

Loop parameter for max access of a CellDatConst.

Public Types

using type = CellDatConstDeviceType<T>#
template<typename T>
struct LoopParameter<Access::Min<CellDatConst<T>>>#
#include <cell_dat_const.hpp>

Loop parameter for min access of a CellDatConst.

Public Types

using type = CellDatConstDeviceType<T>#
template<typename T>
struct LoopParameter<Access::Read<CellDat<T>>>#
#include <cell_dat.hpp>

Public Types

using type = T*const*const*#
template<typename T>
struct LoopParameter<Access::Read<CellDatConst<T>>>#
#include <cell_dat_const.hpp>

Loop parameter for read access of a CellDatConst.

Public Types

using type = CellDatConstDeviceTypeConst<T>#
template<typename T>
struct LoopParameter<Access::Read<GlobalArray<T>>>#
#include <global_array.hpp>

Loop parameter for read access of a GlobalArray.

Public Types

using type = T const*#
template<typename T>
struct LoopParameter<Access::Read<LocalArray<T>>>#
#include <local_array.hpp>

Loop parameter for read access of a LocalArray.

Public Types

using type = T const*#
template<typename T>
struct LoopParameter<Access::Read<ParticleDatT<T>>>#

Loop parameter for read access of a ParticleDat.

Public Types

using type = T*const*const*#
template<>
struct LoopParameter<Access::Read<ParticleLoopIndex>>#

Loop parameter for read access of a ParticleLoopIndex.

Public Types

using type = ParticleLoopIndexKernelT#
template<>
struct LoopParameter<Access::Read<ProductMatrix>>#
#include <product_matrix.hpp>

Loop parameter for read access of a ProductMatrix.

Public Types

using type = ProductMatrixGetConst#
template<typename T>
struct LoopParameter<Access::Read<Sym<T>>>#

Loop parameter for read access of a ParticleDat via Sym.

Public Types

using type = T*const*const*#
template<typename T>
struct LoopParameter<Access::Read<SymVector<T>>>#
#include <sym_vector.hpp>

Loop parameter for read access of a SymVector.

Public Types

using type = T*const*const**#
template<typename T>
struct LoopParameter<Access::Write<CellDat<T>>>#
#include <cell_dat.hpp>

Public Types

using type = T***#
template<>
struct LoopParameter<Access::Write<DescendantProducts>>#

Loop parameter for write access of a DescendantProducts.

Public Types

using type = DescendantProductsGet#
template<typename T>
struct LoopParameter<Access::Write<LocalArray<T>>>#
#include <local_array.hpp>

Loop parameter for write access of a LocalArray.

Public Types

using type = T*#
template<typename T>
struct LoopParameter<Access::Write<ParticleDatT<T>>>#

Loop parameter for write access of a ParticleDat.

Public Types

using type = T***#
template<>
struct LoopParameter<Access::Write<ProductMatrix>>#
#include <product_matrix.hpp>

Loop parameter for write access of a ProductMatrix.

Public Types

using type = ProductMatrixGet#
template<typename T>
struct LoopParameter<Access::Write<Sym<T>>>#

Loop parameter for write access of a ParticleDat via Sym.

Public Types

using type = T***#
template<typename T>
struct LoopParameter<Access::Write<SymVector<T>>>#
#include <sym_vector.hpp>

Loop parameter for write access of a SymVector.

Public Types

using type = T****#
template<template<typename> typename T, typename U>
struct LoopParameter<T<std::shared_ptr<U>>>#
#include <particle_loop.hpp>

Catch all for args passed as shared ptrs

Public Types

using type = typename LoopParameter<T<U>>::type#
template<typename T>
struct Max#
#include <cell_dat_const.hpp>

Access:CellDatConst::Read<T> and Access:CellDatConst::Max<T> are the kernel argument types for accessing CellDatConst data in a kernel.

Public Functions

Max() = default#

Pointer to underlying data for the array.

inline T fetch_max(const int row, const int col, const T value)#

Public Members

T *ptr#
int nrow#
template<typename T>
struct Max : public NESO::Particles::Access::AccessGeneric<T>#

Atomic max access descriptor.

class MeshHierarchy#
#include <mesh_hierarchy.hpp>

Structure to place a coarse mesh over an arbitrary shaped domain. Each cell in the coarse mesh is a cubes/square that contains a fine mesh also of cubes/squares. Each cell is indexed with a tuple for the coarse mesh and a tuple for the fine mesh in the coarse cell. Each cell in the fine mesh is owned by a unique MPI rank.

This class contains the description of the coarse and fine meshes and the map from fine cells to owning MPI rank. The map is accessible on all MPI ranks and is stored once per MPI shared memory region.

Public Functions

MeshHierarchy(const MeshHierarchy &st) = delete#

Disable (implicit) copies.

MeshHierarchy &operator=(MeshHierarchy const &a) = delete#

Disable (implicit) copies.

inline MeshHierarchy()#
inline MeshHierarchy(MPI_Comm comm, const int ndim, std::vector<int> dims, std::vector<double> origin, const double extent = 1.0, const int subdivision_order = 1)#

Create a mesh hierarchy decomposed over the given MPI communicator with a specified number and shape of coarse cells and subdivision order. Must be called collectively on the communicator.

Parameters:
  • comm – MPI communicator to use for decomposition.

  • ndim – Number of dimensions (1,2 or 3).

  • dims – Number of coarse cells in each dimension.

  • origin – Origin to use for mesh.

  • extent – Cell width of a coarse cell in each dimension.

  • subdivision_order – Number of times to subdivide each coarse cell in each dimension to produce the fine mesh.

inline void free()#

Free all data structures associated with this object. Must be called collectively on the communicator.

inline INT tuple_to_linear_global(INT *index_tuple)#

Convert a global index represented by a tuple into a linear index. tuple should be: 1D: (coarse_x, fine_x) 2D: (coarse_x, coarse_y, fine_x, fine_y) 3D: (coarse_x, coarse_y, coarse_z, fine_x, fine_y, fine_z)

Parameters:

index_tuple – Index represented as a tuple.

Returns:

Linear index.

inline INT tuple_to_linear_coarse(INT *index_tuple)#

Convert a coarse mesh index represented by a tuple into a linear index. tuple should be: 1D: (coarse_x) 2D: (coarse_x, coarse_y) 3D: (coarse_x, coarse_y, coarse_z)

Parameters:

index_tuple – Index represented as a tuple.

Returns:

Linear index.

inline INT tuple_to_linear_fine(INT *index_tuple)#

Convert a fine mesh index represented by a tuple into a linear index. tuple should be: 1D: (fine_x) 2D: (fine_x, fine_y) 3D: (fine_x, fine_y, fine_z)

Parameters:

index_tuple – Index represented as a tuple.

Returns:

Linear index.

inline void linear_to_tuple_global(INT linear, INT *index)#

Convert a global mesh linear index into a tuple index. tuple should be: 1D: (coarse_x, fine_x) 2D: (coarse_x, coarse_y, fine_x, fine_y) 3D: (coarse_x, coarse_y, coarse_z, fine_x, fine_y, fine_z)

Parameters:
  • linear – Linear index to convert.

  • index – Output, index represented as a tuple.

inline void linear_to_tuple_coarse(INT linear, INT *index)#

Convert a coarse mesh linear index into a tuple index. tuple should be: 1D: (coarse_x,) 2D: (coarse_x, coarse_y) 3D: (coarse_x, coarse_y, coarse_z,)

Parameters:
  • linear – Linear index to convert.

  • index – Output, index represented as a tuple.

inline void linear_to_tuple_fine(INT linear, INT *index)#

Convert a fine mesh linear index into a tuple index. tuple should be: 1D: (fine_x,) 2D: (fine_x, fine_y) 3D: (fine_x, fine_y, fine_z)

Parameters:
  • linear – Linear index to convert.

  • index – Output, index represented as a tuple.

inline void claim_initialise()#

Mark the start of an epoch where ranks claim global cells. Collective on communicator.

inline void claim_cell(const INT index, int weight)#

Claim a cell in the MeshHierarchy with a certain weight. The rank that claims with the highest weight owns the cell. In the case of weight contention the highest rank is given the cell. Weights should be an integer in the range ‘[1, int_max-1]’. Claim with the highest weight will be assigned the cell.

Parameters:
  • index – Global linear index to cell to claim.

  • weight – Weight to claim the cell with.

inline void claim_finalise()#

Mark the end of an epoch where ranks claim global cells. Collective on communicator.

inline int get_owner(INT index)#

Get the owning MPI rank for a linear cell index.

Parameters:

index – Global linear index of cell to query the owning rank of.

Returns:

Owning MPI rank.

inline void get_owners(const int nqueries, INT *indices, int *ranks)#

Get the owning MPI ranks for n indices in global tuple form.

Parameters:
  • nqueries – Number of cells to query.

  • indices – Array containing nqueries global index tuples.

  • ranks – Array owning ranks will be stored in.

Public Members

MPI_Comm comm#

MPI communicator on which this mesh is decomposed.

CommPair comm_pair#

CommPair instance that contains the inter and intra communicators.

int ndim#

Number of mesh dimensions (1,2 or 3).

std::vector<int> dims#

Number of coarse cells in each dimension.

std::vector<double> origin#

Origin of the coarse mesh in each dimension.

int subdivision_order#

The fine mesh cells have width cell_width_coarse / 2^p for subdivision order p.

double cell_width_coarse#

Cell width of the coarse cells.

double cell_width_fine#

Cell width of the fine cells.

double inverse_cell_width_coarse#

1/cell_width_coarse.

double inverse_cell_width_fine#

1/cell_width_fine.

INT ncells_coarse#

Global number of coarse cells.

INT ncells_fine#

Number of fine cells in each coarse cell.

INT ncells_dim_fine#

Number of fine cells per dimension in each coarse cell.

INT ncells_global#

Global number of fine cells.

Private Functions

inline void all_reduce_max_map()#

Private Members

std::stack<std::pair<INT, int>> claim_stack#
std::stack<std::pair<INT, int>> claim_stack_binned#
MPI_Win map_win#
bool map_allocated = false#
int *map = NULL#
int *map_base = NULL#
bool map_created = false#
struct MeshHierarchyDeviceMapper#
#include <mesh_hierarchy.hpp>

A struct to aid binning points into MeshHierarchy cells. This type is device copyable such that points can be easilly binned into cells on the device.

Public Functions

inline void map_to_tuple(const REAL *position, INT *cell) const#

For an input point find the MeshHierarchy cell that contains the point in tuple form. Output tuple should be: 1D: (coarse_x, fine_x) 2D: (coarse_x, coarse_y, fine_x, fine_y) 3D: (coarse_x, coarse_y, coarse_z, fine_x, fine_y, fine_z)

Parameters:
  • position[in] Input position.

  • cell[out] Ouput, index represented as a tuple.

inline void map_tuple_to_cart_tuple(const INT *mh_tuple, INT *cart_tuple) const#

For an input MeshHierarchy tuple output the tuple which would index into a standard Cartesian mesh of the same structure. Input tuple should be: 1D: (coarse_x, fine_x) 2D: (coarse_x, coarse_y, fine_x, fine_y) 3D: (coarse_x, coarse_y, coarse_z, fine_x, fine_y, fine_z)

Parameters:
  • mh_tuple[in] Input tuple in global MeshHierarchy form.

  • cart_tuple[out] N dimensional tuple which indexes into the Cartesian mesh view of the MeshHierarchy.

inline void map_to_cart_tuple_no_trunc(const REAL *position, INT *cell) const#

Map position into the cartesian grid. Do not attempt to trucate the position into the mesh.

Parameters:
  • position[in] Input position to map into the Cartesian view of the MeshHierarchy.

  • cell[inout] N dimensional tuple that maps into the Cartesian view of the MeshHierarchy.

inline void cart_tuple_to_tuple(const INT *cart_tuple, INT *mh_tuple) const#

Convert a Cartesian tuple index into a MeshHierarchy global tuple index.

Parameters:
  • cart_tuple[in] Cartesian tuple to convert.

  • mh_tuple[inout] MeshHierarchy global tuple representation of input tuple.

inline INT tuple_to_linear_global(INT *index_tuple) const#

Convert a global index represented by a tuple into a linear index. tuple should be: 1D: (coarse_x, fine_x) 2D: (coarse_x, coarse_y, fine_x, fine_y) 3D: (coarse_x, coarse_y, coarse_z, fine_x, fine_y, fine_z)

Parameters:

index_tuple – Index represented as a tuple.

Returns:

Linear index.

inline INT tuple_to_linear_coarse(INT *index_tuple) const#

Convert a coarse mesh index represented by a tuple into a linear index. tuple should be: 1D: (coarse_x) 2D: (coarse_x, coarse_y) 3D: (coarse_x, coarse_y, coarse_z)

Parameters:

index_tuple – Index represented as a tuple.

Returns:

Linear index.

inline INT tuple_to_linear_fine(INT *index_tuple) const#

Convert a fine mesh index represented by a tuple into a linear index. tuple should be: 1D: (fine_x) 2D: (fine_x, fine_y) 3D: (fine_x, fine_y, fine_z)

Parameters:

index_tuple – Index represented as a tuple.

Returns:

Linear index.

Public Members

INT ndim#

Number of spatial dimensions.

REAL *origin#

ndim sized array holding the mesh origin.

INT *dims#

ndim sized array holding the number of coarse cells in each direction.

REAL inverse_cell_width_coarse#

The inverse of the coarse cell width.

REAL inverse_cell_width_fine#

The inverse of the fine cell width.

REAL cell_width_coarse#

The coarse cell width.

REAL cell_width_fine#

The fine cell width.

INT ncells_dim_fine#

The number of fine cells in each dimension per dimension.

INT ncells_fine#

The total number of fine cells per coarse cell.

class MeshHierarchyGlobalMap#
#include <global_mapping.hpp>

This class maps global positions into the cells of a HMesh and determines which MPI rank owns that cell.

Public Functions

MeshHierarchyGlobalMap(const MeshHierarchyGlobalMap &st) = delete#

Disable (implicit) copies.

MeshHierarchyGlobalMap &operator=(MeshHierarchyGlobalMap const &a) = delete#

Disable (implicit) copies.

inline ~MeshHierarchyGlobalMap()#
inline MeshHierarchyGlobalMap(SYCLTargetSharedPtr sycl_target, HMeshSharedPtr h_mesh, ParticleDatSharedPtr<REAL> &position_dat, ParticleDatSharedPtr<INT> &cell_id_dat, ParticleDatSharedPtr<INT> &mpi_rank_dat)#

Construct a new global mapping instance for MeshHierarchy.

Parameters:
  • sycl_target – SYCLTargetSharedPtr to use as compute device.

  • h_meshHMesh derived mesh to use for mapping.

  • position_dat – ParticleDat containing particle positions.

  • cell_id_dat – ParticleDat containg particle cell ids.

  • mpi_rank_dat – ParticleDat containing the owning rank of particles.

inline void execute()#

For each particle that does not have a non-negative MPI rank determined as a local owner obtain the MPI rank that owns the global cell which contains the particle.

Private Members

SYCLTargetSharedPtr sycl_target#

Compute device used by the instance.

HMeshSharedPtr h_mesh#

HMesh instance on which particles live.

ParticleDatSharedPtr<REAL> &position_dat#

ParticleDat storing Positions.

ParticleDatSharedPtr<INT> &cell_id_dat#

ParticleDat storing cell ids.

ParticleDatSharedPtr<INT> &mpi_rank_dat#

ParticleDat storing MPI rank.

BufferHost<int> h_lookup_count#

Host buffer containing the number of particles to query owning MPI rank.

BufferDevice<int> d_lookup_count#

Device buffer containing the number of particles to query owning MPI rank.

BufferHost<INT> h_lookup_global_cells#

Host buffer of global cells on HMesh to query owner of.

BufferDevice<INT> d_lookup_global_cells#

Device buffer of global cells on HMesh to query owner of.

BufferHost<int> h_lookup_ranks#

Space to store the ranks owning the lookup cells on the host.

BufferDevice<int> d_lookup_ranks#

Space to store the ranks owning the lookup cells on the Device.

BufferDevice<int> d_lookup_local_cells#

Cells of the particles for which the lookup is being performed.

BufferDevice<int> d_lookup_local_layers#

Layers of the particles for which the lookup is being performed.

BufferHost<REAL> h_origin#

Host buffer holding the origin of MeshHierarchy.

BufferDevice<REAL> d_origin#

Device buffer holding the origin of MeshHierarchy.

BufferHost<int> h_dims#

Host buffer containing the dims of MeshHierarchy.

BufferDevice<int> d_dims#

Device buffer containing the dims of MeshHierarchy.

ErrorPropagate error_propagate#

ErrorPropagate for detecting errors in kernels.

class MeshHierarchyMapper#
#include <mesh_hierarchy.hpp>

A class to provide methods to bin points into MeshHierarchy cells and transform between representations of MeshHierarchy indexing.

Public Functions

inline MeshHierarchyMapper(SYCLTargetSharedPtr sycl_target, std::shared_ptr<MeshHierarchy> mesh_hierarchy)#

Create new instance of helper mapper class.

Parameters:
  • sycl_target[in] The compute device to provide device copyable mapper structs for.

  • mesh_hierarchy[in] The MeshHierarchy for which to create a mapper class for.

inline MeshHierarchyDeviceMapper get_device_mapper()#

Get a device copyable struct with device callable methods for interfacing with a MeshHierarchy.

Returns:

New mapper struct.

inline MeshHierarchyDeviceMapper get_host_mapper()#

Get a host struct with methods to interface with a MeshHierarchy instance.

Returns:

New mapper struct.

Private Functions

inline MeshHierarchyDeviceMapper get_generic_mapper()#

Private Members

std::shared_ptr<BufferDeviceHost<REAL>> dh_origin#
std::shared_ptr<BufferDeviceHost<INT>> dh_dims#
std::shared_ptr<MeshHierarchy> mesh_hierarchy#
template<typename T>
struct Min#
#include <cell_dat_const.hpp>

Access:CellDatConst::Read<T> and Access:CellDatConst::Min<T> are the kernel argument types for accessing CellDatConst data in a kernel.

Public Functions

Min() = default#

Pointer to underlying data for the array.

inline T fetch_min(const int row, const int col, const T value)#

Public Members

T *ptr#
int nrow#
template<typename T>
struct Min : public NESO::Particles::Access::AccessGeneric<T>#

Atomic min access descriptor.

struct NDRangePeel1D#
#include <compute_target.hpp>

Main loop with peel loop for 1D nd_range. The peel loop should be masked to remove the workitems past the loop extents.

Public Members

sycl::nd_range<1> loop_main#

The main iteration set which does not need masking.

const bool peel_exists#

Bool to indicate if there is a peel loop.

const size_t offset#

Offset to apply to peel loop indices.

sycl::nd_range<1> loop_peel#

Peel loop description. Indicies from the loop should have offset added to compute the global index. This loop should be masked by a conditional for the original loop bounds.

template<typename T>
class ParticleDatT#
#include <particle_dat.hpp>

Wrapper around a CellDat to store particle data on a per cell basis.

Public Functions

ParticleDatT(const ParticleDatT &st) = delete#

Disable (implicit) copies.

ParticleDatT &operator=(ParticleDatT const &a) = delete#

Disable (implicit) copies.

inline ParticleDatT(SYCLTargetSharedPtr sycl_target, const Sym<T> sym, int ncomp, int ncell, bool positions = false)#

Create a new ParticleDat.

Parameters:
  • sycl_target – SYCLTargetSharedPtr to use as compute device.

  • symSym object that defines the type and label.

  • ncomp – Number of components, of type defined in sym.

  • ncell – Number of cells this ParticleDat is defined over.

  • positions – Does this Dat hold particle positions or cell ids.

inline void npart_host_to_device()#

Copy cell particle counts from host buffer to device buffer.

inline sycl::event async_npart_host_to_device()#

Asynchronously copy cell particle counts from host buffer to device buffer.

Returns:

sycl::event for copy operation.

inline void npart_device_to_host()#

Copy cell particle counts from device buffer to host buffer.

inline sycl::event async_npart_device_to_host()#

Asynchronously copy cell particle counts from device buffer to host buffer.

Returns:

sycl::event for copy operation.

inline ~ParticleDatT()#
inline void append_particle_data(const int npart_new, const bool new_data_exists, std::vector<INT> &cells, std::vector<INT> &layers, std::vector<T> &data, EventStack &es)#

Add particle data to the ParticleDat.

Parameters:
  • npart_new – Number of new particles to add.

  • new_data_exists – Indicate if there is new data to copy of if the data should be initialised with zeros.

  • cells – Cell indices of the new particles.

  • layers – Layer (row) indices of the new particles.

  • data – Particle data to copy into the ParticleDat.

  • esEventStack to push events onto.

inline void realloc(std::vector<INT> &npart_cell_new)#

Realloc the underlying CellDat such that the indicated new number of particles can be stored.

Parameters:

npart_cell_new – Particle counts for each cell.

template<typename U>
inline void realloc(BufferShared<U> &npart_cell_new)#

Realloc the underlying CellDat such that the indicated new number of particles can be stored.

Parameters:

npart_cell_new – Particle counts for each cell.

template<typename U>
inline void realloc(BufferHost<U> &npart_cell_new)#

Realloc the underlying CellDat such that the indicated new number of particles can be stored.

Parameters:

npart_cell_new – Particle counts for each cell.

inline void realloc(const int cell, const int npart_cell_new)#

Realloc the underlying CellDat such that the indicated new number of particles can be stored for a particular cell.

Parameters:
  • cell – Cell index to reallocate.

  • npart_cell_new – Particle counts for the cell.

inline sycl::event copy_particle_data(const int npart, const INT *d_cells_old, const INT *d_cells_new, const INT *d_layers_old, const INT *d_layers_new)#

Asynchronously copy particle data from old cells/layers to new cells/layers.

Parameters:
  • npart – Number of particles to copy.

  • d_cells_old – Device pointer to an array of old cells.

  • d_cells_new – Device pointer to an array of new cells.

  • d_layers_old – Device pointer to an array of old layers.

  • d_layers_new – Device pointer to an array of new layers.

Returns:

sycl::event to wait on for data copy.

inline INT get_npart_local()#

Get the number of particles stored in all cells

Returns:

Total number of stored particles.

template<typename U>
inline sycl::event set_npart_cells_device(const U *d_npart_cell_in)#

Async call to set d_npart_cells from a device buffer. npart_device_to_host must be called on event completion.

Parameters:

d_npart_cell_in – Device accessible pointer to an array containing new cell counts.

Returns:

sycl::event to wait on for completion.

template<typename U>
inline void set_npart_cells_host(const U *h_npart_cell_in)#

Set cell particle counts from host accessible pointer. npart_host_to_device must be called to set counts on the device.

Parameters:

h_npart_cell_in – Host pointer to cell particle counts.

inline void set_npart_cell(const INT cell, const int npart)#

Set the particle count in a single cell. Assigns on both host and device.

Parameters:
  • cell – Cell to set particle count for.

  • npart – New particle count for cell.

inline void set_npart_cells(std::vector<INT> &npart)#

Set particle counts in cells from std::vector. Sets on both host and device.

Parameters:

npart – std::vector of new particle counts per cell.

template<typename U>
inline void set_npart_cells(const BufferHost<U> &h_npart_cell_in)#

Set the particle counts in cells from a BufferHost. Sets on both host and device.

Parameters:

h_npart_cell_in – New particle counts per cell.

template<typename U>
inline sycl::event async_set_npart_cells(const BufferHost<U> &h_npart_cell_in)#

Asynchronously set the particle counts in cells from a BufferHost. Sets on both host and device.

Parameters:

h_npart_cell_in – New particle counts per cell.

Returns:

sycl::event to wait on for device assignment.

inline void trim_cell_dat_rows()#

Reduce the row count of the underlying CellDat to the per cell particle occupancies.

inline void print(const int start = 0, int end = -1)#

Utility function to print the contents of all or a select range of cells.

Parameters:
  • start – Optional first cell to start printing from.

  • end – Optional end cell +1 to end printing at.

inline INT get_npart_upper_bound()#

Get an upper bound for the number of particles. May be a very bad approximation.

Returns:

Upper bound for number of particles.

inline INT get_particle_loop_iter_range()#

Get the size of the iteration set required to loop over all particles with the particle loop macros.

Returns:

Particle Loop iteration set size.

inline INT get_particle_loop_cell_stride()#

Get the size of the iteration set per cell stride required to loop over all particles with the particle loop macros.

Returns:

Particle Loop iteration stride size.

inline int *get_particle_loop_npart_cell()#

Get a device pointer to the array that stores particle counts per cell for the particle loop macros.

Returns:

Device pointer to particle counts per cell.

inline void wait_realloc()#

Wait for a realloc to complete.

Public Members

int *d_npart_cell#

Device only accessible array of the particle counts per cell.

int *h_npart_cell#

Host only accessible array of particle counts per cell.

const Sym<T> sym#

Sym object this ParticleDat was created with.

CellDat<T> cell_dat#

CellDat instance that contains the actual particle data.

const int ncomp#

Number of components stored per particle (columns in the CellDat).

const int ncell#

Number of cells this ParticleDat is defined on.

const bool positions#

Flat to indicate if this ParticleDat is to hold particle positions or.

const std::string name#

Label given to the ParticleDat.

SYCLTargetSharedPtr sycl_target#

Compute device used by the instance.

Protected Functions

inline void add_write_callback(std::function<void(const Sym<T>&, const int)> fn)#
inline void write_callback_wrapper(const int mode)#
inline ParticleDatImplGetT<T> impl_get()#

Non-const pointer to underlying device data. Intended for friend access from ParticleLoop. These pointers must not be cached then used later without recalling this function.

inline ParticleDatImplGetConstT<T> impl_get_const()#

Const pointer to underlying device data. Intended for friend access from ParticleLoop. These pointers must not be cached then used later without recalling this function.

inline void set_d_npart_cell_es(INT *ptr)#
inline INT *get_d_npart_cell_es()#
inline void append_particle_data(std::shared_ptr<ParticleDatT<T>> particle_dat, const std::vector<INT> &h_npart_cell_existing, const std::vector<INT> &h_npart_cell_to_add, EventStack &es)#
inline T const *col_device_const_ptr(const int cell, const int col)#

Const pointer to the start of a column in a cell. Not to be cached.

Protected Attributes

std::function<void(const Sym<T>&, const int)> write_callback#
INT *d_npart_cell_es#

Pointer to the inclusive sum of cell occupancies computed by the ParticleGroup

Friends

friend class ParticleLoop
friend class SymVector< T >
friend class ParticleGroup
friend class MeshHierarchyGlobalMap
friend class CellMove
friend class LayerCompressor
friend class ParticlePacker
friend class ParticleUnpacker
friend ParticleDatImplGetConstT<T> create_loop_arg(ParticleLoopImplementation::ParticleLoopGlobalInfo *global_info, sycl::handler &cgh, Access::Read<Sym<T>*> &a)#
friend ParticleDatImplGetT<T> create_loop_arg(ParticleLoopImplementation::ParticleLoopGlobalInfo *global_info, sycl::handler &cgh, Access::Write<Sym<T>*> &a)#
friend ParticleDatImplGetConstT<T> create_loop_arg(ParticleLoopImplementation::ParticleLoopGlobalInfo *global_info, sycl::handler &cgh, Access::Read<ParticleDatT<T>*> &a)#
friend ParticleDatImplGetT<T> create_loop_arg(ParticleLoopImplementation::ParticleLoopGlobalInfo *global_info, sycl::handler &cgh, Access::Write<ParticleDatT<T>*> &a)#
struct ParticleDatVersionT#
#include <particle_group.hpp>

Type to replace std::variant<Sym<INT>, Sym<REAL>> as the version tracking key as this has been causing segfaults.

Public Functions

inline ParticleDatVersionT(Sym<INT> s)#
inline ParticleDatVersionT(Sym<REAL> s)#
inline ParticleDatVersionT()#
ParticleDatVersionT &operator=(const ParticleDatVersionT&) = default#
inline ParticleDatVersionT &operator=(const Sym<INT> &s)#
inline ParticleDatVersionT &operator=(const Sym<REAL> &s)#
inline bool operator<(const ParticleDatVersionT &v) const#

Public Members

Sym<INT> si#
Sym<REAL> sr#
int index#
class ParticleGroup#
#include <particle_group.hpp>

Fundamentally a ParticleGroup is a collection of ParticleDats, domain and a compute device.

Public Functions

ParticleGroup(const ParticleGroup &st) = delete#

Disable (implicit) copies.

ParticleGroup &operator=(ParticleGroup const &a) = delete#

Disable (implicit) copies.

inline void free()#

Explicitly free a ParticleGroup without relying on out-of-scope.

inline ParticleGroup(DomainSharedPtr domain, ParticleSpec &particle_spec, SYCLTargetSharedPtr sycl_target)#

Construct a new ParticleGroup.

Parameters:
  • domainDomain instance containing these particles.

  • particle_specParticleSpec that describes the ParticleDat instances required.

  • sycl_target – SYCLTargetSharedPtr to use as compute device.

inline ~ParticleGroup()#
inline void add_particle_dat(ParticleDatSharedPtr<REAL> particle_dat)#

Add a ParticleDat to the ParticleGroup after construction.

Parameters:

particle_dat – New ParticleDat to add.

inline void add_particle_dat(ParticleDatSharedPtr<INT> particle_dat)#

Add a ParticleDat to the ParticleGroup after construction.

Parameters:

particle_dat – New ParticleDat to add.

inline void add_particles()#

Add particles to the ParticleGroup. Any rank may add particles that exist anywhere in the domain. This call is collective across the ParticleGroup and ranks that do not add particles should not pass any new particle data.

template<typename U>
inline void add_particles(U particle_data)#

Add particles to the ParticleGroup. Any rank may add particles that exist anywhere in the domain. This call is collective across the ParticleGroup and ranks that do not add particles should not pass any new particle data.

Parameters:

particle_data – New particle data to add to the ParticleGroup.

inline void add_particles_local(ParticleSet &particle_data)#

Add particles only to this MPI rank. It is assumed that the added particles are in the domain region owned by this MPI rank. If not, see ParticleGroup::add_particles.

Parameters:

particle_data – New particles to add.

inline void add_particles_local(ParticleSetSharedPtr particle_data)#

Add particles only to this MPI rank. It is assumed that the added particles are in the domain region owned by this MPI rank. If not, see ParticleGroup::add_particles.

Parameters:

particle_data – New particles to add.

inline void add_particles_local(std::shared_ptr<ProductMatrix> product_matrix)#

Add particles only to this MPI rank. It is assumed that the added particles are in the domain region owned by this MPI rank. If not, see ParticleGroup::add_particles. Particle properties which exist on the ParticleGroup and not in the ProductMatrix will be zero initialised. Particle properties which exist on the ProductMatrix and not in the ParticleGroup will be ignored.

Parameters:

product_matrix – New particles to add.

inline void add_particles_local(std::shared_ptr<DescendantProducts> descendant_products, std::shared_ptr<ParticleGroup> source_particle_group = nullptr)#

Add new particles to this ParticleGroup via a DescendantProducts instance. If no alternative source ParticleGroup is provided then properties are either defined in the DescendantProducts, from which they are copied, or if the property is not defined in the DescendantProducts then the property values are copied from the parent particle.

When a source ParticleGroup is provided: Properties which are defined in the DescendantProducts are copied from the DescendantProducts. If a property is defined in the source ParticleGroup and not in this ParticleGroup then it is ignored. If a property is defined in this ParticleGroup and not in the source ParticleGroup then the values are zero initialised. Properties not defined in the DescendantProducts which exist as particle properties in both the source ParticleGroup and this ParticleGroup are copied from the parent particles. When the source ParticleGroup is specified the parent indices in DescendantProducts always refer to particles in the parent ParticleGroup.

Parameters:
  • descendant_products – New particles to add.

  • source_particleGroup – Alternative ParticleGroup to use as the set of parent particles. The descendant_products parent indices must have been created with this ParticleGroup. By default no alternative ParticleGroup is specified and the parents are assumed to be in the ParticleGroup on which add_particles_local was called.

inline void add_particles_local(std::shared_ptr<ParticleGroup> particle_group)#

Add particles to this ParticleGroup from another ParticleGroup. Properties which exist in the destination ParticleGroup and not the source ParticleGroup are zero initialised. Properties which exist in both ParticleGroups are copied. Properties which only exist in the source ParticleGroup are ignored.

Particle properties will be copied cell-wise from the source to destination ParticleGroups. This cell-wise copy requires that the source and destination domains share the same number of cells on each MPI rank.

Parameters:

particle_group – New particles to add.

inline void add_particles_local(std::shared_ptr<ParticleSubGroup> particle_sub_group)#

Add particles to this ParticleGroup from another ParticleGroup. Properties which exist in the destination ParticleGroup and not the source ParticleGroup are zero initialised. Properties which exist in both ParticleGroups are copied. Properties which only exist in the source ParticleGroup are ignored.

Particle properties will be copied cell-wise from the source to destination ParticleGroups. This cell-wise copy requires that the source and destination domains share the same number of cells on each MPI rank.

Parameters:

particle_sub_group – New particles to add.

inline int get_npart_local()#

Get the total number of particles on this MPI rank.

Returns:

Local particle count.

inline bool contains_dat(Sym<REAL> sym)#

Determine if the ParticleGroup contains a ParticleDat of a given name.

Parameters:

sym – Symbol of ParticleDat.

Returns:

True if ParticleDat exists on this ParticleGroup.

inline bool contains_dat(Sym<INT> sym)#

Determine if the ParticleGroup contains a ParticleDat of a given name.

Parameters:

sym – Symbol of ParticleDat.

Returns:

True if ParticleDat exists on this ParticleGroup.

template<typename T>
inline ParticleDatSharedPtr<T> get_dat(Sym<T> sym, const bool check_exists = true)#

Template for get_dat method called like: ParticleGroup::get_dat(Sym<REAL>(“POS”)) for a real valued ParticleDat.

Parameters:
  • name – Name of ParticleDat.

  • check_exists – Check if the dat exists, default true.

Returns:

ParticleDatSharedPtr<T> particle dat.

inline ParticleDatSharedPtr<REAL> &operator[](Sym<REAL> sym)#

Users are recomended to use “get_dat” instead. Enables access to the ParticleDat instances using the subscript operators.

Parameters:

symSym<REAL> of ParticleDat to access.

inline ParticleDatSharedPtr<INT> &operator[](Sym<INT> sym)#

Users are recomended to use “get_dat” instead. Enables access to the ParticleDat instances using the subscript operators.

Parameters:

symSym<INT> of ParticleDat to access.

inline CellData<REAL> get_cell(Sym<REAL> sym, const int cell)#

Get a CellData instance that holds all the particle data for a ParticleDat for a cell.

Parameters:
  • symSym<REAL> indicating which ParticleDat to access.

  • cell – Cell index to access.

Returns:

CellData for requested cell.

inline CellData<INT> get_cell(Sym<INT> sym, const int cell)#

Get a CellData instance that holds all the particle data for a ParticleDat for a cell.

Parameters:
  • symSym<INT> indicating which ParticleDat to access.

  • cell – Cell index to access.

Returns:

CellData for requested cell.

inline void clear()#

Clear all particles from the ParticleGroup on the calling MPI rank.

inline void remove_particles(const int npart, const std::vector<INT> &cells, const std::vector<INT> &layers)#

Remove particles from the ParticleGroup.

Parameters:
  • npart – Number of particles to remove.

  • cells – Vector of particle cells.

  • layers – Vector of particle layers(rows).

template<typename T>
inline void remove_particles(const int npart, T *usm_cells, T *usm_layers)#

Remove particles from the ParticleGroup.

Parameters:
  • npart – Number of particles to remove.

  • usm_cells – Device accessible array of particle cells.

  • usm_layers – Device accessible array of particle layers(rows).

inline void remove_particles(std::shared_ptr<ParticleSubGroup> particle_sub_group)#

Remove all the particles particles from the ParticleGroup which are members of a ParticleSubGroup.

Parameters:

particle_sub_group.

inline INT get_npart_cell(const int cell)#

Get the number of particles in a cell.

Parameters:

cell – Cell to query.

Returns:

Number of particles in queried cell.

inline ParticleSpec &get_particle_spec()#

Get the ParticleSpec of the ParticleDats stored in this ParticleGroup.

Returns:

ParticleSpec of stored particles.

inline void global_move()#

Use the MPI ranks in the first component of the MPI rank dat to move particles globally using the MeshHierarchy of the mesh in the domain.

Must be called collectively on the ParticleGroup.

inline void local_move()#

Use the MPI ranks in the second component of the MPI rank dat to move particles to neighbouring ranks using the neighbouring ranks defined on the mesh.

Must be called collectively on the ParticleGroup.

inline void hybrid_move()#

Perform a global move using non-negative MPI ranks in the first component of the MPI rank dat. Then bin moved particles into local cells to obtain any required ranks for the local move. Second perform a local move to move particles based on the MPI rank stored in the second component of the MPI rank dat.

Must be called collectively on the ParticleGroup.

inline size_t particle_size()#

Number of bytes required to store the data for one particle.

Returns:

Number of bytes required to store one particle.

inline void cell_move()#

Move particles between cells using the cell ids stored in the cell id dat.

inline void set_npart_cell_from_dat()#

Copy the particle counts per cell from the position ParticleDat to the npart cell array of the ParticleGroup.

template<typename ...T>
inline void print(T... args)#

Print particle data for all particles for the specified ParticleDats. Empty cells are not printed.

Parameters:

argsSym<REAL> or Sym<INT> instances that indicate which particle data to print.

inline void remove_particle_dat(Sym<REAL> sym)#

Remove a ParticleDat from the ParticleGroup

Parameters:

symSym object that refers to a ParticleDat

inline void remove_particle_dat(Sym<INT> sym)#

Remove a ParticleDat from the ParticleGroup

Parameters:

symSym object that refers to a ParticleDat

inline ParticleSetSharedPtr get_particles(std::vector<INT> &cells, std::vector<INT> &layers)#

Create a ParticleSet containing the data from particles held in the ParticleGroup. e.g. to Extract the first two particles from the second cell:

cells = [1, 1] layers = [0, 1]

Parameters:
  • cells – Vector of cell indices of particles to extract.

  • cells – Vector of layer indices of particles to extract.

Returns:

ParticleSet of particle data.

Public Members

DomainSharedPtr domain#

Domain this instance is defined over.

SYCLTargetSharedPtr sycl_target#

Compute device used by the instance.

std::map<Sym<REAL>, ParticleDatSharedPtr<REAL>> particle_dats_real = {}#

Map from Sym instances to REAL valued ParticleDat instances.

std::map<Sym<INT>, ParticleDatSharedPtr<INT>> particle_dats_int = {}#

Map from Sym instances to INT valued ParticleDat instances.

std::shared_ptr<Sym<REAL>> position_sym#

Sym of ParticleDat storing particle positions.

ParticleDatSharedPtr<REAL> position_dat#

ParticleDat storing particle positions.

std::shared_ptr<Sym<INT>> cell_id_sym#

Sym of ParticleDat storing particle cell ids.

ParticleDatSharedPtr<INT> cell_id_dat#

ParticleDat storing particle cell ids.

std::shared_ptr<Sym<INT>> mpi_rank_sym#

Sym of ParticleDat storing particle MPI ranks.

ParticleDatSharedPtr<INT> mpi_rank_dat#

ParticleDat storing particle MPI ranks.

ParticleSpec particle_spec#

ParticleSpec of all the ParticleDats of this ParticleGroup.

LayerCompressor layer_compressor#

Layer compression instance for dats when particles are removed from cells.

Protected Types

typedef ParticleDatVersionT ParticleDatVersion#
typedef std::map<ParticleDatVersion, int64_t> ParticleDatVersionTracker#

Protected Functions

template<typename T>
inline void realloc_dat_start(ParticleDatSharedPtr<T> &dat)#
template<typename T>
inline void realloc_dat_wait(ParticleDatSharedPtr<T> &dat)#
template<typename T>
inline void realloc_dat(ParticleDatSharedPtr<T> &dat)#
inline void realloc_all_dats()#
inline void check_dats_and_group_agree()#
template<typename T>
inline bool existing_compatible_dat(ParticleDatSharedPtr<T> particle_dat)#
inline void get_new_layers(const int npart, const INT *cells_ptr, INT *layers_ptr)#
template<typename T>
inline void zero_dat_properties(std::shared_ptr<T> dat, const int npart, const INT *cells_ptr, const INT *layers_ptr, EventStack &es)#
template<typename T>
inline void push_particle_spec(ParticleProp<T> prop)#
inline void invalidate_callback_inner(ParticleDatVersion sym, const int mode)#
inline void invalidate_callback_int(const Sym<INT> &sym, const int mode)#
inline void invalidate_callback_real(const Sym<REAL> &sym, const int mode)#
inline void add_invalidate_callback(ParticleDatSharedPtr<INT> particle_dat)#
inline void add_invalidate_callback(ParticleDatSharedPtr<REAL> particle_dat)#
template<typename T>
inline void remove_particle_dat_common(ParticleDatSharedPtr<T> particle_dat)#
template<typename T>
inline void add_particle_dat_common(ParticleDatSharedPtr<T> particle_dat)#
inline bool check_validation(ParticleDatVersionTracker &to_check, const bool update_to_check = true)#

Returns true if the passed version is behind and can be updated. By default updates the passed version.

inline void recompute_npart_cell_es()#
inline void add_particles_local(std::shared_ptr<ProductMatrix> product_matrix, const INT *d_cells, const INT *d_layers, ParticleGroup *source_particle_group)#

Protected Attributes

int ncell#
int npart_local#
BufferHost<INT> h_npart_cell#
BufferDevice<INT> d_npart_cell#
BufferDevice<INT> d_remove_cells#
BufferDevice<INT> d_remove_layers#
GlobalMove global_move_ctx#
std::shared_ptr<MeshHierarchyGlobalMap> mesh_hierarchy_global_map#
std::unique_ptr<LocalMove> local_move_ctx#
CellMove cell_move_ctx#
std::map<ParticleDatVersion, std::tuple<int64_t, bool>> particle_dat_versions#
std::shared_ptr<BufferDeviceHost<INT>> dh_npart_cell_es#

BufferDeviceHost holding the exclusive sum of the number of particles in each cell.

std::shared_ptr<BufferDevice<int>> d_sub_group_layers#

The sub group creation requires get_npart_local temporary space and we create this space here on the parent subgroup such that it is shared across all subgroups to avoid exessive memory usage/realloc

Friends

friend class ParticleSubGroupImplementation::SubGroupSelector
friend class ParticleSubGroup
template<typename KERNEL, typename ...ARGS>
class ParticleLoop : public NESO::Particles::ParticleLoopBase#
#include <particle_loop.hpp>

ParticleLoop loop type. The particle loop applies the given kernel to all particles in a ParticleGroup. The kernel must be independent of the execution order (i.e. parallel and unsequenced in C++ terminology).

Public Functions

ParticleLoop(const ParticleLoop &st) = delete#

Disable (implicit) copies.

ParticleLoop &operator=(ParticleLoop const &a) = delete#

Disable (implicit) copies.

inline ParticleLoop(const std::string name, ParticleGroupSharedPtr particle_group, KERNEL kernel, ARGS... args)#

Create a ParticleLoop that executes a kernel for all particles in the ParticleGroup.

Parameters:
  • name – Identifier for particle loop.

  • particle_groupParticleGroup to execute kernel for all particles.

  • kernel – Kernel to execute for all particles in the ParticleGroup.

  • args – The remaining arguments are arguments to be passed to the kernel. All arguments must be wrapped in an access descriptor type.

inline ParticleLoop(ParticleGroupSharedPtr particle_group, KERNEL kernel, ARGS... args)#

Create a ParticleLoop that executes a kernel for all particles in the ParticleGroup.

Parameters:
  • particle_groupParticleGroup to execute kernel for all particles.

  • kernel – Kernel to execute for all particles in the ParticleGroup.

  • args – The remaining arguments are arguments to be passed to the kernel. All arguments must be wrapped in an access descriptor type.

template<typename DAT_TYPE>
inline ParticleLoop(const std::string name, ParticleDatSharedPtr<DAT_TYPE> particle_dat, KERNEL kernel, ARGS... args)#

Create a ParticleLoop that executes a kernel for all particles in the ParticleDat.

Parameters:
  • name – Identifier for particle loop.

  • particle_dat – ParticleDat to define the iteration set.

  • kernel – Kernel to execute for all particles in the ParticleGroup.

  • args – The remaining arguments are arguments to be passed to the kernel. All arguments must be wrapped in an access descriptor type.

template<typename DAT_TYPE>
inline ParticleLoop(ParticleDatSharedPtr<DAT_TYPE> particle_dat, KERNEL kernel, ARGS... args)#

Create a ParticleLoop that executes a kernel for all particles in the ParticleDat.

Parameters:
  • particle_dat – ParticleDat to define the iteration set.

  • kernel – Kernel to execute for all particles in the ParticleGroup.

  • args – The remaining arguments are arguments to be passed to the kernel. All arguments must be wrapped in an access descriptor type.

inline virtual void submit(const std::optional<int> cell = std::nullopt)#

Launch the ParticleLoop and return. Must be called collectively over the MPI communicator of the ParticleGroup. Loop execution is complete when the corresponding call to wait returns.

Parameters:

cell – Optional cell index to only launch the ParticleLoop over.

inline virtual void wait()#

Wait for loop execution to complete. On completion perform post-loop actions. Must be called collectively on communicator.

inline virtual void execute(const std::optional<int> cell = std::nullopt)#

Execute the ParticleLoop and block until execution is complete. Must be called collectively on the MPI communicator associated with the SYCLTarget this loop is over.

Parameters:

cell – Optional cell to launch the ParticleLoop over.

Protected Types

using loop_parameter_type = Tuple::Tuple<loop_parameter_t<ARGS>...>#

The types of the parameters for the outside loops.

using kernel_parameter_type = Tuple::Tuple<kernel_parameter_t<ARGS>...>#

The types of the arguments passed to the kernel.

Protected Functions

template<size_t INDEX, typename U>
inline void unpack_args(U a0)#

Recursively assemble the tuple args.

template<size_t INDEX, typename U, typename ...V>
inline void unpack_args(U a0, V... args)#
template<size_t INDEX, size_t SIZE, typename PARAM>
inline void create_loop_args_inner(ParticleLoopImplementation::ParticleLoopGlobalInfo *global_info, sycl::handler &cgh, PARAM &loop_args)#

Recursively assemble the outer loop arguments.

inline void create_loop_args(sycl::handler &cgh, loop_parameter_type &loop_args, ParticleLoopImplementation::ParticleLoopGlobalInfo *global_info)#
template<typename T>
inline void init_from_particle_dat(ParticleDatSharedPtr<T> particle_dat)#
template<template<typename> typename T, typename U>
inline void check_is_sym_inner(T<U> arg)#
template<typename T>
inline void check_is_sym_inner(T arg)#
template<template<typename> typename T, typename U>
inline void check_is_sym_outer(T<U> arg)#
inline virtual int get_loop_type_int()#
inline ParticleLoopImplementation::ParticleLoopGlobalInfo create_global_info()#
inline bool iteration_set_is_empty(const std::optional<int> cell)#

Protected Attributes

std::tuple<ARGS...> args#

Tuple of the arguments passed to the ParticleLoop on construction.

ParticleGroupSharedPtr particle_group_shrptr#
ParticleGroup *particle_group_ptr = {nullptr}#
SYCLTargetSharedPtr sycl_target#
std::shared_ptr<void> particle_dat_init#

This stores the particle dat the loop was created with to prevent use after free errors in the case when the ParticleLoop is created with a ParticleDat.

KERNEL kernel#
std::unique_ptr<ParticleLoopImplementation::ParticleLoopIterationSet> iteration_set#
std::string loop_type#
std::string name#
EventStack event_stack#
bool loop_running = {false}#
int *d_npart_cell#
int *h_npart_cell_lb#
int *d_npart_cell_lb#
INT *d_npart_cell_es#
INT *d_npart_cell_es_lb#
int ncell#
size_t local_size#

Protected Static Functions

template<template<typename> typename T, typename U>
static inline auto create_loop_arg_cast(ParticleLoopImplementation::ParticleLoopGlobalInfo *global_info, sycl::handler &cgh, T<std::shared_ptr<U>> a)#

Method to compute access to a type wrapped in a shared_ptr.

template<template<typename> typename T, typename U>
static inline auto create_loop_arg_cast(ParticleLoopImplementation::ParticleLoopGlobalInfo *global_info, sycl::handler &cgh, T<U> a)#

Method to compute access to a type not wrapper in a shared_ptr

template<template<typename> typename T, typename U>
static inline auto post_loop_cast(ParticleLoopImplementation::ParticleLoopGlobalInfo *global_info, T<std::shared_ptr<U>> a)#

Method to compute access to a type wrapped in a shared_ptr.

template<template<typename> typename T, typename U>
static inline auto post_loop_cast(ParticleLoopImplementation::ParticleLoopGlobalInfo *global_info, T<U> a)#

Method to compute access to a type not wrapper in a shared_ptr

template<size_t INDEX, size_t SIZE>
static inline constexpr void create_kernel_args_inner(ParticleLoopImplementation::ParticleLoopIteration &iterationx, const loop_parameter_type &loop_args, kernel_parameter_type &kernel_args)#

recusively assemble the kernel arguments from the loop arguments

static inline constexpr void create_kernel_args(ParticleLoopImplementation::ParticleLoopIteration &iterationx, const loop_parameter_type &loop_args, kernel_parameter_type &kernel_args)#

called before kernel execution to assemble the kernel arguments.

class ParticleLoopBase#

Abstract base class for ParticleLoop such that the templated ParticleLoop can be cast to a base type for storage.

Subclassed by NESO::Particles::ParticleLoop< KERNEL, ARGS… >, NESO::Particles::ParticleLoop< KERNEL, ARGS >

Public Functions

inline virtual void execute(const std::optional<int> cell = std::nullopt) = 0#

Execute the particle loop and block until completion. Must be called Collectively on the communicator.

inline virtual void submit(const std::optional<int> cell = std::nullopt) = 0#

Launch the ParticleLoop and return. Must be called collectively over the MPI communicator of the ParticleGroup. Loop execution is complete when the corresponding call to wait returns.

inline virtual void wait() = 0#

Wait for loop execution to complete. On completion perform post-loop actions. Must be called collectively on communicator.

struct ParticleLoopGlobalInfo#

The description of the iteration set to pass to the objects used in the loop.

Public Members

ParticleGroup *particle_group#
INT *d_npart_cell_es#
INT *d_npart_cell_es_lb#
int starting_cell#
int loop_type_int#
struct ParticleLoopIndex#

The type to pass to a ParticleLoop to read the ParticleLoop loop index in a kernel.

struct ParticleLoopIndexKernelT#

Host to loop type for index.

Public Members

int starting_cell#
int loop_type_int#
INT const *npart_cell_es#
INT const *npart_cell_es_lb#
struct ParticleLoopIteration#

The description of the iteration index to pas to objects used in the loop.

Public Members

size_t index#

The overarching outer loop index.

int cellx#

The cell the particle resides in.

int layerx#

The layer (row) the particle resides in.

int loop_layerx#

The layer of the particle in the particle loop iteration set. e.g. not all looping types visit all the particles in a cell. layerx_loop is a linear contiguous index for the particles which are visited in each cell.

struct ParticleLoopIterationSet#
#include <particle_loop.hpp>

For a set of cells containing particles create several sycl::nd_range instances which cover the iteration space of all particles. This exists to create an iteration set over all particles which is blocked, to reduce the number of kernel launches, and reasonably robust to non-uniform.

Public Functions

inline ParticleLoopIterationSet(const int nbin, const int ncell, int *h_npart_cell)#

Creates iteration set creator for a given set of cell particle counts.

Parameters:
  • nbin – Number of blocks of cells.

  • ncell – Number of cells.

  • h_npart_cell – Host accessible array of cell particle counts.

inline std::tuple<int, std::vector<sycl::nd_range<2>>&, std::vector<std::size_t>&> get(const std::optional<int> cell = std::nullopt, const size_t local_size = 256)#

Create and return an iteration set which is formed as nbin sycl::nd_ranges.

Parameters:
  • cell – If set iteration set will only cover this cell.

  • local_size – Optional size of SYCL work groups.

Returns:

Tuple containing: Number of bins, sycl::nd_ranges, cell index offsets.

Public Members

const int nbin#

The number of blocks of cells.

const int ncell#

The number of cells.

int *h_npart_cell#

Host accessible pointer to the number of particles in each cell.

std::vector<sycl::nd_range<2>> iteration_set#

Container to store the sycl::nd_ranges.

std::vector<std::size_t> cell_offsets#

Offsets to add to the cell index to map to the correct cell.

template<typename KERNEL, typename ...ARGS>
class ParticleLoopSubGroup : public NESO::Particles::ParticleLoop<KERNEL, ARGS...>#

Derived ParticleLoop type which implements the particle loop over iteration sets defined by ParticleSubGroups.

Public Functions

inline ParticleLoopSubGroup(const std::string name, ParticleSubGroupSharedPtr particle_sub_group, KERNEL kernel, ARGS... args)#

Create a ParticleLoop that executes a kernel for all particles in the ParticleSubGroup.

Parameters:
  • name – Identifier for particle loop.

  • particle_groupParticleSubGroup to execute kernel for all particles.

  • kernel – Kernel to execute for all particles in the ParticleGroup.

  • args – The remaining arguments are arguments to be passed to the kernel. All arguments must be wrapped in an access descriptor type.

inline ParticleLoopSubGroup(ParticleSubGroupSharedPtr particle_sub_group, KERNEL kernel, ARGS... args)#

Create a ParticleLoop that executes a kernel for all particles in the ParticleSubGroup.

Parameters:
  • particle_groupParticleSubGroup to execute kernel for all particles.

  • kernel – Kernel to execute for all particles in the ParticleGroup.

  • args – The remaining arguments are arguments to be passed to the kernel. All arguments must be wrapped in an access descriptor type.

inline virtual void submit(const std::optional<int> cell = std::nullopt) override#

Launch the ParticleLoop and return. Must be called collectively over the MPI communicator of the ParticleGroup. Loop execution is complete when the corresponding call to wait returns.

Parameters:

cell – Argument for api compatibility.

Protected Functions

inline virtual int get_loop_type_int() override#
inline void setup_subgroup_is(ParticleSubGroupImplementation::SubGroupSelector::SelectionT &selection)#

Protected Attributes

ParticleSubGroupSharedPtr particle_sub_group#
class ParticlePacker#

Class to pack particle data to send using MPI operations.

Public Functions

ParticlePacker(const ParticlePacker &st) = delete#

Disable (implicit) copies.

ParticlePacker &operator=(ParticlePacker const &a) = delete#

Disable (implicit) copies.

inline ~ParticlePacker()#
inline ParticlePacker(SYCLTargetSharedPtr sycl_target)#

Construct a particle packing object on a compute device.

Parameters:

sycl_target – SYCLTargetSharedPtr to use as compute device.

inline void reset()#

Reset the instance before packing particle data.

inline char *get_packed_data_on_host(const int num_remote_send_ranks, const int *h_send_rank_npart_ptr)#

Get the packed particle data on the host such that it can be sent.

Parameters:
  • num_remote_send_ranks – Number of remote ranks involved in send.

  • h_send_rank_npart_ptr – Host accessible pointer holding the number of particles to be sent to each remote rank.

Returns:

Pointer to host allocated buffer holding the packed particle data.

inline sycl::event pack(const int num_remote_send_ranks, BufferHost<int> &h_send_rank_npart, BufferDeviceHost<int> &dh_send_rank_map, const int num_particles_leaving, BufferDevice<int> &d_pack_cells, BufferDevice<int> &d_pack_layers_src, BufferDevice<int> &d_pack_layers_dst, std::map<Sym<REAL>, ParticleDatSharedPtr<REAL>> &particle_dats_real, std::map<Sym<INT>, ParticleDatSharedPtr<INT>> &particle_dats_int, const int rank_component = 0)#

Pack particle data on the device.

Parameters:
  • num_remote_send_ranks – Number of remote ranks involved in send.

  • h_send_rank_npart – Host buffer holding the number of particles to be sent to each remote rank.

  • dh_send_rank_map – Maps MPI ranks to the cell in the packing CellDat.

  • num_particles_leaving – Total number of particles to pack.

  • d_pack_cellsBufferDevice holding the cells of particles to pack.

  • d_pack_layers_srcBufferDevice holding the layers(rows) of particles to pack.

  • d_pack_layers_dstBufferDevice holding the destination layers in the packing CellDat.

  • particle_dats_real – Container of REAL ParticleDat instances to pack.

  • particle_dats_int – Container of INT ParticleDat instances to pack.

  • rank_component – Component of MPI rank ParticleDat to inspect for destination MPI rank.

Returns:

sycl::event to wait on for packing completion.

Public Members

int num_bytes_per_particle#

Number of bytes required per particle packed.

CellDat<char> cell_dat#

CellDat used to pack the particles to be sent to each remote rank on the.

BufferHost<char> h_send_buffer#

Host buffer to copy packed data to before sending using MPI routines.

BufferHost<INT> h_send_offsets#

Vector of offsets to index into the host send buffer.

INT required_send_buffer_length#

Required length of the send buffer.

SYCLTargetSharedPtr sycl_target#

Compute device used by the instance.

Private Functions

inline size_t particle_size(std::map<Sym<REAL>, ParticleDatSharedPtr<REAL>> &particle_dats_real, std::map<Sym<INT>, ParticleDatSharedPtr<INT>> &particle_dats_int)#
inline void get_particle_dat_info(std::map<Sym<REAL>, ParticleDatSharedPtr<REAL>> &particle_dats_real, std::map<Sym<INT>, ParticleDatSharedPtr<INT>> &particle_dats_int)#

Private Members

int num_dats_real = 0#
int num_dats_int = 0#
BufferDeviceHost<REAL*const*const*> dh_particle_dat_ptr_real#
BufferDeviceHost<INT*const*const*> dh_particle_dat_ptr_int#
BufferDeviceHost<int> dh_particle_dat_ncomp_real#
BufferDeviceHost<int> dh_particle_dat_ncomp_int#
template<typename T>
class ParticleProp#
#include <particle_spec.hpp>

Class to describe a property of a particle.

Public Functions

inline ParticleProp(const Sym<T> sym, int ncomp, bool positions = false)#

Constructor for particle properties.

Parameters:
  • symSym<T> instance for the property.

  • ncomp – Number of components for the property.

  • positions – Bool to indicate if the property hold positions or cells ids.

inline bool operator==(const ParticleProp<T> &prop) const#

Public Members

Sym<T> sym#

Symbol giving a label to the property.

std::string name#

Name of the property.

int ncomp#

Number of components required by this property.

bool positions#

Bool to indicate if this property is a particle position or cell id.

class ParticleRemover#

Utility to aid removing particles from a ParticleGroup based on a condition.

Public Functions

ParticleRemover(const ParticleRemover &st) = delete#

Disable (implicit) copies.

ParticleRemover &operator=(ParticleRemover const &a) = delete#

Disable (implicit) copies.

inline ParticleRemover(SYCLTargetSharedPtr sycl_target)#

Construct a remover that operates on ParticleGroups that use the given SYCLTarget.

Parameters:

sycl_targetSYCLTarget instance.

template<typename T, typename U>
inline void remove(ParticleGroupSharedPtr particle_group, ParticleDatSharedPtr<T> particle_dat, const U key)#

Remove particles from a ParticleGroup based on a value in a ParticleDat. For each particle, compares the first value in the ParticleDat with the passed Key. Removes the particle if the value matches the key.

Parameters:
  • particle_groupParticleGroup to remove particles from.

  • particle_dat – ParticleDat to inspect to determine if particles should be removed.

  • key – Key to compare particle values with for removal.

Private Members

BufferDeviceHost<int> dh_remove_count#
BufferDevice<INT> d_remove_cells#
BufferDevice<INT> d_remove_layers#
SYCLTargetSharedPtr sycl_target#
class ParticleSet#
#include <particle_set.hpp>

Container to hold particle data for a set of particles.

Public Functions

inline ParticleSet(const int npart, ParticleSpec particle_spec)#

Constructor for a set of particles.

Parameters:
  • npart – Number of particles required.

  • particle_specParticleSpec instance that describes the particle properties.

inline ColumnMajorRowAccessor<std::vector, REAL> operator[](Sym<REAL> sym)#

Access the std::vectors that correspond to a Sym<REAL>.

inline ColumnMajorRowAccessor<std::vector, INT> operator[](Sym<INT> sym)#

Access the std::vectors that correspond to a Sym<INT>.

inline REAL &at(Sym<REAL> sym, const int particle_index, const int component_index)#

Access REAL elements for a particle.

Parameters:
  • symSym of particle property to access.

  • particle_index – Index of particle to access.

  • component_index – Index of component to access.

Returns:

modifiable reference to element.

inline INT &at(Sym<INT> sym, const int particle_index, const int component_index)#

Access REAL elements for a particle.

Parameters:
  • symSym of particle property to access.

  • particle_index – Index of particle to access.

  • component_index – Index of component to access.

Returns:

modifiable reference to element.

inline std::vector<REAL> &get(Sym<REAL> const &sym)#

Get the vector of values describing the particle data for a given Sym<REAL>. Will return an empty std::vector if the passed Sym is not a stored property.

Parameters:

symSym<REAL> to access.

Returns:

std::vector of data or empty std::vector.

inline std::vector<INT> &get(Sym<INT> const &sym)#

Get the vector of values describing the particle data for a given Sym<INT>. Will return an empty std::vector if the passed Sym is not a stored property.

Parameters:

symSym<INT> to access.

Returns:

std::vector of data or empty std::vector.

inline bool contains(Sym<REAL> const &sym)#

Test to see if this ParticleSet contains data for a given Sym<REAL>

Parameters:

symSym<REAL> to test for.

Returns:

Bool indicating if data exists.

inline bool contains(Sym<INT> const &sym)#

Test to see if this ParticleSet contains data for a given Sym<INT>

Parameters:

symSym<INT> to test for.

Returns:

Bool indicating if data exists.

Public Members

const int npart#

Number of particles stored in the container.

Protected Functions

inline REAL *get_ptr(Sym<REAL> sym, const int particle_index, const int component_index)#
inline INT *get_ptr(Sym<INT> sym, const int particle_index, const int component_index)#

Private Members

std::map<Sym<REAL>, std::vector<REAL>> values_real#
std::map<Sym<INT>, std::vector<INT>> values_int#
std::vector<REAL> dummy_real#
std::vector<INT> dummy_int#

Friends

friend class ParticleGroup
class ParticleSpec#
#include <particle_spec.hpp>

A ParticleSpec is a particle specification described by a collection of particle properties.

Public Functions

template<typename ...T>
inline ParticleSpec(T... args)#

Constructor to create a particle specification.

Parameters:

argsParticleSpec is called with a set of ParticleProp arguments.

inline ParticleSpec(std::vector<ParticleProp<REAL>> &properties_real, std::vector<ParticleProp<INT>> &properties_int)#

Create a particle specification from a vector of REAL properties and a vector of INT properties.

Parameters:
  • properties_real – REAL particle properties.

  • properties_int – INT particle properties.

inline void push(ParticleProp<REAL> pp)#

Push a ParticleProp<REAL> property onto the specification.

Parameters:

pp – ParticleProp<REAL> to add to the specification.

inline void push(ParticleProp<INT> pp)#

Push a ParticleProp<INT> property onto the specification.

Parameters:

pp – ParticleProp<INT> to add to the specification.

template<typename T>
inline bool contains(ParticleProp<T> pp)#

Determine if a ParticleProp is contained in this specification.

Parameters:

ppParticleProp to search for.

Returns:

True if passed ParticleProp is in this ParticleSpec.

inline bool contains(ParticleSpec &ps)#

Determine if a passed ParticleSpec is a subset of this ParticleSpec.

Parameters:

psParticleSpec to compare with.

Returns:

True if the passed particle spec is a subset of this particle spec.

template<typename T>
inline void remove(ParticleProp<T> pp)#

Remove a particle property from the specification.

Parameters:

ppParticleProp to remove from the specification.

inline ParticleSpec()#
inline ~ParticleSpec()#

Public Members

std::vector<ParticleProp<REAL>> properties_real#

Collection of REAL ParticleProp.

std::vector<ParticleProp<INT>> properties_int#

Collection of INT ParticleProp.

Private Functions

template<typename ...T>
inline void push(T... args)#
template<typename ...T>
inline void push(ParticleProp<REAL> pp, T... args)#
template<typename ...T>
inline void push(ParticleProp<INT> pp, T... args)#
inline auto find(ParticleProp<REAL> &prop)#
inline auto find(ParticleProp<INT> &prop)#
inline auto end(ParticleProp<REAL>&)#
inline auto end(ParticleProp<INT>&)#
template<typename T>
inline void erase(ParticleProp<REAL>, T &location)#
template<typename T>
inline void erase(ParticleProp<INT>, T &location)#
class ParticleSubGroup#

A ParticleSubGroup is a container that holds the description of a subset of the particles in a ParticleGroup. For example a sub group could be constructed with all particles of even id. A ParticleSubGroup is a valid iteration set for a ParticleLoop.

A ParticleSubGroup with no selector lambda refers to the entire parent ParticleGroup.

Public Functions

template<typename PARENT, typename KERNEL, typename ...ARGS>
inline ParticleSubGroup(std::shared_ptr<PARENT> parent, KERNEL kernel, ARGS... args)#

Create a ParticleSubGroup based on a kernel and arguments. The selector kernel must be a lambda which returns true for particles which are in the sub group and false for particles which are not in the sub group. The arguments for the selector kernel must be read access Syms, i.e. Access::read(Sym<T>(“name”)).

For example if A is a ParticleGroup with an INT ParticleProp “ID” that holds particle ids then the following line creates a ParticleSubGroup from the particles with even ids.

auto A_even = std::make_shared<ParticleSubGroup>( A, [=](auto ID) { return ((ID[0] % 2) == 0); }, Access::read(Sym<INT>(“ID”)));

Parameters:
inline ParticleSubGroup(ParticleGroupSharedPtr particle_group)#

Create a ParticleSubGroup which is simply a reference/view into an entire ParticleGroup. This constructor creates a sub-group which is equivalent to

auto A_all = std::make_shared<ParticleSubGroup>( A, [=]() { return true; } );

but can make additional optimisations.

Parameters:

parent – Parent ParticleGroup or ParticleSubGroup from which to form ParticleSubGroup.

inline bool static_status(const std::optional<bool> status = std::nullopt)#

Get and optionally set the static status of the ParticleSubGroup.

Parameters:

status – Optional new static status.

Returns:

Static status.

inline void create()#

Explicitly re-create the sub group.

inline bool is_valid()#

Test if a ParticleSubGroup has been invalidated by an operation which irreparably invalidates the internal data structures. This method will always return true for a non-static ParticleSubGroup as non-static ParticleSubGroups are automatically rebuilt as needed.

If the ParticleSubGroup is static and this method returns false then the ParticleSubGroup should not be used for any further operations. Note that the implementation calls this method internally to attempt to avoid miss-use of a ParticleSubGroup and hence the user is not expected to routinely call this method.

Returns:

False if a static ParticleSubGroup has been invalidated by an external operation which invalidated the ParticleSubGroup (e.g. moving particles between cells or MPI ranks, adding or removing particles). Otherwise returns True.

inline bool create_if_required()#

Re-create the sub group if required.

Returns:

True if an update occured otherwise false.

inline INT get_npart_local()#
Returns:

The number of particles currently in the ParticleSubGroup.

inline INT get_npart_cell(const int cell)#
Returns:

The number of particles in a cell of the ParticleSubGroup.

inline ParticleGroupSharedPtr get_particle_group()#
Returns:

The original ParticleGroup this ParticleSubGroup references.

inline bool is_entire_particle_group()#
Returns:

True if this ParticleSubGroup references the entirety of the parent ParticleGroup.

inline ParticleSetSharedPtr get_particles(std::vector<INT> &cells, std::vector<INT> &layers)#

Create a ParticleSet containing the data from particles held in the ParticleSubGroup. e.g. to Extract the first two particles from the second cell:

cells = [1, 1] layers = [0, 1]

Parameters:
  • cells – Vector of cell indices of particles to extract.

  • cells – Vector of layer indices of particles to extract.

Returns:

ParticleSet of particle data.

Protected Functions

template<template<typename> typename T, typename U>
inline void check_sym_type(T<U> arg)#
template<typename T>
inline void check_sym_type(SymVectorSharedPtr<T> sv)#
inline void check_sym_type(ParticleLoopIndex&)#
template<template<typename> typename T, typename U>
inline void check_read_access(T<U> arg)#
inline ParticleSubGroup(ParticleSubGroupImplementation::SubGroupSelector selector)#
inline int get_cells_layers(std::vector<INT> &cells, std::vector<INT> &layers)#

Get the cells and layers of the particles in the sub group (slow)

inline void get_cells_layers(INT *d_cells, INT *d_layers)#
inline void create_inner()#
inline void create_and_update_cache()#
inline void add_parent_dependencies(ParticleGroupSharedPtr parent)#
inline void add_parent_dependencies(std::shared_ptr<ParticleSubGroup> parent)#

Protected Attributes

bool is_static#
ParticleGroupSharedPtr particle_group#
ParticleSubGroupImplementation::SubGroupSelector selector#
ParticleSubGroupImplementation::SubGroupSelector::SelectionT selection#
int npart_local#
ParticleGroup::ParticleDatVersionTracker particle_dat_versions#
bool is_whole_particle_group#

Friends

friend class ParticleLoopSubGroup
friend class ParticleGroup
class ParticleUnpacker#

Class to unpack particle data which was packed using the ParticlePacker.

Public Functions

ParticleUnpacker(const ParticleUnpacker &st) = delete#

Disable (implicit) copies.

ParticleUnpacker &operator=(ParticleUnpacker const &a) = delete#

Disable (implicit) copies.

inline ~ParticleUnpacker()#
inline ParticleUnpacker(SYCLTargetSharedPtr sycl_target)#

Construct an unpacking object.

Parameters:

sycl_target – SYCLTargetSharedPtr to use as compute device.

inline void reset(const int num_remote_recv_ranks, BufferHost<int> &h_recv_rank_npart, std::map<Sym<REAL>, ParticleDatSharedPtr<REAL>> &particle_dats_real, std::map<Sym<INT>, ParticleDatSharedPtr<INT>> &particle_dats_int)#

Reset the unpacker ready to unpack received particles.

Parameters:
  • num_remote_recv_ranks – Number of MPI ranks that will send to this rank.

  • h_recv_rank_npart – Number of particles each rank will send to this rank.

  • particle_dats_real – Container of REAL ParticleDat instances to unpack.

  • particle_dats_int – Container of INT ParticleDat instances to unpack.

inline void unpack(std::map<Sym<REAL>, ParticleDatSharedPtr<REAL>> &particle_dats_real, std::map<Sym<INT>, ParticleDatSharedPtr<INT>> &particle_dats_int)#

Unpack the recv buffer into the particle group. Particles unpack into cell 0.

Parameters:
  • particle_dats_real – Container of REAL ParticleDat instances to unpack.

  • particle_dats_int – Container of INT ParticleDat instances to unpack.

Public Members

BufferHost<char> h_recv_buffer#

Host buffer to receive particle data into from MPI operations.

BufferHost<INT> h_recv_offsets#

Offsets into the recv buffer for each remote rank that will send to this.

int npart_recv#

Number of particles expected in the next/current recv operation.

int num_bytes_per_particle#

Number of bytes per particle.

SYCLTargetSharedPtr sycl_target#

Compute device used by the instance.

Private Functions

inline size_t particle_size(std::map<Sym<REAL>, ParticleDatSharedPtr<REAL>> &particle_dats_real, std::map<Sym<INT>, ParticleDatSharedPtr<INT>> &particle_dats_int)#
inline void get_particle_dat_info(std::map<Sym<REAL>, ParticleDatSharedPtr<REAL>> &particle_dats_real, std::map<Sym<INT>, ParticleDatSharedPtr<INT>> &particle_dats_int)#

Private Members

int num_dats_real = 0#
int num_dats_int = 0#
BufferDeviceHost<REAL***> dh_particle_dat_ptr_real#
BufferDeviceHost<INT***> dh_particle_dat_ptr_int#
BufferDeviceHost<int> dh_particle_dat_ncomp_real#
BufferDeviceHost<int> dh_particle_dat_ncomp_int#
BufferDevice<char> d_recv_buffer#
class ProductMatrix#
#include <product_matrix.hpp>

Type to store N products which can be passed to a ParticleLoop. Fundamentally this class allocates two matrices, one for REAL valued properties and one for INT value properties. These matrices are allocated column major. Each output particle populates a row in these two matrices. The column ordering is based on the ordering of properties and there components in the input particle specification.

Subclassed by NESO::Particles::DescendantProducts

Public Functions

ProductMatrix() = default#
ProductMatrix &operator=(const ProductMatrix&) = default#

Note that the copy operator creates shallow copies of the array.

inline ProductMatrix(SYCLTargetSharedPtr sycl_target, std::shared_ptr<ProductMatrixSpec> spec)#

Create a new product matrix on the SYCLTarget. The reset method should be called with the desired number of output particles before a loop is executed which requires space for those output particles.

Parameters:
  • sycl_target – Device on which particle loops will be executed using the product matrix.

  • spec – A specification for the output particle properties.

inline virtual void reset(const int num_products)#

Allocate space for a number of particle properties and fill the matrix with the default values.

Parameters:

reset – Number of output particles to set in matrix.

Public Members

SYCLTargetSharedPtr sycl_target#

The SYCLTarget products are created on.

int num_products#

The number of products stored.

std::shared_ptr<ProductMatrixSpec> spec#

The specification of the products.

Protected Functions

inline ProductMatrixGet impl_get()#
inline ProductMatrixGetConst impl_get_const()#

Protected Attributes

std::shared_ptr<BufferDevice<REAL>> d_data_real#
std::shared_ptr<BufferDevice<INT>> d_data_int#
std::shared_ptr<BufferDeviceHost<int>> dh_offsets_real#
std::shared_ptr<BufferDeviceHost<int>> dh_offsets_int#

Friends

friend class ParticleGroup
inline friend ProductMatrixGetConst create_loop_arg(ParticleLoopImplementation::ParticleLoopGlobalInfo *global_info, sycl::handler &cgh, Access::Read<ProductMatrix*> &a)#
inline friend ProductMatrixGet create_loop_arg(ParticleLoopImplementation::ParticleLoopGlobalInfo *global_info, sycl::handler &cgh, Access::Write<ProductMatrix*> &a)#
inline friend ProductMatrixGet create_loop_arg(ParticleLoopImplementation::ParticleLoopGlobalInfo *global_info, sycl::handler &cgh, Access::Add<ProductMatrix*> &a)#
struct ProductMatrixGet#
#include <product_matrix.hpp>

Public Members

REAL *ptr_real#
INT *ptr_int#
int const *offsets_real#
int const *offsets_int#
int num_products#
struct ProductMatrixGetConst#
#include <product_matrix.hpp>

Public Members

REAL const *ptr_real#
INT const *ptr_int#
int const *offsets_real#
int const *offsets_int#
int num_products#
struct ProductMatrixSpec#
#include <product_matrix.hpp>

Type to describe the particle properties of products.

Public Functions

ProductMatrixSpec() = default#
ProductMatrixSpec &operator=(const ProductMatrixSpec&) = default#
inline ProductMatrixSpec(ParticleSpec &particle_spec)#

Create a specification for products based on a ParticleSpec.

Parameters:

particle_spec – Specification for product particle properties.

inline void set_default_value(Sym<INT> sym, const int component, const INT value)#

Set the default value for a particle property.

Parameters:
  • symSym of particle property.

  • component – Component of particle property.

  • value – Default value to set.

inline void set_default_value(Sym<REAL> sym, const int component, const REAL value)#

Set the default value for a particle property.

Parameters:
  • symSym of particle property.

  • component – Component of particle property.

  • value – Default value to set.

inline int get_sym_index(const Sym<REAL> sym) const#
Returns:

the integer index that corresponds to a Sym in the specification. Returns -1 if the Sym is not found.

inline int get_sym_index(const Sym<INT> sym) const#
Returns:

the integer index that corresponds to a Sym in the specification. Returns -1 if the Sym is not found.

inline int get_num_components(const Sym<REAL> sym)#
Returns:

the number of components this spec stores for a Sym.

inline int get_num_components(const Sym<INT> sym)#
Returns:

the number of components this spec stores for a Sym.

Public Members

int num_components_real#

The total number of components of type REAL stored.

int num_components_int#

The total number of components of type INT stored.

int num_properties_real#

The number of REAL particle properties.

int num_properties_int#

The number of INT particle properties.

std::vector<Sym<REAL>> syms_real#

The vector of REAL Syms.

std::vector<Sym<INT>> syms_int#

The vector of INT Syms.

std::vector<int> components_real#

The number of components per output property for REAL.

std::vector<int> components_int#

The number of components per output property for INT.

std::map<std::pair<Sym<REAL>, int>, REAL> default_values_real#

Default values applied on call to reset for REAL.

std::map<std::pair<Sym<INT>, int>, INT> default_values_int#

Default values applied on call to reset for INT.

std::map<Sym<REAL>, int> map_sym_index_real#

Map from sym to integer index.

std::map<Sym<INT>, int> map_sym_index_int#

Map from sym to integer index.

ParticleSpec particle_spec#

The ParticleSpec the instance was created from.

struct ProfileEntry#
#include <profiling.hpp>

Structure to describe an entry in the profiling data structure.

Public Members

int64_t value_integral = 0#

Integral value stored on the entry.

double value_real = 0.0#

Floating point value stored on the entry.

class ProfileMap#
#include <profiling.hpp>

Data structure for profiling data. Fundamentally is a map from key to key to value.

Public Functions

inline ~ProfileMap()#
inline ProfileMap()#

Construct a new empty instance.

inline void set(const std::string key1, const std::string key2, const int64_t value_integral, const double value_real = 0.0)#

Set or create a new profiling entry in the data structure.

Parameters:
  • key1 – First key for the entry.

  • key2 – Second key for the entry.

  • value_integral – Integral value for the entry.

  • value_real – Floating point value for the entry.

inline void inc(const std::string key1, const std::string key2, const int64_t value_integral, const double value_real = 0.0)#

Increment a profiling entry in the data structure.

Parameters:
  • key1 – First key for the entry.

  • key2 – Second key for the entry.

  • value_integral – Integral value for the entry to add to current value.

  • value_real – Floating point value for the entry to add to current value.

inline void reset()#

Reset the profiling data by emptying the current set of keys and values.

inline void print()#

Print the profiling data.

inline void event(const std::string key1, const std::string key2)#

Record a profiling event in the data structure.

Parameters:
  • key1 – First key for the entry.

  • key2 – Second key for the entry.

inline void add_region(ProfileRegion &profile_region)#

Add a region to this profiling.

Parameters:

profile_regionProfileRegion to add.

inline void print_events()#

Print the event data to stdout.

inline void write_events_json(std::string basename, const int rank)#

Write events and regions to JSON file.

Public Members

std::chrono::high_resolution_clock::time_point time_start#

Reference time for start of profiling.

std::map<std::string, std::map<std::string, ProfileEntry>> profile#

Main data structure storing profiling data.

std::list<std::tuple<std::string, std::string, std::chrono::high_resolution_clock::time_point>> events#

Main data structure for storing events.

std::list<ProfileRegion> regions#
struct ProfileRegion#
#include <profiling.hpp>

Struct to hold a ProfileRegion for profiling.

Public Functions

inline ProfileRegion(const std::string key1, const std::string key2, const int level = 0)#

Create new ProfileRegion.

Parameters:
inline void end()#

End the ProfileRegion.

Public Members

std::chrono::high_resolution_clock::time_point time_start#
std::chrono::high_resolution_clock::time_point time_end#
std::string key1#
std::string key2#
int level#
template<typename T>
class RawPointerColumnMajorColumnAccessor#
#include <access.hpp>

One of a pair of classes that enable indexing like foo[row][col] for an object foo which stores data in a column major format.

Public Functions

inline RawPointerColumnMajorColumnAccessor(T *d_ptr, const int stride, const int rowx)#

Create new instance to access data through a pointer which stores 2D data in a column major format using a given stride.

Parameters:
  • d_ptr – Base pointer to index into.

  • stride – Number of rows in the 2D object.

  • rowx – Row to access.

inline T &operator[](const int &colx)#

Access element at column, row is provided in the constructor.

Parameters:

colx – Column to access.

Private Members

T *d_ptr#
const int stride#
const int rowx#
template<typename T>
class RawPointerColumnMajorRowAccessor#
#include <access.hpp>

One of a pair of classes that enable indexing like foo[row][col] for an object foo which stores data in a column major format.

Public Functions

inline RawPointerColumnMajorRowAccessor(T *d_ptr, const int stride)#

Create new instance to access data through a pointer which stores 2D data in a column major format using a given stride.

Parameters:
  • d_ptr – Base Object to index into.

  • stride – Number of rows in the 2D object.

inline RawPointerColumnMajorColumnAccessor<T> operator[](const int rowx)#

Returns a RawPointerColumnMajorColumnAccessor instance which defines a subscript operator that can be used to access any column of the specified row.

Parameters:

rowx – Row to provide access to.

Private Members

T *d_ptr#
const int stride#
template<typename T>
struct Read#
#include <cell_dat.hpp>

Access:CellDat::Read<T> read access cellwise.

Public Functions

Read() = default#

Pointer to underlying data for the array.

inline const T at(const int row, const int col)#

Public Members

T *const *const *ptr#
int cell#
template<typename T>
struct Read#
#include <cell_dat_const.hpp>

Access:CellDatConst::Read<T> and Access:CellDatConst::Add<T> are the kernel argument types for accessing CellDatConst data in a kernel.

Public Functions

Read() = default#

Pointer to underlying data for the array.

inline const T at(const int row, const int col)#
inline const T &operator[](const int component)#

Public Members

T const *ptr#
int nrow#
template<typename T>
struct Read#
#include <global_array.hpp>

Access:GlobalArray::Read<T> and Access:GlobalArray::Add<T> are the kernel argument types for accessing GlobalArray data in a kernel.

Public Functions

Read() = default#

Pointer to underlying data for the array.

inline const T at(const int component)#
inline const T &operator[](const int component)#

Public Members

T const *ptr#
template<typename T>
struct Read#
#include <local_array.hpp>

Access:LocalArray::Read<T>, Access::LocalArray::Write<T> and Access:LocalArray::Add<T> are the kernel argument types for accessing LocalArray data in a kernel. ParticleLoop access type for LocalArray Read access.

Public Functions

Read() = default#

Pointer to underlying data for the array.

inline const T at(const int component) const#
inline const T &operator[](const int component) const#

Public Members

T const *ptr#
struct Read#

ParticleLoop index containing the cell and layer.

Public Functions

inline INT get_local_linear_index() const#
Returns:

The local linear index of the particle on this MPI rank in the ParticleGroup

inline INT get_loop_linear_index() const#
Returns:

The linear index of the particle within the current ParticleLoop.

inline INT get_sub_linear_index() const#
Returns:

The local linear index of the particle in the ParticleSubGroup. This call is identical to get_local_linear_index when the iteration set is a ParticleGroup.

Public Members

INT cell#

The cell containing the particle.

INT layer#

The layer of the particle.

INT loop_layer#

The looping layer of the particle.

int loop_type_int#

The type of the ParticleLoop (intended for internal use).

INT const *npart_cell_es#

pointer to the exclusive sum of particle counts in each cell (intended for internal use).

INT const *npart_cell_es_lb#

pointer to the exclusive sum of particle counts in each cell for loop bounds (intended for internal use).

int starting_cell#

Loop iteration index (intended for internal use - see get_loop_linear_index) Starting cell for ParticleLoop called cell wise (intended for internal use).

template<typename T>
struct Read#

Access:ParticleDat::Read<T> and Access:ParticleDat::Read<T> are the kernel argument types for accessing particle data in a kernel.

Public Functions

inline T const &operator[](const int component)#
inline T const &at(const int component)#

Public Members

T const *const *ptr#

Pointer to underlying data for a cell.

int layer#

Stores which particle in the cell this instance refers to.

struct Read#
#include <product_matrix.hpp>

Access:ProductMatrix::Read<T>, Access::ProductMatrix::Write<T> and Access:ProductMatrix::Add<T> are the kernel argument types for accessing ProductMatrix data in a kernel. ParticleLoop access type for ProductMatrix Read access.

Public Functions

Read() = default#
inline const REAL &at_real(const int product, const int property, const int component) const#

Access a REAL product property.

Parameters:
  • product – The index of the product to access, i.e. the row in the product matrix.

  • property – The particle property to access using the ordering REAL ParticleProp instances were passed to the ProductMatrixSpec

  • component – The component of the property to access.

Returns:

Constant reference to product value.

inline const INT &at_int(const int product, const int property, const int component) const#

Access a INT product property.

Parameters:
  • product – The index of the product to access, i.e. the row in the product matrix.

  • property – The particle property to access using the ordering INT ParticleProp instances were passed to the ProductMatrixSpec

  • component – The component of the property to access.

Returns:

Constant reference to product value.

Public Members

REAL const *ptr_real#
INT const *ptr_int#
int const *offsets_real#
int const *offsets_int#
int num_products#
template<typename T>
struct Read : public NESO::Particles::Access::AccessGeneric<T>#

Read access descriptor.

template<typename T>
struct Read#
#include <sym_vector.hpp>

Access:SymVector::Read<T> and Access:SymVector::Read<T> are the kernel argument types for accessing particle data in a kernel via a SymVector.

Public Functions

inline T const &at(const int dat_index, const int cell, const int layer, const int component) const#
inline T const &at(const int dat_index, const Access::LoopIndex::Read &particle_index, const int component) const#
inline T const &at(const int dat_index, const int component) const#

Public Members

int cell#
int layer#
T *const *const **ptr#

Pointer to underlying data.

struct SelectionT#

Public Members

int npart_local#
int ncell#
int *h_npart_cell#
int *d_npart_cell#
INT *d_npart_cell_es#
INT ***d_map_cells_to_particles#
class SubGroupSelector#

Class to consume the lambda which selects which particles are to be in a ParticleSubGroup and provide to the ParticleSubGroup a list of cells and layers.

Public Functions

template<typename PARENT, typename KERNEL, typename ...ARGS>
inline SubGroupSelector(std::shared_ptr<PARENT> parent, KERNEL kernel, ARGS... args)#

Create a selector based on a kernel and arguments. The selector kernel must be a lambda which returns true for particles which are in the sub group and false for particles which are not in the sub group. The arguments for the selector kernel must be read access Syms, i.e. Access::read(Sym<T>(“name”)).

Parameters:
inline SelectionT get()#

Get two BufferDeviceHost objects that hold the cells and layers of the particles which currently are selected by the selector kernel.

Returns:

List of cells and layers of particles in the sub group.

Public Members

ParticleGroupSharedPtr particle_group#

Protected Functions

inline ParticleGroupSharedPtr get_particle_group(std::shared_ptr<ParticleSubGroup> parent)#
inline ParticleGroupSharedPtr get_particle_group(std::shared_ptr<ParticleGroup> parent)#

Protected Attributes

std::shared_ptr<CellDat<INT>> map_cell_to_particles#
std::shared_ptr<BufferDeviceHost<int>> dh_npart_cell#
LocalArray<int*> map_ptrs#
std::shared_ptr<BufferDevice<INT>> d_npart_cell_es#
ParticleLoopSharedPtr loop_0#
ParticleLoopSharedPtr loop_1#

Friends

friend class NESO::Particles::ParticleSubGroup
class SYCLTarget#
#include <compute_target.hpp>

Container for SYCL devices and queues such that they can be easily passed around.

Public Functions

SYCLTarget(const SYCLTarget &st) = delete#

Disable (implicit) copies.

SYCLTarget &operator=(SYCLTarget const &a) = delete#

Disable (implicit) copies.

inline SYCLTarget(const int gpu_device, MPI_Comm comm, int local_rank = -1)#

Create a new SYCLTarget using a flag to specifiy device type and a parent MPI communicator.

Parameters:
  • gpu_device – Specify how to search for SYCL device. 0 uses default selector, 1 explicitly use a GPU selector and -1 use an explicit CPU selector.

  • comm – MPI Communicator on which the SYCLTarget is based.

  • local_rank – (optional) Explicitly pass the local rank used to assign devices to MPI ranks.

inline ~SYCLTarget()#
inline void print_device_info()#

Print information to stdout about the current SYCL device (on MPI rank 0).

inline void free()#

Free the SYCLTarget and underlying CommPair.

inline void *malloc_device(size_t size_bytes)#

Allocate memory on device using sycl::malloc_device.

Parameters:

size_bytes – Number of bytes to allocate.

inline void *malloc_host(size_t size_bytes)#

Allocate memory on the host using sycl::malloc_host.

Parameters:

size_bytes – Number of bytes to allocate.

template<typename T>
inline void free(T *ptr_in)#

Free a pointer allocated with malloc_device.

Parameters:

ptr_in – Pointer to free.

inline void check_ptrs()#
inline void check_ptr(unsigned char *ptr_user, const size_t size_bytes)#

Public Members

sycl::device device#

SYCL device in use.

sycl::queue queue#

Main SYCL queue to use.

MPI_Comm comm#

Parent MPI communicator to use.

CommPair comm_pair#

CommPair to pass around inter and intra communicators for shared memory regions.

ProfileMap profile_map#

ProfileMap to log profiling data related to this SYCLTarget.

Private Members

std::map<unsigned char*, size_t> ptr_map#
template<typename U>
class Sym#
#include <particle_spec.hpp>

Symbol describing a type of data and a name.

Public Functions

Sym() = default#
Sym<U> &operator=(const Sym<U>&) = default#
inline Sym(const std::string name)#

Construct a new Sym object.

Parameters:

name – Name of new symbol.

inline bool operator<(const Sym &sym) const#

Comparison of Sym types.

std::map uses std::less as default comparison operator

Parameters:

sym – Other Sym to compare against.

inline bool operator==(const Sym &sym) const#

Public Members

std::string name#

Name of the symbol.

class SymStore#
#include <particle_spec.hpp>

Helper class to hold a collection of Sym instances for ParticleGroup::print.

Public Functions

template<typename ...T>
inline SymStore(T... args)#

Constructor for SymStore should be called with a list of arguments which are Sym instances.

Parameters:

args – Passed arguments should be Sym<REAL> or Sym<INT>.

inline SymStore()#
inline ~SymStore()#

Public Members

std::vector<Sym<REAL>> syms_real#

Container of Sym<REAL> symbols.

std::vector<Sym<INT>> syms_int#

Container of Sym<INT> symbols.

Private Functions

template<typename ...T>
inline void push(T... args)#
inline void push(Sym<REAL> pp)#
inline void push(Sym<INT> pp)#
template<typename ...T>
inline void push(Sym<REAL> pp, T... args)#
template<typename ...T>
inline void push(Sym<INT> pp, T... args)#
template<typename T>
class SymVector#
#include <sym_vector.hpp>

Enables ParticleDats to be accessed in ParticleLoops with a number of ParticleDats determined at runtime.

Public Functions

SymVector() = default#
SymVector<T> &operator=(const SymVector<T>&) = default#
inline SymVector(ParticleGroupSharedPtr particle_group, std::vector<Sym<T>> syms)#

Create a SymVector using a ParticleGroup and a std::vector of Syms.

Parameters:
  • particle_groupParticleGroup to use.

  • syms – Vector of Syms to use from particle_group.

inline SymVector(ParticleGroupSharedPtr particle_group, std::initializer_list<Sym<T>> syms)#

Create a SymVector using a ParticleGroup and an initialiser list of syms, e.g.

SymVector(particle_group, {Sym<INT>(“a”), Sym<INT>(“b”)});

Parameters:
  • particle_groupParticleGroup to use.

  • syms – Syms to use from particle_group.

inline std::vector<ParticleDatSharedPtr<T>> const &get_particle_dats()#
Returns:

The ParticleDats that form the SymVector.

Protected Functions

inline void create(SYCLTargetSharedPtr sycl_target)#
inline SymVectorImplGetT<T> impl_get()#
inline SymVectorImplGetConstT<T> impl_get_const()#

Protected Attributes

std::vector<ParticleDatSharedPtr<T>> dats#

The ParticleDats referenced by the SymVector.

std::shared_ptr<BufferDeviceHost<T***>> dh_root_ptrs#
std::shared_ptr<BufferDeviceHost<T*const*const*>> dh_root_const_ptrs#

Friends

friend class ParticleLoop
friend SymVectorImplGetConstT<T> create_loop_arg(ParticleLoopImplementation::ParticleLoopGlobalInfo *global_info, sycl::handler &cgh, Access::Read<SymVector<T>*> &a)#
friend SymVectorImplGetT<T> create_loop_arg(ParticleLoopImplementation::ParticleLoopGlobalInfo *global_info, sycl::handler &cgh, Access::Write<SymVector<T>*> &a)#
template<typename U, typename ...V>
struct Tuple : public NESO::Particles::Tuple::TupleBaseRec<0, U, V...>#
#include <tuple.hpp>

Public Functions

Tuple() = default#
template<size_t INDEX, typename ...V>
struct TupleBaseRec#
#include <tuple.hpp>

Public Functions

TupleBaseRec() = default#
template<size_t INDEX, typename U, typename ...V>
struct TupleBaseRec<INDEX, U, V...> : public NESO::Particles::Tuple::TupleImpl<INDEX, U>, public NESO::Particles::Tuple::TupleBaseRec<INDEX + 1, V...>#
#include <tuple.hpp>

Public Functions

TupleBaseRec() = default
template<std::size_t INDEX, typename U>
struct TupleImpl#
#include <tuple.hpp>

Subclassed by NESO::Particles::Tuple::TupleBaseRec< INDEX, U, V… >

Public Functions

TupleImpl() = default#
inline U &get()#
inline const U &get_const() const#

Public Members

U value#
class VTKMeshHierarchyCellsWriter#

Class to write MeshHierarchy cells to a vtk file as a collection of vertices and edges for visualisation in Paraview.

Public Functions

inline VTKMeshHierarchyCellsWriter(std::shared_ptr<MeshHierarchy> mesh_hierarchy)#

Create new instance of the writer.

Parameters:

mesh_hierarchy[in] MeshHierarchy instance to use as source for cells.

inline void push_back(const INT linear_index)#

Add a cell to the list of cells to be written to the output file.

Parameters:

linear_index[in] Index of cell.

inline void write(std::string filename)#

Write the output vtk file.

Parameters:

filename[in] Filename to write output to. Should end in .vtk.

inline void write_all_fine(std::string filename)#

Write all fine cells to the output file.

Parameters:

filename – Filename to write fine cells to.

inline void write_all_coarse(std::string filename)#

Write all coarse cells to the output file.

Parameters:

filename – Filename to write fine cells to.

Protected Functions

inline INT get_index(std::tuple<INT, INT, INT> vert)#
inline std::tuple<INT, INT, INT> to_standard_tuple(const INT linear_index)#
inline std::vector<std::tuple<INT, INT, INT>> get_coarse_tuples()#
inline std::vector<std::pair<std::tuple<INT, INT, INT>, std::tuple<INT, INT, INT>>> get_lines(std::tuple<INT, INT, INT> base)#
inline void write_inner(std::string filename, const bool fine)#

Protected Attributes

std::shared_ptr<MeshHierarchy> mesh_hierarchy#
std::vector<INT> cells#
std::map<std::tuple<INT, INT, INT>, INT> verts_to_index#
std::map<INT, std::tuple<INT, INT, INT>> index_to_verts#
INT next_vert_index#
template<typename T>
struct Write#
#include <cell_dat.hpp>

Access:CellDat::Add<T> write access cellwise.

Public Functions

Write() = default#

Pointer to underlying data for the array.

inline T &at(const int row, const int col)#

Public Members

T ***ptr#
int cell#
struct Write#

ParticleLoop access type for DescendantProducts Write access.

Public Functions

Write() = default#

Pointer to underlying data for the array.

inline REAL &at_real(const LoopIndex::Read &particle_index, const int product, const int property, const int component)#

Write access to REAL particle property.

Parameters:
  • particle_index – The index of the particle creating this product.

  • product – The index of the product to access, i.e. the row in the product matrix.

  • property – The particle property to access using the ordering REAL ParticleProp instances were passed to the ProductMatrixSpec

  • component – The component of the property to access.

Returns:

Modifiable reference to property value.

inline INT &at_int(const LoopIndex::Read &particle_index, const int product, const int property, const int component)#

Write access to INT particle property.

Parameters:
  • particle_index – The index of the particle creating this product.

  • product – The index of the product to access, i.e. the row in the product matrix.

  • property – The particle property to access using the ordering INT ParticleProp instances were passed to the ProductMatrixSpec

  • component – The component of the property to access.

Returns:

Modifiable reference to property value.

inline void set_parent(const LoopIndex::Read &particle_index, const int product)#

Set the parent of a product.

Parameters:
  • particle_index – Index of parent particle.

  • product – Index of child property to set as descendant of parent.

Public Members

REAL *ptr_real#
INT *ptr_int#
int const *offsets_real#
int const *offsets_int#
int num_products#
int num_particles#
INT *d_parent_cells#
INT *d_parent_layers#
template<typename T>
struct Write#
#include <local_array.hpp>

ParticleLoop access type for LocalArray Write access.

Public Functions

Write() = default#

Pointer to underlying data for the array.

inline T at(const int component)#
inline T &operator[](const int component)#

Public Members

T *ptr#
template<typename T>
struct Write#

Public Functions

inline T &operator[](const int component)#
inline T &at(const int component)#

Public Members

T **ptr#

Pointer to underlying data for a cell.

int layer#

Stores which particle in the cell this instance refers to.

struct Write#
#include <product_matrix.hpp>

ParticleLoop access type for ProductMatrix Write access.

Public Functions

Write() = default#

Pointer to underlying data for the array.

inline REAL &at_real(const int product, const int property, const int component)#

Write access to REAL particle property.

Parameters:
  • product – The index of the product to access, i.e. the row in the product matrix.

  • property – The particle property to access using the ordering REAL ParticleProp instances were passed to the ProductMatrixSpec

  • component – The component of the property to access.

Returns:

Modifiable reference to property value.

inline INT &at_int(const int product, const int property, const int component)#

Write access to INT particle property.

Parameters:
  • product – The index of the product to access, i.e. the row in the product matrix.

  • property – The particle property to access using the ordering INT ParticleProp instances were passed to the ProductMatrixSpec

  • component – The component of the property to access.

Returns:

Modifiable reference to property value.

Public Members

REAL *ptr_real#
INT *ptr_int#
int const *offsets_real#
int const *offsets_int#
int num_products#
template<typename T>
struct Write#
#include <sym_vector.hpp>

Public Functions

inline T &at(const int dat_index, const int cell, const int layer, const int component) const#
inline T &at(const int dat_index, const Access::LoopIndex::Read &particle_index, const int component) const#
inline T &at(const int dat_index, const int component) const#

Public Members

int cell#
int layer#
T ****ptr#

Pointer to underlying data.

template<typename T>
struct Write : public NESO::Particles::Access::AccessGeneric<T>#

Write access descriptor.

namespace cl#
namespace NESO#
namespace Particles#

Typedefs

typedef std::shared_ptr<SYCLTarget> SYCLTargetSharedPtr#
template<typename T>
using CellData = std::shared_ptr<CellDataT<T>>#
template<typename T>
using GlobalArrayImplGetT = T*#
template<typename T>
using GlobalArrayImplGetConstT = T const*#
template<typename T>
using LocalArrayImplGetT = T*#
template<typename T>
using LocalArrayImplGetConstT = T const*#
template<typename T>
using SymVectorImplGetT = T****#
template<typename T>
using SymVectorImplGetConstT = T*const*const**#
template<typename T>
using SymVectorSharedPtr = std::shared_ptr<SymVector<T>>#
typedef std::shared_ptr<Domain> DomainSharedPtr#
typedef std::shared_ptr<LocalMapper> LocalMapperSharedPtr#
typedef std::shared_ptr<ParticleLoopBase> ParticleLoopSharedPtr#
typedef std::shared_ptr<HMesh> HMeshSharedPtr#
typedef std::shared_ptr<CartesianHMesh> CartesianHMeshSharedPtr#
template<typename T>
using ParticleDatImplGetT = T***#
template<typename T>
using ParticleDatImplGetConstT = T*const*const*#
template<typename T>
using ParticleDatSharedPtr = std::shared_ptr<ParticleDatT<T>>#
typedef std::shared_ptr<ParticleGroup> ParticleGroupSharedPtr#
typedef std::shared_ptr<ParticleSet> ParticleSetSharedPtr#
typedef std::shared_ptr<ParticleSubGroup> ParticleSubGroupSharedPtr#
typedef double REAL#
typedef int64_t INT#

Functions

inline std::shared_ptr<CartesianHMeshLocalMapperT> CartesianHMeshLocalMapper(SYCLTargetSharedPtr sycl_target, CartesianHMeshSharedPtr mesh)#
template<typename T>
inline MPI_Datatype map_ctype_mpi_type()#

For an input data type T get the matching MPI Datatype.

Parameters:

i – Input argument of type T.

Returns:

MPI_Datatype that matches the input type T.

inline int get_local_mpi_rank(MPI_Comm comm, int default_rank = -1)#

Determine a local MPI rank based on environment variables and shared memory splitting.

Parameters:
  • comm – MPI_Comm to try and deduce local rank from.

  • default_rank – (optional) MPI rank to use if one cannot be determined from environment variables or SHM intra comm.

template<template<typename> typename D, template<typename> typename S, typename T>
inline sycl::event buffer_memcpy(D<T> &dst, S<T> &src)#

Copy the contents of a buffer, e.g. BufferDevice, BufferHost, into another buffer.

Parameters:
  • dst – Destination buffer.

  • src – Source buffer.

inline sycl::nd_range<1> get_nd_range_1d(const std::size_t size, const std::size_t local_size)#

Get an 1D nd_range for a given iteration set global size and local size.

Parameters:
  • size – Global iteration set size.

  • local_size – Local iteration set size (work group size).

Returns:

nd_range large enough to cover global iteration set. May be larger than size.

inline NDRangePeel1D get_nd_range_peel_1d(const std::size_t size, const std::size_t local_size)#

Create two nd_ranges that cover a 1D iteration set. The first is a main iteration set that does not need a mask. The second is an iteration set that requires 1) the offset adding to the iteration index and 2) a conditional to test the resulting index is less than the loop bound.

Parameters:
  • size – Global iteration set size.

  • local_size – Local iteration set size (SYCL workgroup size).

Returns:

NDRangePeel1D instance describing loop iteration sets.

inline std::shared_ptr<ProductMatrixSpec> product_matrix_spec(ParticleSpec particle_spec)#

Helper function to create ProductMatrixSpec instances.

Parameters:

particle_spec – Specification for product particle properties.

inline std::shared_ptr<ProductMatrix> product_matrix(SYCLTargetSharedPtr sycl_target, std::shared_ptr<ProductMatrixSpec> spec)#

Helper function to create ProductMatrix shared pointer.

Parameters:
  • sycl_target – Device on which particle loops will be executed using the product matrix.

  • spec – A specification for the output particle properties.

template<typename T>
std::shared_ptr<SymVector<T>> sym_vector(ParticleGroupSharedPtr particle_group, std::vector<Sym<T>> syms)#

Helper function to create a SymVector.

Parameters:
  • particle_groupParticleGroup to use.

  • syms – Vector of Syms to use from particle_group.

template<typename T>
std::shared_ptr<SymVector<T>> sym_vector(ParticleGroupSharedPtr particle_group, std::initializer_list<Sym<T>> syms)#

Helper function to create a SymVector.

Parameters:
  • particle_groupParticleGroup to use.

  • syms – Syms to use from particle_group.

inline void reset_mpi_ranks(ParticleDatSharedPtr<INT> mpi_rank_dat)#

Set all components 0 and 1 of particles to -1 in the passed ParticleDat.

Parameters:

mpi_rank_dat – ParticleDat containing MPI ranks to reset.

inline std::shared_ptr<DummyLocalMapperT> DummyLocalMapper()#
template<typename KERNEL, typename ...ARGS>
inline ParticleLoopSharedPtr particle_loop(ParticleGroupSharedPtr particle_group, KERNEL kernel, ARGS... args)#

Create a ParticleLoop that executes a kernel for all particles in the ParticleGroup.

Parameters:
  • particle_groupParticleGroup to execute kernel for all particles.

  • kernel – Kernel to execute for all particles in the ParticleGroup.

  • args – The remaining arguments are arguments to be passed to the kernel. All arguments must be wrapped in an access descriptor type.

template<typename KERNEL, typename ...ARGS>
inline ParticleLoopSharedPtr particle_loop(const std::string name, ParticleGroupSharedPtr particle_group, KERNEL kernel, ARGS... args)#

Create a ParticleLoop that executes a kernel for all particles in the ParticleGroup.

Parameters:
  • name – Identifier for particle loop.

  • particle_groupParticleGroup to execute kernel for all particles.

  • kernel – Kernel to execute for all particles in the ParticleGroup.

  • args – The remaining arguments are arguments to be passed to the kernel. All arguments must be wrapped in an access descriptor type.

template<typename DAT_TYPE, typename KERNEL, typename ...ARGS>
inline ParticleLoopSharedPtr particle_loop(ParticleDatSharedPtr<DAT_TYPE> particle_dat, KERNEL kernel, ARGS... args)#

Create a ParticleLoop that executes a kernel for all particles in the ParticleDat.

Parameters:
  • particle_dat – ParticleDat to define the iteration set.

  • kernel – Kernel to execute for all particles in the ParticleGroup.

  • args – The remaining arguments are arguments to be passed to the kernel. All arguments must be wrapped in an access descriptor type.

template<typename DAT_TYPE, typename KERNEL, typename ...ARGS>
inline ParticleLoopSharedPtr particle_loop(const std::string name, ParticleDatSharedPtr<DAT_TYPE> particle_dat, KERNEL kernel, ARGS... args)#

Create a ParticleLoop that executes a kernel for all particles in the ParticleDat.

Parameters:
  • name – Identifier for particle loop.

  • particle_dat – ParticleDat to define the iteration set.

  • kernel – Kernel to execute for all particles in the ParticleGroup.

  • args – The remaining arguments are arguments to be passed to the kernel. All arguments must be wrapped in an access descriptor type.

inline void parallel_advection_initialisation(ParticleGroupSharedPtr particle_group, const int num_steps = 20)#

Initialisation utility to aid parallel creation of particle distributions. This function performs the all-to-all movement that occurs when a ParticleGroup contains particles with positions (far) outside the owned region of space. For example consider if each MPI rank creates N particles uniformly distributed over the entire simulation domain then the call to hybrid_move would have a cost equal to the number of MPI ranks squared.

This function gives each particle a temporary position in the owned subdomain then moves the particles in a straight line to the original positions in the positions ParticleDat. It is assumed that the simulation domain is convex.

This function is used by adding particles with ParticleGroup.add_particles_local on each rank then collectively calling this function.

Parameters:
  • particle_groupParticleGroup to initialise by moving particles to the positions in the position ParticleDat.

  • num_steps – optional number of steps to move particles over.

template<typename T>
inline ParticleDatSharedPtr<T> ParticleDat(SYCLTargetSharedPtr sycl_target, const Sym<T> sym, int ncomp, int ncell, bool positions = false)#
template<typename T>
inline ParticleDatSharedPtr<T> ParticleDat(SYCLTargetSharedPtr sycl_target, ParticleProp<T> prop, int ncell)#
inline std::string fixed_width_format(INT value)#
inline std::string fixed_width_format(REAL value)#
template<typename PARENT, typename KERNEL, typename ...ARGS>
inline ParticleSubGroupSharedPtr particle_sub_group(std::shared_ptr<PARENT> parent, KERNEL kernel, ARGS... args)#

Create a ParticleSubGroup based on a kernel and arguments. The selector kernel must be a lambda which returns true for particles which are in the sub group and false for particles which are not in the sub group. The arguments for the selector kernel must be read access Syms, i.e. Access::read(Sym<T>(“name”)).

For example if A is a ParticleGroup with an INT ParticleProp “ID” that holds particle ids then the following line creates a ParticleSubGroup from the particles with even ids.

auto A_even = std::make_shared<ParticleSubGroup>( A, [=](auto ID) { return ((ID[0] % 2) == 0); }, Access::read(Sym<INT>(“ID”)));

Parameters:
template<typename PARENT>
inline ParticleSubGroupSharedPtr particle_sub_group(std::shared_ptr<PARENT> parent)#

Create a ParticleSubGroup which is simply a reference/view into an entire ParticleGroup. This constructor creates a sub-group which is equivalent to

auto A_all = std::make_shared<ParticleSubGroup>( A, [=]() { return true; } );

but can make additional optimisations.

Parameters:

parent – Parent ParticleGroup or ParticleSubGroup from which to form ParticleSubGroup.

template<typename PARENT, typename KERNEL, typename ...ARGS>
inline ParticleSubGroupSharedPtr static_particle_sub_group(std::shared_ptr<PARENT> parent, KERNEL kernel, ARGS... args)#

Create a static ParticleSubGroup based on a kernel and arguments. The selector kernel must be a lambda which returns true for particles which are in the sub group and false for particles which are not in the sub group. The arguments for the selector kernel must be read access Syms, i.e. Access::read(Sym<T>(“name”)).

For example if A is a ParticleGroup with an INT ParticleProp “ID” that holds particle ids then the following line creates a ParticleSubGroup from the particles with even ids.

auto A_even = std::make_shared<ParticleSubGroup>( A, [=](auto ID) { return ((ID[0] % 2) == 0); }, Access::read(Sym<INT>(“ID”)));

Parameters:
template<typename PARENT>
inline ParticleSubGroupSharedPtr static_particle_sub_group(std::shared_ptr<PARENT> parent)#

Create a static ParticleSubGroup which is simply a reference/view into an entire ParticleGroup. This constructor creates a sub-group which is equivalent to

auto A_all = std::make_shared<ParticleSubGroup>( A, [=]() { return true; } );

but can make additional optimisations.

Parameters:

parent – Parent ParticleGroup or ParticleSubGroup from which to form ParticleSubGroup.

template<typename KERNEL, typename ...ARGS>
inline ParticleLoopSharedPtr particle_loop(ParticleSubGroupSharedPtr particle_group, KERNEL kernel, ARGS... args)#

Create a ParticleLoop that executes a kernel for all particles in the ParticleSubGroup.

Parameters:
  • particle_groupParticleSubGroup to execute kernel for all particles.

  • kernel – Kernel to execute for all particles in the ParticleSubGroup.

  • args – The remaining arguments are arguments to be passed to the kernel. All arguments must be wrapped in an access descriptor type.

template<typename KERNEL, typename ...ARGS>
inline ParticleLoopSharedPtr particle_loop(const std::string name, ParticleSubGroupSharedPtr particle_group, KERNEL kernel, ARGS... args)#

Create a ParticleLoop that executes a kernel for all particles in the ParticleSubGroup.

Parameters:
  • name – Identifier for particle loop.

  • particle_groupParticleSubGroup to execute kernel for all particles.

  • kernel – Kernel to execute for all particles in the ParticleSubGroup.

  • args – The remaining arguments are arguments to be passed to the kernel. All arguments must be wrapped in an access descriptor type.

inline std::chrono::high_resolution_clock::time_point profile_timestamp()#

Get a time stamp that can be used with profile_elapsed.

Returns:

Time stamp.

inline double profile_elapsed(std::chrono::high_resolution_clock::time_point time_start, std::chrono::high_resolution_clock::time_point time_end)#

Compute and return the time in seconds between two time stamps created with profile_timestamp.

Parameters:
  • time_start – Start time stamp.

  • time_end – End time stamp.

Returns:

Elapsed time in seconds between time stamps.

static inline int reduce_mul(const int nel, std::vector<int> &values)#
inline void neso_particles_assert(const char *expr_str, bool expr, const char *file, int line, const char *msg)#

This is a helper function to assert conditions are satisfied and terminate execution if not. An error is output on stderr and MPI_Abort is called if MPI is initialised. Users should call the corresponding helper macro NESOASSERT like

NESOASSERT(conditional, message);

To check conditionals within their code.

Parameters:
  • expr_str – A string identifying the conditional to check.

  • expr – Bool resulting from the evaluation of the expression.

  • file – Filename containing the call to neso_particles_assert.

  • line – Line number for the call to neso_particles assert.

  • msg – Message to print to stderr on evaluation of conditional to false.

inline void neso_particles_warn(const char *expr_str, bool expr, const char *file, int line, const char *msg)#

This is a helper function to assert conditions are satisfied and print to stderr if not. A warning is output on stderr. Users should call the corresponding helper macro NESOWARN like

NESOWARN(conditional, message);

To check conditionals within their code.

Parameters:
  • expr_str – A string identifying the conditional to check.

  • expr – Bool resulting from the evaluation of the expression.

  • file – Filename containing the call to neso_particles_assert.

  • line – Line number for the call to neso_particles assert.

  • msg – Message to print to stderr on evaluation of conditional to false.

template<typename T>
inline std::vector<size_t> reverse_argsort(const std::vector<T> &array)#
template<typename T>
void get_decomp_1d(const T N_compute_units, const T N_work_items, const T work_unit, T *rstart, T *rend)#
template<typename T>
inline T get_min_power_of_two(const T N_work_items, const size_t max_size)#
template<typename U>
inline void nprint_recurse(int flag, U next)#
template<typename U, typename ...T>
inline void nprint_recurse(int flag, U next, T... args)#
template<typename ...T>
inline void nprint(T... args)#
inline int get_required_mpi_thread_level()#

Get the MPI thread level required by NESO-Particles. MPI should be initialised by calling MPI_Init_thread with a required thread level greater than or equal to the value returned by this function.

Returns:

MPI thread level.

inline void test_provided_thread_level(const int level)#

Test that a provided MPI thread level is sufficient for NESO-Particles.

Parameters:

level – Provided thread level.

inline void initialise_mpi(int *argc, char ***argv)#

Helper function to initialise MPI and check that the provided thread level is sufficient. Calling this function is equivalent to calling MPI_Init_thread with the required thread level from get_required_mpi_thread_level and checking the provided thread level is equal to or greater than this required level.

Parameters:
  • argc – Pointer to the number of arguments.

  • argv – Argument vector.

template<typename RNG>
inline std::vector<std::vector<double>> uniform_within_extents(const int N, const int ndim, const double *extents, RNG &rng)#

Create a uniform distribution of particle positions within a set of extents.

Parameters:
  • N – Number of points to generate.

  • ndim – Number of dimensions.

  • extents – Extent of each of the dimensions.

  • rng – RNG to use.

Returns:

(N)x(ndim) set of positions stored for each column.

template<typename RNG>
inline std::vector<std::vector<double>> normal_distribution(const int N, const int ndim, const double mu, const double sigma, RNG &rng)#

Create (N)x(ndim) set of samples from a Gaussian distribution.

Parameters:
  • N – Number of points to generate.

  • ndim – Number of dimensions.

  • mu – Mean to use for Gaussian distribution.

  • sigma – Sigma to use for Gaussian distribution.

  • rng – RNG to use.

Returns:

(N)x(ndim) set of samples stored per column.

inline std::vector<std::vector<double>> uniform_within_extents(const int N, const int ndim, const double *extents)#

Create a uniform distribution of particle positions within a set of extents.

Parameters:
  • N – Number of points to generate.

  • ndim – Number of dimensions.

  • extents – Extent of each of the dimensions.

Returns:

(N)x(ndim) set of positions stored for each column.

inline std::vector<std::vector<double>> normal_distribution(const int N, const int ndim, const double mu, const double sigma)#

Create (N)x(ndim) set of samples from a Gaussian distribution.

Parameters:
  • N – Number of points to generate.

  • ndim – Number of dimensions.

  • mu – Mean to use for Gaussian distribution.

  • sigma – Sigma to use for Gaussian distribution.

Returns:

(N)x(ndim) set of samples stored per column.

inline void uniform_within_cartesian_cells(CartesianHMeshSharedPtr mesh, const int npart_per_cell, std::vector<std::vector<double>> &positions, std::vector<int> &cells, std::optional<std::mt19937> rng_in = std::nullopt)#

Helper function to quickly initialise a uniform distribution of particles on a CartesianHMesh.

Parameters:
  • mesh[in] CartesianHMesh on which to spawn particles.

  • npart_per_cell[in] Number of particle positions to sample for each mesh cell.

  • positions[inout] Ouput particle positions indexed by dimension then particle.

  • cells[inout] Ouput particle cell ids indexed by dimension then particle.

  • rng_in[in] Optional input RNG to use.

Variables

const int mask = std::numeric_limits<int>::min()#
namespace Particles
namespace Particles
namespace Particles
namespace Access#

Types and functions relating to access descriptors for loops.

Functions

template<typename T>
inline Read<T> read(T t)#

Helper function that allows a loop to be constructed with a read-only parameter passed like:

Access::read(object)

Parameters:

t – Object to pass with read-only access.

Returns:

Access::Read object that wraps passed object.

template<typename T>
inline Write<T> write(T t)#

Helper function that allows a loop to be constructed with a write parameter passed like:

Access::write(object)

Parameters:

t – Object to pass with write access.

Returns:

Access::Write object that wraps passed object.

template<typename T>
inline Add<T> add(T t)#

Helper function that allows a loop to be constructed with a write parameter which is atomic addition passed like:

Access::add(object)

Parameters:

t – Object to pass with atomic add access.

Returns:

Access::Add object that wraps passed object.

template<typename T>
inline Min<T> min(T t)#

Helper function that allows a loop to be constructed with a write parameter which is atomic minimum passed like:

Access::min(object)

Parameters:

t – Object to pass with atomic min access.

Returns:

Access::Min object that wraps passed object.

template<typename T>
inline Max<T> max(T t)#

Helper function that allows a loop to be constructed with a write parameter which is atomic maximum passed like:

Access::max(object)

Parameters:

t – Object to pass with atomic max access.

Returns:

Access::Max object that wraps passed object.

namespace CellDat#

Defines the access implementations and types for CellDat objects.

namespace CellDatConst#

Defines the access implementations and types for CellDatConst objects.

namespace DescendantProducts#

Defines the access implementations and types for DescendantProducts objects.

namespace GlobalArray#

Defines the access implementations and types for GlobalArray objects.

namespace LocalArray#

Defines the access implementations and types for LocalArray objects.

namespace LoopIndex#

Defines the access type for the cell, layer indexing.

namespace ParticleDat#

Defines the access implementations and types for ParticleDat objects.

namespace ProductMatrix#

Defines the access implementations and types for ProductMatrix objects.

namespace SymVector#

Defines the access implementations and types for ParticleDat objects.

namespace ParticleLoopImplementation#

Functions

template<typename T>
inline void create_kernel_arg(ParticleLoopIteration &iterationx, T *const *const *&rhs, Access::CellDat::Read<T> &lhs)#
template<typename T>
inline void create_kernel_arg(ParticleLoopIteration &iterationx, T ***&rhs, Access::CellDat::Write<T> &lhs)#
template<typename T>
inline void create_kernel_arg(ParticleLoopIteration &iterationx, T ***&rhs, Access::CellDat::Add<T> &lhs)#
template<typename T>
inline T *const *const *create_loop_arg(ParticleLoopGlobalInfo *global_info, sycl::handler &cgh, Access::Read<CellDat<T>*> &a)#
template<typename T>
inline T ***create_loop_arg(ParticleLoopGlobalInfo *global_info, sycl::handler &cgh, Access::Write<CellDat<T>*> &a)#
template<typename T>
inline T ***create_loop_arg(ParticleLoopGlobalInfo *global_info, sycl::handler &cgh, Access::Add<CellDat<T>*> &a)#
template<typename T>
inline void create_kernel_arg(ParticleLoopIteration &iterationx, CellDatConstDeviceTypeConst<T> &rhs, Access::CellDatConst::Read<T> &lhs)#

Function to create the kernel argument for CellDatConst read access.

template<typename T>
inline void create_kernel_arg(ParticleLoopIteration &iterationx, CellDatConstDeviceType<T> &rhs, Access::CellDatConst::Add<T> &lhs)#

Function to create the kernel argument for CellDatConst add access.

template<typename T>
inline void create_kernel_arg(ParticleLoopIteration &iterationx, CellDatConstDeviceType<T> &rhs, Access::CellDatConst::Min<T> &lhs)#

Function to create the kernel argument for CellDatConst min access.

template<typename T>
inline void create_kernel_arg(ParticleLoopIteration &iterationx, CellDatConstDeviceType<T> &rhs, Access::CellDatConst::Max<T> &lhs)#

Function to create the kernel argument for CellDatConst max access.

template<typename T>
inline CellDatConstDeviceTypeConst<T> create_loop_arg(ParticleLoopGlobalInfo *global_info, sycl::handler &cgh, Access::Read<CellDatConst<T>*> &a)#

Method to compute access to a CellDatConst (read)

template<typename T>
inline CellDatConstDeviceType<T> create_loop_arg(ParticleLoopGlobalInfo *global_info, sycl::handler &cgh, Access::Add<CellDatConst<T>*> &a)#

Method to compute access to a CellDatConst (add)

template<typename T>
inline CellDatConstDeviceType<T> create_loop_arg(ParticleLoopGlobalInfo *global_info, sycl::handler &cgh, Access::Min<CellDatConst<T>*> &a)#

Method to compute access to a CellDatConst (min)

template<typename T>
inline CellDatConstDeviceType<T> create_loop_arg(ParticleLoopGlobalInfo *global_info, sycl::handler &cgh, Access::Max<CellDatConst<T>*> &a)#

Method to compute access to a CellDatConst (max)

inline void create_kernel_arg(ParticleLoopIteration &iterationx, DescendantProductsGet &rhs, Access::DescendantProducts::Write &lhs)#

Function to create the kernel argument for DescendantProducts write access.

inline DescendantProductsGet create_loop_arg(ParticleLoopGlobalInfo *global_info, sycl::handler &cgh, Access::Write<DescendantProducts*> &a)#

Method to compute access to a DescendantProducts (write)

template<typename T>
inline void create_kernel_arg(ParticleLoopIteration &iterationx, T const *rhs, Access::GlobalArray::Read<T> &lhs)#

Function to create the kernel argument for GlobalArray read access.

template<typename T>
inline void create_kernel_arg(ParticleLoopIteration &iterationx, T *rhs, Access::GlobalArray::Add<T> &lhs)#

Function to create the kernel argument for GlobalArray add access.

template<typename T>
inline void post_loop(ParticleLoopGlobalInfo *global_info, Access::Add<GlobalArray<T>*> &arg)#

Post loop execution function for GlobalArray write.

template<typename T>
inline GlobalArrayImplGetConstT<T> create_loop_arg(ParticleLoopGlobalInfo *global_info, sycl::handler &cgh, Access::Read<GlobalArray<T>*> &a)#

Method to compute access to a GlobalArray (read)

template<typename T>
inline GlobalArrayImplGetT<T> create_loop_arg(ParticleLoopGlobalInfo *global_info, sycl::handler &cgh, Access::Add<GlobalArray<T>*> &a)#

Method to compute access to a GlobalArray (add)

template<typename T>
inline void create_kernel_arg(ParticleLoopIteration &iterationx, T const *rhs, Access::LocalArray::Read<T> &lhs)#

Function to create the kernel argument for LocalArray read access.

template<typename T>
inline void create_kernel_arg(ParticleLoopIteration &iterationx, T *rhs, Access::LocalArray::Write<T> &lhs)#

Function to create the kernel argument for LocalArray write access.

template<typename T>
inline void create_kernel_arg(ParticleLoopIteration &iterationx, T *rhs, Access::LocalArray::Add<T> &lhs)#

Function to create the kernel argument for LocalArray add access.

template<typename T>
inline LocalArrayImplGetConstT<T> create_loop_arg(ParticleLoopGlobalInfo *global_info, sycl::handler &cgh, Access::Read<LocalArray<T>*> &a)#

Method to compute access to a LocalArray (read)

template<typename T>
inline LocalArrayImplGetT<T> create_loop_arg(ParticleLoopGlobalInfo *global_info, sycl::handler &cgh, Access::Write<LocalArray<T>*> &a)#

Method to compute access to a LocalArray (write)

template<typename T>
inline LocalArrayImplGetT<T> create_loop_arg(ParticleLoopGlobalInfo *global_info, sycl::handler &cgh, Access::Add<LocalArray<T>*> &a)#

Method to compute access to a LocalArray (add)

inline void create_kernel_arg(ParticleLoopIteration &iterationx, ProductMatrixGetConst &rhs, Access::ProductMatrix::Read &lhs)#

Function to create the kernel argument for ProductMatrix read access.

template<typename T>
inline void create_kernel_arg(ParticleLoopIteration &iterationx, ProductMatrixGet &rhs, T &lhs)#

Function to create the kernel argument for ProductMatrix write/add access.

inline ProductMatrixGetConst create_loop_arg(ParticleLoopGlobalInfo *global_info, sycl::handler &cgh, Access::Read<ProductMatrix*> &a)#

Method to compute access to a ProductMatrix (read)

inline ProductMatrixGet create_loop_arg(ParticleLoopGlobalInfo *global_info, sycl::handler &cgh, Access::Write<ProductMatrix*> &a)#

Method to compute access to a ProductMatrix (write)

inline ProductMatrixGet create_loop_arg(ParticleLoopGlobalInfo *global_info, sycl::handler &cgh, Access::Add<ProductMatrix*> &a)#

Method to compute access to a ProductMatrix (add)

template<typename T>
inline SymVectorImplGetConstT<T> create_loop_arg(ParticleLoopGlobalInfo *global_info, sycl::handler &cgh, Access::Read<SymVector<T>*> &a)#

Method to compute access to a SymVector (read).

template<typename T>
inline SymVectorImplGetT<T> create_loop_arg(ParticleLoopGlobalInfo *global_info, sycl::handler &cgh, Access::Write<SymVector<T>*> &a)#

Method to compute access to a SymVector (write).

template<typename T>
inline void create_kernel_arg(ParticleLoopIteration &iterationx, T *const *const **rhs, Access::SymVector::Read<T> &lhs)#

Function to create the kernel argument for SymVector read access.

template<typename T>
inline void create_kernel_arg(ParticleLoopIteration &iterationx, T ****rhs, Access::SymVector::Write<T> &lhs)#

Function to create the kernel argument for SymVector write access.

template<typename T>
inline void post_loop(ParticleLoopGlobalInfo *global_info, T &arg)#

The functions to run for each argument to the kernel post loop completion. Default post loop execution function.

inline ParticleLoopIndexKernelT create_loop_arg(ParticleLoopImplementation::ParticleLoopGlobalInfo *global_info, sycl::handler &cgh, Access::Read<ParticleLoopIndex*> &a)#

Method to compute access to a ParticleLoopIndex (read)

inline void create_kernel_arg(ParticleLoopIteration &iterationx, ParticleLoopIndexKernelT &rhs, Access::LoopIndex::Read &lhs)#

Function to create the kernel argument for ParticleLoopIndex read access.

template<typename T>
inline ParticleDatImplGetConstT<T> create_loop_arg(ParticleLoopGlobalInfo *global_info, sycl::handler &cgh, Access::Read<Sym<T>*> &a)#

Method to compute access to a particle dat (read) - via Sym.

template<typename T>
inline ParticleDatImplGetT<T> create_loop_arg(ParticleLoopGlobalInfo *global_info, sycl::handler &cgh, Access::Write<Sym<T>*> &a)#

Method to compute access to a particle dat (write) - via Sym

template<typename T>
inline ParticleDatImplGetConstT<T> create_loop_arg(ParticleLoopGlobalInfo *global_info, sycl::handler &cgh, Access::Read<ParticleDatT<T>*> &a)#

Method to compute access to a particle dat (read).

template<typename T>
inline ParticleDatImplGetT<T> create_loop_arg(ParticleLoopGlobalInfo *global_info, sycl::handler &cgh, Access::Write<ParticleDatT<T>*> &a)#

Method to compute access to a particle dat (write).

template<typename T>
inline void create_kernel_arg(ParticleLoopIteration &iterationx, T *const *const *rhs, Access::ParticleDat::Read<T> &lhs)#

Function to create the kernel argument for ParticleDat read access.

template<typename T>
inline void create_kernel_arg(ParticleLoopIteration &iterationx, T ***rhs, Access::ParticleDat::Write<T> &lhs)#

Function to create the kernel argument for ParticleDat write access.

namespace ParticleSubGroupImplementation#
namespace Tuple#

Functions

template<size_t INDEX, typename ...U>
auto &get(Tuple<U...> &u)#
template<size_t INDEX, typename ...U>
const auto &get(const Tuple<U...> &u)#
template<typename KERNEL, size_t... S, typename ...ARGS>
auto apply_inner(KERNEL &kernel, IntSequence<S...>, Tuple<ARGS...> &args)#
template<typename KERNEL, typename ...ARGS>
auto apply(KERNEL kernel, Tuple<ARGS...> &args)#
namespace std#
file access.hpp
#include “typedefs.hpp
file boundary_conditions.hpp
#include <CL/sycl.hpp>
#include <cmath>
#include “domain.hpp
#include “loop/particle_loop.hpp
#include “particle_dat.hpp
#include “profiling.hpp
#include “typedefs.hpp
#include <memory>
file cartesian_mesh.hpp
#include <CL/sycl.hpp>
#include <memory>
#include <mpi.h>
#include “compute_target.hpp
#include “local_mapping.hpp
#include “loop/particle_loop.hpp
#include “particle_dat.hpp
#include “particle_group.hpp
#include “profiling.hpp
#include “typedefs.hpp
file cell_binning.hpp
#include <CL/sycl.hpp>
#include <cmath>
#include “domain.hpp
#include “loop/particle_loop.hpp
#include “particle_dat.hpp
#include “profiling.hpp
#include “typedefs.hpp
file cell_dat.hpp
#include “containers/cell_dat.hpp
#include “containers/cell_data.hpp
file cell_dat.hpp
#include “cell_data.hpp
file cell_dat_compression.hpp
#include <CL/sycl.hpp>
#include <cstdint>
#include <map>
#include <memory>
#include <mpi.h>
#include <string>
#include “cell_dat.hpp
#include “compute_target.hpp
#include “particle_dat.hpp
#include “particle_set.hpp
#include “particle_spec.hpp
#include “profiling.hpp
#include “typedefs.hpp
file cell_dat_move.hpp
#include <CL/sycl.hpp>
#include <cstdint>
#include <map>
#include <memory>
#include <mpi.h>
#include <string>
#include “cell_dat.hpp
#include “cell_dat_compression.hpp
#include “compute_target.hpp
#include “error_propagate.hpp
#include “particle_dat.hpp
#include “particle_set.hpp
#include “particle_spec.hpp
#include “profiling.hpp
#include “typedefs.hpp
file cell_dat_move_impl.hpp
#include “cell_dat_move.hpp
#include “loop/particle_loop.hpp
file communication.hpp
#include “typedefs.hpp
#include <mpi.h>

Defines

_MACRO_STRING(x)#
STR(x)#
MPICHK(cmd)#
file compute_target.hpp
#include <cstdlib>
#include <CL/sycl.hpp>
#include <array>
#include <map>
#include <mpi.h>
#include <stack>
#include <string>
#include <vector>
#include “communication.hpp
#include “profiling.hpp
#include “typedefs.hpp
file blocked_binary_tree.hpp
#include “compute_target.hpp
#include <map>
#include <set>
#include <type_traits>
file cell_dat_const.hpp
#include “cell_data.hpp
file cell_data.hpp
#include “../compute_target.hpp
file descendant_products.hpp
#include “../compute_target.hpp
#include “../particle_spec.hpp
#include “product_matrix.hpp
file global_array.hpp
#include “../compute_target.hpp
#include “../typedefs.hpp
#include “../communication.hpp
#include <memory>
#include <mpi.h>
#include <optional>
#include <vector>
file local_array.hpp
#include “../compute_target.hpp
#include <memory>
#include <optional>
#include <vector>
file product_matrix.hpp
#include “../compute_target.hpp
#include “../particle_spec.hpp
#include <map>
#include <memory>
#include <numeric>
#include <optional>
#include <vector>
file sym_vector.hpp
#include “../compute_target.hpp
#include “../particle_group.hpp
#include “../particle_spec.hpp
#include <initializer_list>
#include <memory>
#include <vector>
file tuple.hpp
#include <cstdlib>
file departing_particle_identification.hpp
#include <CL/sycl.hpp>
#include <mpi.h>
#include “communication.hpp
#include “compute_target.hpp
#include “particle_dat.hpp
#include “profiling.hpp
#include “typedefs.hpp
file departing_particle_identification_impl.hpp
#include “loop/particle_loop.hpp
file domain.hpp
#include “compute_target.hpp
#include “local_mapping.hpp
#include “mesh_hierarchy.hpp
#include “mesh_interface.hpp
#include “particle_dat.hpp
#include “typedefs.hpp
#include <cstdint>
#include <cstdlib>
#include <mpi.h>
#include <set>
#include <vector>
file error_propagate.hpp
#include “compute_target.hpp

Defines

NESO_KERNEL_ASSERT(expr, ep_ptr)#
file global_mapping.hpp
#include <CL/sycl.hpp>
#include <mpi.h>
#include “domain.hpp
#include “error_propagate.hpp
#include “particle_dat.hpp
#include “profiling.hpp
#include “typedefs.hpp
file global_mapping_impl.hpp
#include “global_mapping.hpp
#include “loop/particle_loop.hpp
file global_move.hpp
#include <CL/sycl.hpp>
#include <mpi.h>
#include “cell_dat_compression.hpp
#include “communication.hpp
#include “compute_target.hpp
#include “global_move_exchange.hpp
#include “packing_unpacking.hpp
#include “profiling.hpp
#include “typedefs.hpp
file global_move_exchange.hpp
#include <CL/sycl.hpp>
#include <mpi.h>
#include “communication.hpp
#include “compute_target.hpp
#include “packing_unpacking.hpp
#include “profiling.hpp
#include “typedefs.hpp
file local_mapping.hpp
#include <CL/sycl.hpp>
#include <memory>
#include <mpi.h>
#include “compute_target.hpp
#include “particle_dat.hpp
#include “profiling.hpp
#include “typedefs.hpp
file local_move.hpp
#include <CL/sycl.hpp>
#include <mpi.h>
#include <set>
#include <vector>
#include “cell_dat_compression.hpp
#include “communication.hpp
#include “compute_target.hpp
#include “packing_unpacking.hpp
#include “profiling.hpp
#include “typedefs.hpp
file access_descriptors.hpp
file particle_loop.hpp
#include “../cell_dat.hpp
#include “../compute_target.hpp
#include “../containers/tuple.hpp
#include “../particle_dat.hpp
#include “../particle_spec.hpp
#include “particle_loop_base.hpp
#include “particle_loop_index.hpp
#include “pli_particle_dat.hpp
#include <CL/sycl.hpp>
#include <cstdlib>
#include <optional>
#include <string>
#include <tuple>
#include <typeinfo>
#include <vector>
file particle_loop_base.hpp
#include “../compute_target.hpp
#include “access_descriptors.hpp
#include <memory>
#include <optional>
file particle_loop_index.hpp
#include “../particle_group.hpp
#include “particle_loop_base.hpp
file pli_particle_dat.hpp
#include “../particle_group.hpp
file mesh_hierarchy.hpp
#include “communication.hpp
#include “compute_target.hpp
#include “profiling.hpp
#include “typedefs.hpp
#include <cmath>
#include <cstdint>
#include <cstdlib>
#include <memory>
#include <mpi.h>
#include <stack>
#include <utility>
#include <vector>
file mesh_interface.hpp
#include “mesh_hierarchy.hpp
#include “typedefs.hpp
#include <array>
#include <cstdint>
#include <cstdlib>
#include <memory>
#include <mpi.h>
#include <set>
#include <vector>
file mesh_interface_local_decomp.hpp
#include “mesh_interface.hpp
#include “typedefs.hpp
#include <cstdint>
#include <cstdlib>
#include <memory>
#include <mpi.h>
#include <set>
#include <vector>
file neso_particles.hpp
#include <memory>
#include “access.hpp
#include “boundary_conditions.hpp
#include “cartesian_mesh.hpp
#include “cell_binning.hpp
#include “cell_dat.hpp
#include “compute_target.hpp
#include “containers/tuple.hpp
#include “domain.hpp
#include “error_propagate.hpp
#include “global_mapping.hpp
#include “local_mapping.hpp
#include “local_move.hpp
#include “loop/particle_loop.hpp
#include “mesh_hierarchy.hpp
#include “mesh_interface.hpp
#include “particle_dat.hpp
#include “particle_group.hpp
#include “particle_io.hpp
#include “particle_remover.hpp
#include “particle_set.hpp
#include “particle_spec.hpp
#include “particle_sub_group.hpp
#include “profiling.hpp
#include “typedefs.hpp
#include “utility.hpp
#include “cell_dat_move_impl.hpp
#include “global_mapping_impl.hpp
#include “particle_group_impl.hpp
file packing_unpacking.hpp
#include <CL/sycl.hpp>
#include <cstdint>
#include <map>
#include <memory>
#include <mpi.h>
#include <stack>
#include <string>
#include “compute_target.hpp
#include “particle_dat.hpp
#include “profiling.hpp
#include “typedefs.hpp
file parallel_initialisation.hpp
#include “loop/particle_loop.hpp
#include “particle_group.hpp
#include <memory>
file particle_dat.hpp
#include <CL/sycl.hpp>
#include <cmath>
#include <functional>
#include <limits>
#include <memory>
#include “access.hpp
#include “cell_dat.hpp
#include “compute_target.hpp
#include “particle_set.hpp
#include “particle_spec.hpp
#include “typedefs.hpp
file particle_group.hpp
#include <CL/sycl.hpp>
#include <cstdint>
#include <map>
#include <memory>
#include <mpi.h>
#include <string>
#include “access.hpp
#include “cell_dat.hpp
#include “cell_dat_compression.hpp
#include “cell_dat_move.hpp
#include “compute_target.hpp
#include “domain.hpp
#include “global_mapping.hpp
#include “global_move.hpp
#include “local_move.hpp
#include “packing_unpacking.hpp
#include “particle_dat.hpp
#include “particle_set.hpp
#include “particle_spec.hpp
#include “profiling.hpp
#include “typedefs.hpp
file particle_group_impl.hpp
#include “global_mapping.hpp
#include “particle_group.hpp
#include “particle_sub_group.hpp
file particle_io.hpp
#include “particle_group.hpp
#include “particle_spec.hpp
#include “typedefs.hpp
#include <algorithm>
#include <cstdint>
#include <cstring>
#include <mpi.h>
#include <string>
file particle_remover.hpp
#include “compute_target.hpp
#include “loop/particle_loop.hpp
#include “particle_dat.hpp
#include “particle_group.hpp
#include “typedefs.hpp
file particle_set.hpp
#include <cstdint>
#include <map>
#include <string>
#include <vector>
#include “access.hpp
#include “compute_target.hpp
#include “particle_spec.hpp
#include “typedefs.hpp
file particle_spec.hpp
#include <cstdint>
#include <map>
#include <mpi.h>
#include <string>
#include <vector>
#include “typedefs.hpp
file particle_sub_group.hpp
#include “compute_target.hpp
#include “loop/particle_loop.hpp
#include “particle_group.hpp
#include “typedefs.hpp
#include <map>
#include <numeric>
#include <random>
#include <tuple>
#include <type_traits>
file profiling.hpp
#include <CL/sycl.hpp>
#include <chrono>
#include <cstdint>
#include <fstream>
#include <list>
#include <map>
#include <mpi.h>
#include <string>
#include “typedefs.hpp
file typedefs.hpp
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdlib>
#include <iostream>
#include <mpi.h>
#include <numeric>
#include <vector>

Defines

NESOASSERT(expr, msg)#

This is a helper macro to call the function neso_particles_assert. Users should call this helper macro NESOASSERT like

NESOASSERT(conditional, message);

To check conditionals within their code.

NESOWARN(expr, msg)#

This is a helper macro to call the function neso_particles_warn. Users should call this helper macro NESOWARN like

NESOWARN(conditional, message);

To check conditionals within their code.

MIN(x, y)#
MAX(x, y)#
ABS(x)#
NESO_PARTICLES_BLOCK_SIZE#
NESO_PARTICLES_DEVICE_LABEL#
NESO_PARTICLES_ITER_PARTICLES#
NESO_PARTICLES_KERNEL_START#
NESO_PARTICLES_KERNEL_END#
NESO_PARTICLES_KERNEL_CELL#
NESO_PARTICLES_KERNEL_LAYER#
DEBUG_OOB_WIDTH#
file utility.hpp
#include <cstdint>
#include <map>
#include <random>
#include <string>
#include <vector>
#include “access.hpp
#include “compute_target.hpp
#include “mesh_interface.hpp
#include “particle_spec.hpp
#include “typedefs.hpp
file utility_mesh_hierarchy_plotting.hpp
#include “mesh_hierarchy.hpp
#include “typedefs.hpp
#include <cstdint>
#include <fstream>
#include <iostream>
#include <map>
#include <string>
#include <tuple>
#include <vector>
dir /tmp/repo-checkout/NESO-Particles/include/containers
dir /tmp/repo-checkout/NESO-Particles/include
dir /tmp/repo-checkout/NESO-Particles/include/loop