Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
espressomd
walberla_for_es
Commits
70f9ecfc
Commit
70f9ecfc
authored
Feb 12, 2019
by
Rudolf Weeber
Browse files
Make calling MPI_Finalize() at destruciotn of MPIManager switchable
parent
44357ad6
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/core/mpi/Environment.h
View file @
70f9ecfc
...
...
@@ -48,8 +48,8 @@ int main( int argc, char ** argv )
class
Environment
{
public:
Environment
(
int
&
argc
,
char
**
&
argv
,
bool
abortOnException
=
true
)
{
MPIManager
::
instance
()
->
initializeMPI
(
&
argc
,
&
argv
,
abortOnException
);
Environment
(
int
&
argc
,
char
**
&
argv
,
bool
abortOnException
=
true
,
bool
finalizeOnDestruction
=
true
)
{
MPIManager
::
instance
()
->
initializeMPI
(
&
argc
,
&
argv
,
abortOnException
,
finalizeOnDestruction
);
}
~
Environment
()
{
MPIManager
::
instance
()
->
finalizeMPI
();
...
...
src/core/mpi/MPIManager.cpp
View file @
70f9ecfc
...
...
@@ -90,7 +90,7 @@ void MPIManager::abort()
}
void
MPIManager
::
initializeMPI
(
int
*
argc
,
char
***
argv
,
bool
abortOnException
)
void
MPIManager
::
initializeMPI
(
int
*
argc
,
char
***
argv
,
bool
abortOnException
,
bool
finalizeOnDestruction
)
{
WALBERLA_MPI_SECTION
()
{
...
...
@@ -111,6 +111,7 @@ void MPIManager::initializeMPI( int* argc, char*** argv, bool abortOnException )
if
(
abortOnException
)
std
::
set_terminate
(
customTerminateHandler
);
finalizeOnDestruction_
=
finalizeOnDestruction
;
}
}
...
...
@@ -122,7 +123,8 @@ void MPIManager::finalizeMPI()
if
(
isMPIInitialized_
&&
!
currentlyAborting_
)
{
isMPIInitialized_
=
false
;
MPI_Finalize
();
if
(
finalizeOnDestruction_
)
MPI_Finalize
();
}
}
}
...
...
src/core/mpi/MPIManager.h
View file @
70f9ecfc
...
...
@@ -63,8 +63,9 @@ public:
* Configures the class, initializes numProcesses, worldRank
* the rank and comm variables are still invalid, until custom communicator is set up
* @param abortOnException if true, MPI_Abort is called in case of an uncaught exception
* @param finalizeOnDestruction if true, MPI_Finalize is called, when the instance is destructed.
*/
void
initializeMPI
(
int
*
argc
,
char
***
argv
,
bool
abortOnException
=
true
);
void
initializeMPI
(
int
*
argc
,
char
***
argv
,
bool
abortOnException
=
true
,
bool
finalizeOnDestruction
=
true
);
void
finalizeMPI
();
...
...
@@ -156,6 +157,8 @@ private:
bool
currentlyAborting_
;
bool
finalizeOnDestruction_
;
// Singleton
MPIManager
()
:
worldRank_
(
0
),
rank_
(
-
1
),
numProcesses_
(
1
),
comm_
(
MPI_COMM_NULL
),
isMPIInitialized_
(
false
),
cartesianSetup_
(
false
),
currentlyAborting_
(
false
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment