4#ifndef SEAPODYM_COURIER
5#define SEAPODYM_COURIER
8using Tuple3 = std::tuple<MPI_Win, double*, std::size_t>;
34 std::vector<double> dataRecv;
62 void expose(
double* data,
int data_size);
69 std::vector<double>
fetch(
int source_worker);
76 std::vector<double>
accumulate(
int targetWorker);
82 if (this->win != MPI_WIN_NULL) {
83 MPI_Win_free(&this->win);
85 if (this->winRecv != MPI_WIN_NULL) {
86 MPI_Win_free(&this->winRecv);
90 this->dataRecv.clear();
SeapodymCourier class for managing memory exposure and data fetching between MPI processes.
Definition SeapodymCourier.h:16
std::vector< double > accumulate(int targetWorker)
Accumulate the data from all workers.
Definition SeapodymCourier.cpp:66
void free()
Free the MPI window and reset the data pointer.
Definition SeapodymCourier.h:81
double * getDataPtr() const
Get the pointer to the exposed data.
Definition SeapodymCourier.h:55
std::vector< double > fetch(int source_worker)
Fetch data from a remote process and store it in the local data array.
Definition SeapodymCourier.cpp:40
~SeapodymCourier()
Destructor.
Definition SeapodymCourier.cpp:17
void expose(double *data, int data_size)
Expose the memory to other processes.
Definition SeapodymCourier.cpp:22
SeapodymCourier(MPI_Comm comm=MPI_COMM_WORLD)
Constructor.
Definition SeapodymCourier.cpp:7