From d6d0fe812fbc0735dca0f67947bc09ab03b38f50 Mon Sep 17 00:00:00 2001 From: Dan H Date: Wed, 7 Feb 2018 10:41:44 -0500 Subject: [PATCH] Allow Grid to Mpi_init. --- lib/mpi/QMP_init_mpi.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/mpi/QMP_init_mpi.c b/lib/mpi/QMP_init_mpi.c index a3fa6d3..6be4ddd 100644 --- a/lib/mpi/QMP_init_mpi.c +++ b/lib/mpi/QMP_init_mpi.c @@ -32,8 +32,14 @@ QMP_init_machine_mpi (int* argc, char*** argv, QMP_thread_level_t required, break; } - if (MPI_Init_thread(argc, argv, mpi_req, &mpi_prv) != MPI_SUCCESS) - QMP_abort_string (-1, "MPI_Init failed"); + int flag; + MPI_Initialized(&flag); // needed to coexist with other libs apparently + if ( !flag ) { + if (MPI_Init_thread(argc, argv, mpi_req, &mpi_prv) != MPI_SUCCESS) + QMP_abort_string (-1, "MPI_Init failed"); + }else{ + MPI_Query_thread(&mpi_prv); + } switch(mpi_prv) { case MPI_THREAD_SINGLE: