seapodym-parallel
Fish dynamics models with parameter estimations
Loading...
Searching...
No Matches
DistDataCollector Class Reference

DistDataCollector is a class that collects data stored on multiple MPI processes into a large array stored on rank 0. More...

#include <DistDataCollector.h>

Public Member Functions

 DistDataCollector (MPI_Comm comm, int numChunks, int numSize)
 Constructor.
 ~DistDataCollector ()
 Destructor.
void startEpoch ()
 Start an epoch for RMA operations.
void flush ()
 Ensure that all RMA operations are completed.
void endEpoch ()
 End an epoch for RMA operations.
void put (int chunkId, const double *data)
 Put the local data into the collected array.
void putAsync (int chunkId, const double *data)
 Put the local data into the collected array (non-blocking)
std::vector< double > get (int chunkId)
 Get a slice of the remote, collected array to the local worker.
void get (int chunkId, double *buffer)
 Get a slice of the remote, collected array to the local worker.
void getAsync (int chunkId, double *buffer)
 Get a slice of the remote, collected array to the local worker (non-blocking)
double * getCollectedDataPtr ()
int getNumChunks () const
int getNumSize () const
void free ()
 Free the MPI window and empty the collected data.
 DistDataCollector (const DistDataCollector &)=delete
DistDataCollectoroperator= (const DistDataCollector &)=delete
 DistDataCollector (DistDataCollector &&other) noexcept
DistDataCollectoroperator= (DistDataCollector &&other) noexcept

Public Attributes

const double BAD_VALUE = std::numeric_limits<double>::quiet_NaN()

Detailed Description

DistDataCollector is a class that collects data stored on multiple MPI processes into a large array stored on rank 0.

Constructor & Destructor Documentation

◆ DistDataCollector()

DistDataCollector::DistDataCollector ( MPI_Comm comm,
int numChunks,
int numSize )

Constructor.

Parameters
commMPI communicator to use for communication
numChunksThe number of array slices on rank 0
numSizeThe size of each slice

Member Function Documentation

◆ get() [1/2]

std::vector< double > DistDataCollector::get ( int chunkId)

Get a slice of the remote, collected array to the local worker.

Parameters
chunkIdLeading index in the collected array
Returns
data array
Note
this should be executed on the source process, typically by the worker

◆ get() [2/2]

void DistDataCollector::get ( int chunkId,
double * buffer )

Get a slice of the remote, collected array to the local worker.

Parameters
chunkIdLeading index in the collected array
bufferwill hold the fetched data
Note
this should be executed on the source process, typically by the worker

◆ getAsync()

void DistDataCollector::getAsync ( int chunkId,
double * buffer )
inline

Get a slice of the remote, collected array to the local worker (non-blocking)

Parameters
chunkIdLeading index in the collected array
bufferwill hold the fetched data
Note
this should be executed on the source process, typically by the worker. This is a non-blocking call which relies on startEpoch/flush/endEpoch to complete

◆ getCollectedDataPtr()

double * DistDataCollector::getCollectedDataPtr ( )
inline

Get the pointer to the collected data

Returns
pointer
Note
this returns a null pointer on ranks other than 0

◆ getNumChunks()

int DistDataCollector::getNumChunks ( ) const
inline

Get the number of chunks

Returns
number

◆ getNumSize()

int DistDataCollector::getNumSize ( ) const
inline

Get the size of each chunk

Returns
number

◆ put()

void DistDataCollector::put ( int chunkId,
const double * data )

Put the local data into the collected array.

Parameters
chunkIdLeading index in the collected array
dataPointer to the local data to inject
Note
this should be executed on the source process, typically by the worker

◆ putAsync()

void DistDataCollector::putAsync ( int chunkId,
const double * data )
inline

Put the local data into the collected array (non-blocking)

Parameters
chunkIdLeading index in the collected array
dataPointer to the local data to inject
Note
this should be executed on the source process, typically by the worker This is a non-blocking call which relies on startEpoch/flush/endEpoch to

The documentation for this class was generated from the following files: