Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Florian Weik
waLBerla
Commits
a3f0cf9e
Commit
a3f0cf9e
authored
Feb 12, 2019
by
RudolfWeeber
Committed by
Michael Kuron
Feb 13, 2019
Browse files
Only call MPI_Finalize if we actually called MPI_Init
parent
b6c6e2dd
Changes
2
Show whitespace changes
Inline
Side-by-side
src/core/mpi/MPIManager.cpp
View file @
a3f0cf9e
...
...
@@ -103,6 +103,7 @@ void MPIManager::initializeMPI( int* argc, char*** argv, bool abortOnException )
MPI_Initialized
(
&
mpiAlreadyInitialized
);
if
(
!
mpiAlreadyInitialized
)
{
MPI_Init
(
argc
,
argv
);
finalizeOnDestruction_
=
true
;
}
isMPIInitialized_
=
true
;
...
...
@@ -122,9 +123,12 @@ void MPIManager::finalizeMPI()
if
(
isMPIInitialized_
&&
!
currentlyAborting_
)
{
isMPIInitialized_
=
false
;
if
(
finalizeOnDestruction_
)
{
MPI_Finalize
();
}
}
}
}
...
...
src/core/mpi/MPIManager.h
View file @
a3f0cf9e
...
...
@@ -156,9 +156,12 @@ private:
bool
currentlyAborting_
;
bool
finalizeOnDestruction_
;
// Singleton
MPIManager
()
:
worldRank_
(
0
),
rank_
(
-
1
),
numProcesses_
(
1
),
comm_
(
MPI_COMM_NULL
),
isMPIInitialized_
(
false
),
cartesianSetup_
(
false
),
currentlyAborting_
(
false
)
isMPIInitialized_
(
false
),
cartesianSetup_
(
false
),
currentlyAborting_
(
false
),
finalizeOnDestruction_
(
false
)
{
WALBERLA_NON_MPI_SECTION
()
{
rank_
=
0
;
}
}
};
// class MPIManager
...
...
Write
Preview
Markdown
is supported
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