mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 21:55:41 -04:00
Make sure MPI_Type_free is not called if MPI hasn't been initialized
This commit is contained in:
parent
d9c66fc13f
commit
bbe5b7ba5e
2 changed files with 5 additions and 3 deletions
|
|
@ -127,7 +127,9 @@ int openmc_finalize()
|
|||
|
||||
// Free all MPI types
|
||||
#ifdef OPENMC_MPI
|
||||
MPI_Type_free(&mpi::bank);
|
||||
int init_called;
|
||||
MPI_Initialized(&init_called);
|
||||
if (init_called) MPI_Type_free(&mpi::bank);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ int n_procs {1};
|
|||
bool master {true};
|
||||
|
||||
#ifdef OPENMC_MPI
|
||||
MPI_Comm intracomm;
|
||||
MPI_Datatype bank;
|
||||
MPI_Comm intracomm {MPI_COMM_NULL};
|
||||
MPI_Datatype bank {MPI_DATATYPE_NULL};
|
||||
#endif
|
||||
|
||||
extern "C" bool openmc_master() { return mpi::master; }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue