From 8b5675a8e28a6a5cf69ea218580b62cecaedcd9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joachim=20Sch=C3=B6berl?= Date: Tue, 15 Sep 2020 23:15:50 +0200 Subject: [PATCH] check if mpi is initialized --- libsrc/core/mpi_wrapper.hpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/libsrc/core/mpi_wrapper.hpp b/libsrc/core/mpi_wrapper.hpp index bdf2505b..2e046d18 100644 --- a/libsrc/core/mpi_wrapper.hpp +++ b/libsrc/core/mpi_wrapper.hpp @@ -67,6 +67,17 @@ namespace ngcore NgMPI_Comm (MPI_Comm _comm, bool owns = false) : comm(_comm), valid_comm(true) { + int flag; + MPI_Initialized (&flag); + if (!flag) + { + valid_comm = false; + refcount = nullptr; + rank = 0; + size = 1; + return; + } + if (!owns) refcount = nullptr; else