diff --git a/src/libs/ascent/ascent.cpp b/src/libs/ascent/ascent.cpp index 4f2b7092d..f8c9098dd 100644 --- a/src/libs/ascent/ascent.cpp +++ b/src/libs/ascent/ascent.cpp @@ -49,6 +49,12 @@ ParRank(int comm_id) int rank = 0; #if defined(ASCENT_MPI_ENABLED) + if(mpi_comm_id == -1) + { + // do nothing, an error will be thrown later + // so we can respect the exception handling + return 0; + } MPI_Comm mpi_comm = MPI_Comm_f2c(comm_id); MPI_Comm_rank(mpi_comm, &rank); #endif @@ -63,6 +69,12 @@ ParSize(int comm_id) int comm_size=1; #if defined(ASCENT_MPI_ENABLED) + if(mpi_comm_id == -1) + { + // do nothing, an error will be thrown later + // so we can respect the exception handling + return 1; + } MPI_Comm mpi_comm = MPI_Comm_f2c(comm_id); MPI_Comm_size(mpi_comm, &comm_size); #endif diff --git a/src/tests/ascent/t_ascent_mpi_ascent_runtime.cpp b/src/tests/ascent/t_ascent_mpi_ascent_runtime.cpp index 3ab6eb5cf..5cb08c702 100644 --- a/src/tests/ascent/t_ascent_mpi_ascent_runtime.cpp +++ b/src/tests/ascent/t_ascent_mpi_ascent_runtime.cpp @@ -124,7 +124,7 @@ TEST(ascent_mpi_runtime, test_error_for_mpi_vs_non_mpi) Ascent ascent; Node ascent_opts; ascent_opts["exceptions"] = "forward"; - // we throw an error if an mpi_comm is NO provided to a mpi ver of ascent + // we throw an error if an mpi_comm is NOT provided to a mpi ver of ascent EXPECT_THROW(ascent.open(ascent_opts),conduit::Error); }