23#include <boost/static_assert.hpp>
24#include <boost/serialization/map.hpp>
25#include <boost/serialization/vector.hpp>
27#include <boost/archive/text_oarchive.hpp>
28#include <boost/archive/text_iarchive.hpp>
34 boost::archive::text_oarchive oa(os);
40 boost::archive::text_oarchive oa(os);
47 std::istringstream is(buffer);
48 boost::archive::text_iarchive ia(is);
55 std::istringstream is(buffer);
56 boost::archive::text_iarchive ia(is);
64 MPI_Comm_rank(comm, &pid);
65 my_pid =
static_cast<size_t>(pid);
68 std::ostringstream os;
72 buf_size = os.str().length() + 1;
75 MPI_Bcast(&buf_size, 1, MPI_UNSIGNED_LONG, root, comm);
77 char *buffer =
new char[buf_size];
78 if(my_pid == root) memcpy(buffer, os.str().c_str(), buf_size);
80 MPI_Bcast(buffer, buf_size, MPI_CHAR, root, comm);
89 std::ostringstream os;
91 size_t buf_size = os.str().length() + 1;
93 MPI_Send(&buf_size, 1, MPI_UNSIGNED_LONG, pid,
96 char *buffer =
new char[buf_size];
97 memcpy(buffer, os.str().c_str(), buf_size);
99 MPI_Send(buffer, buf_size, MPI_CHAR, pid,
106 MPI_Comm comm, MPI_Request *req) {
108 std::ostringstream os;
110 size_t* buf_size =
new size_t();
111 *buf_size = os.str().length() + 1;
113 MPI_Isend(buf_size, 1, MPI_UNSIGNED_LONG, pid,
116 char *buffer =
new char[*buf_size];
117 memcpy(buffer, os.str().c_str(), *buf_size);
119 MPI_Isend(buffer, *buf_size, MPI_CHAR, pid,
122 std::pair<size_t*, char*> p(buf_size, buffer);
132 MPI_Recv(&buf_size, 1, MPI_UNSIGNED_LONG, pid,
135 char *buffer =
new char[buf_size]();
137 MPI_Recv(buffer, buf_size, MPI_CHAR, pid,
148 std::ostringstream os;
150 size_t buf_size = os.str().length() + 1;
152 MPI_Send(&buf_size, 1, MPI_UNSIGNED_LONG, pid,
155 char *buffer =
new char[buf_size];
156 memcpy(buffer, os.str().c_str(), buf_size);
158 MPI_Send(buffer, buf_size, MPI_CHAR, pid,
169 MPI_Recv(&buf_size, 1, MPI_UNSIGNED_LONG, pid,
172 char *buffer =
new char[buf_size]();
174 MPI_Recv(buffer, buf_size, MPI_CHAR, pid,
#define MPI_EXCHANGE_SERIALIZED_DATA_TAG
tag for exchanging serialized data
void MPI_Send_reqvars(reqVarContainer_t reqvars, size_t pid, MPI_Comm comm)
void MPI_Bcast_params(Param_t ¶ms, size_t root, MPI_Comm comm)
broadcast params to all entities in comm
void MPI_Send_params(Param_t params, size_t pid, MPI_Comm comm)
void MPI_Recv_reqvars(reqVarContainer_t &reqvars, size_t pid, MPI_Comm comm)
void serialize(Param_t params, std::ostringstream &os)
serializes params using Boost archive
std::pair< size_t *, char * > MPI_ISend_params(Param_t params, size_t pid, MPI_Comm comm, MPI_Request *req)
void deserialize(char *buffer, Param_t ¶ms)
deserializes params using Boost archive
void MPI_Recv_params(Param_t ¶ms, size_t pid, MPI_Comm comm)
std::map< std::string, reqVarInfo_t > reqVarContainer_t
namedVariableCollection_t Param_t