Skip to content

Commit 8223099

Browse files
authored
All reduce to print correct number of surface source particles (#3901)
1 parent 6cd3907 commit 8223099

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/state_point.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,8 +592,16 @@ void write_source_point(std::string filename, span<SourceSite> source_bank,
592592
const vector<int64_t>& bank_index, bool use_mcpl)
593593
{
594594
std::string ext = use_mcpl ? "mcpl" : "h5";
595+
596+
int total_surf_particles = source_bank.size();
597+
#ifdef OPENMC_MPI
598+
int num_particles = source_bank.size();
599+
MPI_Allreduce(
600+
&num_particles, &total_surf_particles, 1, MPI_INT, MPI_SUM, mpi::intracomm);
601+
#endif
602+
595603
write_message("Creating source file {}.{} with {} particles ...", filename,
596-
ext, source_bank.size(), 5);
604+
ext, total_surf_particles, 5);
597605

598606
// Dispatch to appropriate function based on file type
599607
if (use_mcpl) {

0 commit comments

Comments
 (0)