Skip to content
Snippets Groups Projects
Commit 816d0754 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

only call MPI_Init if MPI is not already initialized (trying to fix mpi4py)

parent 4407de06
No related branches found
No related tags found
No related merge requests found
...@@ -66,7 +66,9 @@ static int vsnprintf(char *str, size_t size, const char *fmt, va_list ap) ...@@ -66,7 +66,9 @@ static int vsnprintf(char *str, size_t size, const char *fmt, va_list ap)
void Msg::Init(int argc, char **argv) void Msg::Init(int argc, char **argv)
{ {
#if defined(HAVE_MPI) #if defined(HAVE_MPI)
MPI_Init(&argc, &argv); int flag;
MPI_Initialized(&flag);
if(!flag) MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &_commRank); MPI_Comm_rank(MPI_COMM_WORLD, &_commRank);
MPI_Comm_size(MPI_COMM_WORLD, &_commSize); MPI_Comm_size(MPI_COMM_WORLD, &_commSize);
MPI_Errhandler_set(MPI_COMM_WORLD, MPI_ERRORS_RETURN); MPI_Errhandler_set(MPI_COMM_WORLD, MPI_ERRORS_RETURN);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment