OPAL (Object Oriented Parallel Accelerator Library) 2024.2
OPAL
Functions
MPIHelper.cpp File Reference
#include <cstddef>
#include <cstring>
#include <iomanip>
#include <limits>
#include <string>
#include "Util/MPIHelper.h"
Include dependency graph for MPIHelper.cpp:

Go to the source code of this file.

Functions

void serialize (Param_t params, std::ostringstream &os)
 serializes params to a text stream, replaces boost::serialization
 
void serialize (reqVarContainer_t reqvars, std::ostringstream &os)
 
void deserialize (const char *buffer, std::size_t buf_size, Param_t &params)
 
void deserialize (const char *buffer, std::size_t buf_size, reqVarContainer_t &reqvars)
 
void MPI_Bcast_params (Param_t &params, std::size_t root, MPI_Comm comm)
 broadcast params to all entities in comm
 
void MPI_Send_params (Param_t params, std::size_t pid, MPI_Comm comm)
 
std::pair< std::size_t *, char * > MPI_ISend_params (Param_t params, std::size_t pid, MPI_Comm comm, MPI_Request *req)
 
void MPI_Recv_params (Param_t &params, std::size_t pid, MPI_Comm comm)
 
void MPI_Send_reqvars (reqVarContainer_t reqvars, std::size_t pid, MPI_Comm comm)
 
void MPI_Recv_reqvars (reqVarContainer_t &reqvars, std::size_t pid, MPI_Comm comm)
 

Function Documentation

◆ deserialize() [1/2]

void deserialize ( const char *  buffer,
std::size_t  buf_size,
Param_t &  params 
)

deserializes params from an explicitly sized buffer (not null-terminated), replaces boost::serialization

Definition at line 68 of file MPIHelper.cpp.

Referenced by MPI_Bcast_params(), MPI_Recv_params(), MPI_Recv_reqvars(), and MPI_Recv_serialized().

◆ deserialize() [2/2]

void deserialize ( const char *  buffer,
std::size_t  buf_size,
reqVarContainer_t &  reqvars 
)

Definition at line 84 of file MPIHelper.cpp.

◆ MPI_Bcast_params()

void MPI_Bcast_params ( Param_t &  params,
std::size_t  root,
MPI_Comm  comm 
)

broadcast params to all entities in comm

Definition at line 100 of file MPIHelper.cpp.

References deserialize(), and serialize().

Referenced by Worker< Sim_t >::onMessage(), SampleWorker< Sim_t >::onMessage(), Worker< Sim_t >::runCoWorker(), and SampleWorker< Sim_t >::runSlave().

Here is the call graph for this function:

◆ MPI_ISend_params()

std::pair< std::size_t *, char * > MPI_ISend_params ( Param_t  params,
std::size_t  pid,
MPI_Comm  comm,
MPI_Request *  req 
)

Serializes a parameter list and asynchronously sends (MPI) to another processor. The memory associated with returned buffers must be freed by the consumer.

Parameters
paramsparameter list to serialize
pidprocessor ID to send data to
commMPI communicator group used for sending the data
reqMPI request assigned with the ISend

Definition at line 144 of file MPIHelper.cpp.

References MPI_EXCHANGE_SERIALIZED_DATA_TAG, and serialize().

Here is the call graph for this function:

◆ MPI_Recv_params()

void MPI_Recv_params ( Param_t &  params,
std::size_t  pid,
MPI_Comm  comm 
)

Receives and unpacks a parameter list from another (MPI) processor.

Parameters
paramsparameter list to store data
pidprocessor ID to receive data from
commMPI communicator group used for receiving the data

Definition at line 166 of file MPIHelper.cpp.

References deserialize(), and MPI_EXCHANGE_SERIALIZED_DATA_TAG.

Referenced by Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::onMessage(), Worker< Sim_t >::onMessage(), SamplePilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::onMessage(), and SampleWorker< Sim_t >::onMessage().

Here is the call graph for this function:

◆ MPI_Recv_reqvars()

void MPI_Recv_reqvars ( reqVarContainer_t &  reqvars,
std::size_t  pid,
MPI_Comm  comm 
)

Receives and unpacks a required variable list from another (MPI) processor.

Parameters
reqvarsvariable list to store data
pidprocessor ID to receive data from
commMPI communicator group used for receiving the data

Definition at line 201 of file MPIHelper.cpp.

References deserialize(), and MPI_EXCHANGE_SERIALIZED_DATA_TAG.

Referenced by Sampler::onMessage(), Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::onMessage(), and SamplePilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::onMessage().

Here is the call graph for this function:

◆ MPI_Send_params()

void MPI_Send_params ( Param_t  params,
std::size_t  pid,
MPI_Comm  comm 
)

Serializes a parameter list and sends (MPI) to another processor.

Parameters
paramsparameter list to serialize
pidprocessor ID to send data to
commMPI communicator group used for sending the data

Definition at line 126 of file MPIHelper.cpp.

References MPI_EXCHANGE_SERIALIZED_DATA_TAG, and serialize().

Referenced by Sampler::dispatch_forward_solves(), Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::sendNewJobToWorker(), and SamplePilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::sendNewJobToWorker().

Here is the call graph for this function:

◆ MPI_Send_reqvars()

void MPI_Send_reqvars ( reqVarContainer_t  reqvars,
std::size_t  pid,
MPI_Comm  comm 
)

Serializes requested variable list and sends (MPI) to another processor.

Parameters
reqvarsvariable list list to serialize
pidprocessor ID to send data to
commMPI communicator group used for sending the data

Definition at line 183 of file MPIHelper.cpp.

References MPI_EXCHANGE_SERIALIZED_DATA_TAG, and serialize().

Referenced by Pilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::onMessage(), Worker< Sim_t >::onMessage(), SamplePilot< Opt_t, Sim_t, SolPropagationGraph_t, Comm_t >::onMessage(), and SampleWorker< Sim_t >::onMessage().

Here is the call graph for this function:

◆ serialize() [1/2]

void serialize ( Param_t  params,
std::ostringstream &  os 
)

◆ serialize() [2/2]

void serialize ( reqVarContainer_t  reqvars,
std::ostringstream &  os 
)

Definition at line 57 of file MPIHelper.cpp.