You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if (isinit==1) throwstd::runtime_error("MPI already initialized!");
15
+
MPI_Init(NULL, NULL);
16
+
int myrank;
17
+
MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
18
+
return myrank;
16
19
}
17
20
18
21
voidintegrate(MCI * const mci, constlong &Nmc, double * average, double * error, bool findMRT2step=true, bool initialdecorrelation=true, bool use_mpi=true) // by setting use_mpi to false you can use this without requiring MPI
19
22
{
20
23
if (use_mpi) {
21
24
// make sure the user has MPI in the correct state
22
-
if (!MPI::Is_initialized()) throwstd::runtime_error("MPI not initialized!");
23
-
if (MPI::Is_finalized()) throwstd::runtime_error("MPI already finalized!");
25
+
int isinit, isfinal;
26
+
MPI_Initialized(&isinit);
27
+
if (isinit==0) throwstd::runtime_error("MPI not initialized!");
28
+
MPI_Finalized(&isfinal);
29
+
if (isfinal==1) throwstd::runtime_error("MPI already finalized!");
24
30
25
-
constint nranks = MPI::COMM_WORLD.Get_size();
31
+
int nranks;
32
+
MPI_Comm_size(MPI_COMM_WORLD, &nranks);
26
33
27
34
// the results are stored in myAverage/Error and then reduced into the same average/error for all processes
0 commit comments