Skip to content
Snippets Groups Projects
Commit da54b7ed authored by Martin Nolte's avatar Martin Nolte
Browse files

initialize rank and size even if MPI has been initialized outside of MPIHelper

[[Imported from SVN: r6298]]
parent a5e088e9
No related branches found
No related tags found
No related merge requests found
......@@ -211,13 +211,14 @@ namespace Dune
#if MPI_2
int wasInitialized = -1;
MPI_Initialized( &wasInitialized );
if(!wasInitialized) {
if(!wasInitialized)
#endif
{
rank_ = -1;
size_ = -1;
#endif
static int is_initialized = MPI_Init(&argc, &argv);
prevent_warning(is_initialized);
static int is_initialized = MPI_Init(&argc, &argv);
prevent_warning(is_initialized);
}
MPI_Comm_rank(MPI_COMM_WORLD,&rank_);
MPI_Comm_size(MPI_COMM_WORLD,&size_);
......@@ -226,9 +227,6 @@ namespace Dune
assert( size_ >= 1 );
dverb << "Called MPI_Init on p=" << rank_ << "!" << std::endl;
#if MPI_2
}
#endif
}
//! \brief calls MPI_Finalize
~MPIHelper()
......
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