From fa1e6a1836ef7b6a7c3b05911cfb9f5b3da7eefc Mon Sep 17 00:00:00 2001 From: Jonathan Lifflander Date: Thu, 17 Sep 2020 18:26:01 -0700 Subject: [PATCH] #1014: runtime: check MPI_Comm for use during component startup --- src/vt/runtime/runtime.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/vt/runtime/runtime.cc b/src/vt/runtime/runtime.cc index 5355ccaec2..bef793d8c3 100644 --- a/src/vt/runtime/runtime.cc +++ b/src/vt/runtime/runtime.cc @@ -456,7 +456,15 @@ bool Runtime::finalize(bool const force_now, bool const disable_sig) { } void Runtime::sync() { - MPI_Barrier(communicator_); + MPI_Comm comm = communicator_; + if (comm == MPI_COMM_NULL and theContext != nullptr) { + comm = theContext->getComm(); + } + if (comm == MPI_COMM_NULL) { + vtAbort("Trying to sync runtime while the communicator is not available"); + } else { + MPI_Barrier(comm); + } } void Runtime::runScheduler() {