Commit 46c6cf1a authored by Pietro Incardona's avatar Pietro Incardona
Browse files

Small changes to VCluster to check if MPI_Finalize fail

parent e34cc611
...@@ -2,8 +2,5 @@ ...@@ -2,8 +2,5 @@
Vcluster * global_v_cluster = NULL; Vcluster * global_v_cluster = NULL;
// Global MPI initialization
bool global_mpi_init = false;
// number of vcluster instances // number of vcluster instances
size_t n_vcluster = 0; size_t n_vcluster = 0;
...@@ -151,9 +151,15 @@ public: ...@@ -151,9 +151,15 @@ public:
{ {
std::cout << "Finalize\n"; std::cout << "Finalize\n";
if (MPI_Finalize() != 0) int already_finalised;
MPI_Finalized(&already_finalised);
if (!already_finalised)
{ {
std::cerr << "DAMN!!!!!!!! \n"; if (MPI_Finalize() != 0)
{
std::cerr << __FILE__ << ":" << __LINE__ << " MPI_Finalize FAILED \n";
}
} }
} }
} }
...@@ -168,12 +174,14 @@ public: ...@@ -168,12 +174,14 @@ public:
n_vcluster++; n_vcluster++;
int already_initialised;
MPI_Initialized(&already_initialised);
// Check if MPI is already initialized // Check if MPI is already initialized
if (global_mpi_init == false) if (!already_initialised)
{ {
MPI_Init(argc,argv); MPI_Init(argc,argv);
global_mpi_init = true;
} }
//! Get the total number of process //! Get the total number of process
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment