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
cout << "Using a sampling function in this case gives worse performance. In fact, the error bar is larger." << endl;
163
+
cout << "This implies that the variance of the re-factored f(x) written for introducing a sampling function, is larger than the original f(x)." << endl;
164
+
}
165
+
159
166
// deallocate per-thread allocations
160
167
delete sf;
161
168
@@ -170,22 +177,13 @@ int main() {
170
177
delete[] irange[0];
171
178
delete[] irange;
172
179
173
-
MPIMCI::finalize(mci); // also deletes all mci
174
-
175
-
// from now on just root thread
176
-
if (myrank == 0) {
177
-
cout << "The integral gives as result = " << average[0] << " +- " << error[0] << endl;
cout << "Using a sampling function in this case gives worse performance. In fact, the error bar is larger." << endl;
183
-
cout << "This implies that the variance of the re-factored f(x) written for introducing a sampling function, is larger than the original f(x)." << endl;
Copy file name to clipboardExpand all lines: src/MPIMCI.hpp
+7-11Lines changed: 7 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -15,46 +15,42 @@ namespace MPIMCI
15
15
return MPI::COMM_WORLD.Get_rank();
16
16
}
17
17
18
-
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
18
+
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
19
{
20
20
if (use_mpi) {
21
21
// make sure the user has MPI in the correct state
22
22
if (!MPI::Is_initialized()) throwstd::runtime_error("MPI not initialized!");
23
23
if (MPI::Is_finalized()) throwstd::runtime_error("MPI already finalized!");
24
24
25
-
constint myrank = MPI::COMM_WORLD.Get_rank();
26
25
constint nranks = MPI::COMM_WORLD.Get_size();
27
26
28
-
// the results are stored in myAverage/Error and then reduced into average/error for root process
27
+
// the results are stored in myAverage/Error and then reduced into the same average/error for all processes
0 commit comments