7 #ifndef BALL_SYSTEM_MPISUPPORT_H
8 #define BALL_SYSTEM_MPISUPPORT_H
14 #ifndef BALL_DATATYPE_STRING_H
18 #ifndef BALL_MATHS_VECTOR3_H
22 #ifndef BALL_COMMON_EXCEPTION_H
31 # define BALL_HAS_MPI2_SUPPORT TRUE
33 # undef BALL_HAS_MPI2_SUPPORT
65 MPISupport(MPI_Comm default_communicator = MPI_COMM_WORLD);
82 MPI_Comm default_communicator = MPI_COMM_WORLD,
83 bool accept_communicator =
true);
103 MPI_Comm getDefaultCommunicator();
106 void setDefaultCommunicator(MPI_Comm default_communicator);
111 bool getFinalizeOnDestruct();
114 void setFinalizeOnDestruct(
bool new_value);
120 void setMpiInfo(
const MPI_Info &mpi_info);
134 void init(
int argc,
char** argv,
bool accept_communicator =
true);
149 void sendSystem(
const System& system,
bool broadcast =
true,
int receiver = 0);
156 System* receiveSystem(
bool broadcast =
true,
int source = MPI_ANY_SOURCE);
164 void sendOptions(
const Options& options,
bool broadcast =
true,
int receiver = 0);
171 Options* receiveOptions(
bool broadcast =
true,
int source = MPI_ANY_SOURCE);
178 template <
typename valuetype>
179 void distributeDatapoints(
const std::vector<valuetype>& input, std::vector<valuetype>& our_share);
184 template <
typename valuetype>
185 void acceptDatapoints(std::vector<valuetype>& our_share);
191 template <
typename valuetype>
192 void combineDatapoints(
const std::vector<valuetype>& our_share)
198 template <
typename valuetype>
199 void acceptCombinedDatapoints(std::vector<valuetype>& combined_set, std::vector<valuetype>& our_share)
210 void* distributeDatapoints(
const void* input,
int size,
Size& numpoints, MPI_Datatype datatype);
217 void* acceptDatapoints(
Size& numpoints, MPI_Datatype datatype);
224 void combineDatapoints(
const void* input,
int size, MPI_Datatype datatype);
234 void* acceptCombinedDatapoints(
const void* input,
int size,
Size& numpoints, MPI_Datatype datatype);
268 #ifdef BALL_HAS_MPI2_SUPPORT
269 Size spawn(
const String& command,
char *argv[],
Size wanted_number_of_processes = 0,
bool merge_communicator =
true);
278 template <
typename valuetype>
279 valuetype getSum(valuetype& local_value);
287 template <
typename valuetype>
288 valuetype getProduct(valuetype& local_value);
297 template <
typename valuetype>
298 valuetype getMaximum(valuetype& local_value);
307 template <
typename valuetype>
308 valuetype getMinimum(valuetype& local_value);
314 void registerTypes_();
319 void sendPersistenceStream_(
const std::ostringstream& stream,
320 int tag = MPI_ANY_TAG,
bool broadcast =
true,
int receiver = 0);
326 void receivePersistenceStream_(std::istringstream& in,
int tag = MPI_ANY_TAG,
327 bool broadcast =
true,
int source = 0);