Skip to content

Commit 7ff9742

Browse files
committed
Avoid possible parallel hang
1 parent 6174c13 commit 7ff9742

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/libs/rover/typed_scheduler.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,16 @@ TypedScheduler<FloatType>::get_global_num_energy_groups()
8989
timer.Start();
9090
double time = 0;
9191
(void) time;
92+
int mpi_min_energy_groups;
9293
int mpi_max_energy_groups;
94+
MPI_Allreduce(&num_energy_groups, &mpi_min_energy_groups, 1, MPI_INT, MPI_MIN, m_comm_handle);
9395
MPI_Allreduce(&num_energy_groups, &mpi_max_energy_groups, 1, MPI_INT, MPI_MAX, m_comm_handle);
9496

9597
// Check that all ranks have the same num_energy_groups
96-
if (num_energy_groups != mpi_max_energy_groups)
98+
if (mpi_min_energy_groups != mpi_max_energy_groups)
9799
{
98100
ASCENT_LOG_ERROR("Error - TypedScheduler::get_global_num_energy_groups: MPI ranks have inconsistent number of energy groups. "
99-
"Local: " << num_energy_groups << ", Global max: " << mpi_max_energy_groups);
101+
"Local: " << num_energy_groups << ", Global min: " << mpi_min_energy_groups << ", Global max: " << mpi_max_energy_groups);
100102
}
101103

102104
// Check that all ranks agree on field mismatch state

0 commit comments

Comments
 (0)