Skip to content

Commit

Permalink
Don't throw exception when PIKA_MPI_ENABLE_POOL is enabled without MP…
Browse files Browse the repository at this point in the history
…I initialized
  • Loading branch information
msimberg committed Nov 7, 2024
1 parent 8f08551 commit 78f42ec
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions libs/pika/async_mpi/src/mpi_polling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -787,9 +787,21 @@ namespace pika::mpi::experimental {
// if we are potentially using a pool, mpi must be initialized
if (!mpi::detail::environment::is_mpi_initialized())
{
PIKA_THROW_EXCEPTION(pika::error::invalid_status, "mpi::create_pool",
"MPI must be initialized prior to pool creation");
if (mode == polling_pool_creation_mode::mode_force_create)
{
PIKA_THROW_EXCEPTION(pika::error::invalid_status, "mpi::create_pool",
"MPI must be initialized prior to pool creation");
}
else
{
PIKA_LOG(warn,
"MPI pool creation was requested, but MPI is not initialized, not creating "
"the pool (if PIKA_MPI_ENABLE_POOL is set to 1, unsetting it will silence "
"the warning)");
return false;
}
}

// needed, in order to decide if pool can be disabled on 1 rank
mpi_data_.rank_ = mpi::detail::environment::rank();
mpi_data_.size_ = mpi::detail::environment::size();
Expand Down

0 comments on commit 78f42ec

Please sign in to comment.