OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
Macros | Enumerations | Functions
MPIHelper.h File Reference
#include <vector>
#include <map>
#include <sstream>
#include <mpi.h>
#include "Util/Types.h"
Include dependency graph for MPIHelper.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define MPI_WORKER_STATUSUPDATE_TAG   0x11
 notify pilot about worker status More...
 
#define MPI_WORKER_FINISHED_TAG   0x12
 notify pilot that work has been finished and results are ready to collect More...
 
#define MPI_WORKER_FINISHED_ACK_TAG   0x13
 pilot notifies worker that he is ready to collect the results More...
 
#define MPI_COWORKER_NEW_JOB_TAG   0x14
 notifies coworkers about new jobs More...
 
#define MPI_OPT_NEW_JOB_TAG   0x21
 optimizer sends new job to pilot More...
 
#define MPI_OPT_JOB_FINISHED_TAG   0x22
 pilot tells optimizer that results are ready to collect More...
 
#define MPI_OPT_CONVERGED_TAG   0x23
 optimizer notifies pilot that optimization has converged (EXIT) More...
 
#define MPI_WORK_JOBID_TAG   0x41
 unique id of the job More...
 
#define MPI_WORK_SIZE_TAG   0x42
 tags messages containing the size of results (requested vars) More...
 
#define MPI_WORK_SIZE_PARAMS   0x43
 tags messages containing the size of the parameter list (for simulation) More...
 
#define MPI_EXCHANGE_SOL_STATE_TAG   0x51
 
#define MPI_EXCHANGE_SOL_STATE_DATA_TAG   0x52
 
#define MPI_EXCHANGE_SOL_STATE_RES_SIZE_TAG   0x53
 
#define MPI_EXCHANGE_SOL_STATE_RES_TAG   0x54
 
#define MPI_STOP_TAG   0x91
 global stop tag to exit poll loop ( More...
 
#define MPI_EXCHANGE_SERIALIZED_DATA_TAG   0x99
 tag for exchanging serialized data More...
 

Enumerations

enum  MPITag_t {
  WORKER_FINISHED_TAG = 0x12, OPT_NEW_JOB_TAG = 0x21, OPT_CONVERGED_TAG = 0x23, WORKER_STATUSUPDATE_TAG = 0x11,
  REQUEST_FINISHED = 0x22, EXCHANGE_SOL_STATE_TAG = 0x51, EXCHANGE_SOL_STATE_RES_SIZE_TAG = 0x53
}
 
enum  State_t { IDLE = 0, RUNNING = 1 }
 Worker state is either idle or running. More...
 

Functions

void serialize (Param_t params, std::ostringstream &os)
 serializes params using Boost archive More...
 
void serialize (reqVarContainer_t params, std::ostringstream &os)
 
void deserialize (char *buffer, Param_t &params)
 deserializes params using Boost archive More...
 
void deserialize (char *buffer, reqVarContainer_t &params)
 
void MPI_Bcast_params (Param_t &params, size_t root, MPI_Comm comm)
 broadcast params to all entities in comm More...
 
void MPI_Bcast_reqvars (reqVarContainer_t reqvars, size_t root, MPI_Comm comm)
 broadcast requested variables to all entities in comm More...
 
template<class Data_t >
void MPI_Send_serialized (Data_t data, size_t pid, MPI_Comm comm)
 
template<class Data_t >
void MPI_Recv_serialized (Data_t &data, size_t pid, MPI_Comm comm)
 
void MPI_Send_params (Param_t params, size_t pid, MPI_Comm comm)
 
std::pair< size_t *, char * > MPI_ISend_params (Param_t params, size_t pid, MPI_Comm comm, MPI_Request *req)
 
void MPI_Recv_params (Param_t &params, size_t pid, MPI_Comm comm)
 
void MPI_Send_reqvars (reqVarContainer_t reqvars, size_t pid, MPI_Comm comm)
 
void MPI_Recv_reqvars (reqVarContainer_t &reqvars, size_t pid, MPI_Comm comm)
 

Macro Definition Documentation

#define MPI_COWORKER_NEW_JOB_TAG   0x14
#define MPI_EXCHANGE_SERIALIZED_DATA_TAG   0x99

tag for exchanging serialized data

Definition at line 47 of file MPIHelper.h.

Referenced by MPI_ISend_params(), MPI_Recv_params(), MPI_Recv_reqvars(), MPI_Recv_serialized(), MPI_Send_params(), MPI_Send_reqvars(), and MPI_Send_serialized().

#define MPI_EXCHANGE_SOL_STATE_DATA_TAG   0x52
#define MPI_EXCHANGE_SOL_STATE_RES_SIZE_TAG   0x53
#define MPI_EXCHANGE_SOL_STATE_RES_TAG   0x54
#define MPI_EXCHANGE_SOL_STATE_TAG   0x51

Definition at line 38 of file MPIHelper.h.

#define MPI_OPT_CONVERGED_TAG   0x23

optimizer notifies pilot that optimization has converged (EXIT)

Definition at line 28 of file MPIHelper.h.

Referenced by Sampler::runStateMachine().

#define MPI_OPT_JOB_FINISHED_TAG   0x22

pilot tells optimizer that results are ready to collect

Definition at line 26 of file MPIHelper.h.

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

#define MPI_OPT_NEW_JOB_TAG   0x21

optimizer sends new job to pilot

Definition at line 24 of file MPIHelper.h.

#define MPI_STOP_TAG   0x91
#define MPI_WORK_JOBID_TAG   0x41
#define MPI_WORK_SIZE_PARAMS   0x43

tags messages containing the size of the parameter list (for simulation)

Definition at line 36 of file MPIHelper.h.

#define MPI_WORK_SIZE_TAG   0x42

tags messages containing the size of results (requested vars)

Definition at line 34 of file MPIHelper.h.

#define MPI_WORKER_FINISHED_ACK_TAG   0x13
#define MPI_WORKER_FINISHED_TAG   0x12

notify pilot that work has been finished and results are ready to collect

Definition at line 15 of file MPIHelper.h.

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

#define MPI_WORKER_STATUSUPDATE_TAG   0x11

notify pilot about worker status

Definition at line 13 of file MPIHelper.h.

Referenced by Worker< Sim_t >::setupPoll().

Enumeration Type Documentation

enum MPITag_t
Enumerator
WORKER_FINISHED_TAG 
OPT_NEW_JOB_TAG 
OPT_CONVERGED_TAG 
WORKER_STATUSUPDATE_TAG 
REQUEST_FINISHED 
EXCHANGE_SOL_STATE_TAG 
EXCHANGE_SOL_STATE_RES_SIZE_TAG 

Definition at line 51 of file MPIHelper.h.

enum State_t

Worker state is either idle or running.

Enumerator
IDLE 
RUNNING 

Definition at line 62 of file MPIHelper.h.

Function Documentation

void deserialize ( char *  buffer,
Param_t params 
)

deserializes params using Boost archive

Definition at line 23 of file MPIHelper.cpp.

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

void deserialize ( char *  buffer,
reqVarContainer_t params 
)

Definition at line 31 of file MPIHelper.cpp.

void MPI_Bcast_params ( Param_t params,
size_t  root,
MPI_Comm  comm 
)

broadcast params to all entities in comm

Definition at line 39 of file MPIHelper.cpp.

References deserialize(), and serialize().

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

Here is the call graph for this function:

void MPI_Bcast_reqvars ( reqVarContainer_t  reqvars,
size_t  root,
MPI_Comm  comm 
)

broadcast requested variables to all entities in comm

std::pair<size_t*, char*> MPI_ISend_params ( Param_t  params,
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 84 of file MPIHelper.cpp.

References MPI_EXCHANGE_SERIALIZED_DATA_TAG, and serialize().

Here is the call graph for this function:

void MPI_Recv_params ( Param_t params,
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 107 of file MPIHelper.cpp.

References deserialize(), and MPI_EXCHANGE_SERIALIZED_DATA_TAG.

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

Here is the call graph for this function:

void MPI_Recv_reqvars ( reqVarContainer_t reqvars,
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 144 of file MPIHelper.cpp.

References deserialize(), and MPI_EXCHANGE_SERIALIZED_DATA_TAG.

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

Here is the call graph for this function:

template<class Data_t >
void MPI_Recv_serialized ( Data_t &  data,
size_t  pid,
MPI_Comm  comm 
)

Definition at line 100 of file MPIHelper.h.

References deserialize(), and MPI_EXCHANGE_SERIALIZED_DATA_TAG.

Here is the call graph for this function:

void MPI_Send_params ( Param_t  params,
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 66 of file MPIHelper.cpp.

References MPI_EXCHANGE_SERIALIZED_DATA_TAG, and serialize().

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

Here is the call graph for this function:

void MPI_Send_reqvars ( reqVarContainer_t  reqvars,
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 125 of file MPIHelper.cpp.

References MPI_EXCHANGE_SERIALIZED_DATA_TAG, and serialize().

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

Here is the call graph for this function:

template<class Data_t >
void MPI_Send_serialized ( Data_t  data,
size_t  pid,
MPI_Comm  comm 
)

Definition at line 81 of file MPIHelper.h.

References MPI_EXCHANGE_SERIALIZED_DATA_TAG, and serialize().

Here is the call graph for this function:

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

Definition at line 17 of file MPIHelper.cpp.