Doxygen API Reference#

See Original Doxygen output if preferred.

Sphinx API Reference#

template<typename T>
class BufferDevice#
#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 size_t size_bytes()#

Get the size of the allocation in bytes.

Returns:

size of buffer in bytes.

inline int realloc_no_copy(const 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 ~BufferDevice()#

Public Members

SYCLTargetSharedPtr sycl_target#

Compute device used by the instance.

T *ptr#

SYCL USM device pointer, only accessible on device.

size_t size#

Number of elements allocated.

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#
#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 size_t size_bytes()#

Get the size of the allocation in bytes.

Returns:

size of buffer in bytes.

inline int realloc_no_copy(const 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 ~BufferHost()#

Public Members

SYCLTargetSharedPtr sycl_target#

Compute device used by the instance.

T *ptr#

SYCL USM shared pointer, accessible on host and device.

size_t size#

Number of elements allocated.

template<typename T>
class BufferShared#
#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 size_t size_bytes()#

Get the size of the allocation in bytes.

Returns:

size of buffer in bytes.

inline int realloc_no_copy(const 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 ~BufferShared()#

Public Members

SYCLTargetSharedPtr sycl_target#

Compute device used by the instance.

T *ptr#

SYCL USM shared pointer, accessible on host and device.

size_t size#

Number of elements allocated.

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

Get the total number of cells in the mesh.

Returns:

Total number of mesh cells.

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.

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.

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 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#
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).

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

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.

Private Members

T ***d_ptr#
std::vector<T**> h_ptr_cells#
std::vector<T*> h_ptr_cols#
int nrow_max = -1#
EventStack stack_events#
std::stack<T*> stack_ptrs#
template<typename T>
class CellDataT#
#include <cell_dat.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 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.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 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.

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.

Private Members

T *d_ptr#
const int stride#
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 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#
#include <compute_target.hpp>

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#
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#

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.

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#
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#
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#
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.

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)#

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.

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.

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 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:

sym – Sym<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:

sym – Sym<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:
  • sym – Sym<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:
  • sym – Sym<INT> indicating which ParticleDat to access.

  • cell – Cell index to access.

Returns:

CellData for requested cell.

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

Parameters:

args – Sym<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

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.

Private Functions

template<typename T>
inline void realloc_dat(ParticleDatSharedPtr<T> &dat)#
template<typename T>
inline void push_particle_spec(ParticleProp<T> prop)#

Private Members

int ncell#
BufferHost<INT> h_npart_cell#
BufferDevice<INT> d_remove_cells#
BufferDevice<INT> d_remove_layers#
GlobalMove global_move_ctx#
std::shared_ptr<MeshHierarchyGlobalMap> mesh_hierarchy_global_map#
LocalMove local_move_ctx#
CellMove cell_move_ctx#
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***> 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#
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.

Public Members

const Sym<T> sym#

Symbol giving a label to the property.

const std::string name#

Name of the property.

const int ncomp#

Number of components required by this property.

const 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 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:

sym – Sym<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:

sym – Sym<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:

sym – Sym<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:

sym – Sym<INT> to test for.

Returns:

Bool indicating if data exists.

Public Members

const int npart#

Number of particles stored in the container.

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#
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 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.

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)#
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#
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.

Public Members

std::map<std::string, std::map<std::string, ProfileEntry>> profile#

Main data structure storing profiling data.

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#
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

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.

Public Members

const 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)#
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.

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::pair<std::tuple<INT, INT, INT>, std::tuple<INT, INT, INT>>> get_lines(std::tuple<INT, INT, INT> base)#

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#
namespace cl#
namespace NESO#
namespace Particles#

Typedefs

template<typename T>
using CellData = std::shared_ptr<CellDataT<T>>#
typedef std::shared_ptr<SYCLTarget> SYCLTargetSharedPtr#
typedef std::shared_ptr<Domain> DomainSharedPtr#
typedef std::shared_ptr<LocalMapper> LocalMapperSharedPtr#
typedef std::shared_ptr<HMesh> HMeshSharedPtr#
typedef std::shared_ptr<CartesianHMesh> CartesianHMeshSharedPtr#
template<typename T>
using ParticleDatSharedPtr = std::shared_ptr<ParticleDatT<T>>#
typedef std::shared_ptr<ParticleGroup> ParticleGroupSharedPtr#
typedef double REAL#
typedef int64_t INT#

Functions

inline std::shared_ptr<CartesianHMeshLocalMapperT> CartesianHMeshLocalMapper(SYCLTargetSharedPtr sycl_target, CartesianHMeshSharedPtr mesh)#
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.

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()#
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)#
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_particle_assert(const char *expr_str, bool expr, const char *file, int line, const char *msg)#
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 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)#
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.

Variables

const int mask = std::numeric_limits<int>::min()#
namespace Particles
namespace std#
file access.hpp
#include “typedefs.hpp
file boundary_conditions.hpp
#include <CL/sycl.hpp>
#include <cmath>
#include “domain.hpp
#include “particle_dat.hpp
#include “profiling.hpp
#include “typedefs.hpp
file cartesian_mesh.hpp
#include <CL/sycl.hpp>
#include <memory>
#include <mpi.h>
#include “compute_target.hpp
#include “local_mapping.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 “particle_dat.hpp
#include “profiling.hpp
#include “typedefs.hpp
file cell_dat.hpp
#include <CL/sycl.hpp>
#include <algorithm>
#include <cstdio>
#include <memory>
#include <stack>
#include <string>
#include <vector>
#include “access.hpp
#include “compute_target.hpp
#include “profiling.hpp
#include “typedefs.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 “compute_target.hpp
#include “particle_dat.hpp
#include “particle_set.hpp
#include “particle_spec.hpp
#include “profiling.hpp
#include “typedefs.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

Defines

NESO_KERNEL_ASSERT(expr, ep_ptr)#
file departing_particle_identification.hpp
#include <CL/sycl.hpp>
#include <mpi.h>
#include “communication.hpp
#include “compute_target.hpp
#include “profiling.hpp
#include “typedefs.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 global_mapping.hpp
#include <CL/sycl.hpp>
#include <mpi.h>
#include “domain.hpp
#include “particle_dat.hpp
#include “profiling.hpp
#include “typedefs.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 mesh_hierarchy.hpp
#include “communication.hpp
#include “compute_target.hpp
#include “profiling.hpp
#include “typedefs.hpp
#include <cmath>
#include <cstdint>
#include <cstdlib>
#include <mpi.h>
#include <stack>
#include <utility>
#include <vector>
file mesh_interface.hpp
#include “mesh_hierarchy.hpp
#include “typedefs.hpp
#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 “domain.hpp
#include “global_mapping.hpp
#include “local_mapping.hpp
#include “local_move.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 “profiling.hpp
#include “typedefs.hpp
#include “utility.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 “particle_group.hpp
#include <memory>
file particle_dat.hpp
#include <CL/sycl.hpp>
#include <cmath>
#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_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 “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 profiling.hpp
#include <CL/sycl.hpp>
#include <chrono>
#include <cstdint>
#include <map>
#include <mpi.h>
#include <string>
#include “typedefs.hpp
file typedefs.hpp
#include <algorithm>
#include <cstdint>
#include <cstdlib>
#include <iostream>
#include <numeric>
#include <vector>

Defines

RESTRICT#
NESOASSERT(expr, msg)#
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 “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