From 6174461daa08b36972b56d7af81ec1ba81300eea Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Wed, 5 Sep 2018 13:50:19 -0500 Subject: [PATCH] Fix MPI-related bugs --- src/eigenvalue.cpp | 4 ++-- src/mesh.cpp | 8 +++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/eigenvalue.cpp b/src/eigenvalue.cpp index 71ce1c295a..d4f629e06b 100644 --- a/src/eigenvalue.cpp +++ b/src/eigenvalue.cpp @@ -92,8 +92,8 @@ void ufs_count_sites() #ifdef OPENMC_MPI // Send source fraction to all processors - int n = xt::prod(m->shape_)(); - MPI_Bcast(source_frac.data(), n, MPI_DOUBLE, 0, mpi::intracomm) + int n_bins = xt::prod(m->shape_)(); + MPI_Bcast(source_frac.data(), n_bins, MPI_DOUBLE, 0, mpi::intracomm); #endif // Normalize to total weight to get fraction of source in each cell diff --git a/src/mesh.cpp b/src/mesh.cpp index f2bd7fe791..b922408de3 100644 --- a/src/mesh.cpp +++ b/src/mesh.cpp @@ -702,13 +702,11 @@ xt::xarray RegularMesh::count_sites(int64_t n, const Bank* bank, // collect values from all processors MPI_Reduce(cnt.data(), cnt_reduced, total, MPI_DOUBLE, MPI_SUM, 0, mpi::intracomm); - if (outside) { - MPI_Reduce(&outside_, outside, 1, MPI_BOOL, MPI_LOR, 0, mpi::intracomm); - } // Check if there were sites outside the mesh for any processor - MPI_REDUCE(outside, sites_outside, 1, MPI_LOGICAL, MPI_LOR, 0, & - mpi_intracomm, mpi_err) + if (outside) { + MPI_Reduce(&outside_, outside, 1, MPI_C_BOOL, MPI_LOR, 0, mpi::intracomm); + } #else std::copy(cnt.data(), cnt.data() + total, cnt_reduced); if (outside) *outside = outside_;