Fix MPI-related bugs

This commit is contained in:
Paul Romano 2018-09-05 13:50:19 -05:00
parent 50dcae1772
commit 6174461daa
2 changed files with 5 additions and 7 deletions

View file

@ -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

View file

@ -702,13 +702,11 @@ xt::xarray<double> 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_;