From b2c064cc357415b4699302dabf7e0ea6d1f40d9d Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Tue, 8 Oct 2019 11:34:26 -0500 Subject: [PATCH] Updates for MPI runs. --- src/volume_calc.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/volume_calc.cpp b/src/volume_calc.cpp index 23bb08f822..13cfcf569e 100644 --- a/src/volume_calc.cpp +++ b/src/volume_calc.cpp @@ -325,11 +325,30 @@ std::vector VolumeCalculation::execute() const } } +#ifdef OPENMC_MPI + // update maximum error value on all processes + if (mpi::master) { + for (int i = 1; i < mpi::n_procs; i++) { + MPI_Send(&max_vol_err, 1, MPI_DOUBLE, i, 0, mpi::intracomm); + } + } else { + MPI_Recv(&max_vol_err, 1, MPI_DOUBLE, 0, 0, mpi::intracomm, MPI_STATUS_IGNORE); + } +#endif + // return results of the calculation if (trigger_type_ == ThresholdType::NONE || max_vol_err < threshold_) { return results; } +#ifdef OPENMC_MPI + // if iterating in MPI, need to zero indices and hits to they aren't counted twice + if (!mpi::master) { + for (auto& v : master_indices) { std::fill(v.begin(), v.end(), 0.0); } + for (auto& v : master_hits) { std::fill(v.begin(), v.end(), 0.0); } + } +#endif + } // end while }