IPPL-framework / ippl

IPPL is a C++ library to develop performance portable code for fully Eulerian, Lagrangian or hybrid Eulerian-Lagrangian methods.
https://ippl-framework.github.io/ippl/
GNU General Public License v3.0
16 stars 17 forks source link

Environment destructor causes error in cleanup #314

Open aaadelmann opened 3 days ago

aaadelmann commented 3 days ago

This was found in OPAX on Gwendolen

partial ==== backtrace (tid:2019130) ====

  1. ...
  2. 13 0x000000000022394b mca_pml_ucx_cleanup() ???:0
  3. 14 0x0000000000082a5f ompi_mpi_finalize() ???:0
  4. 15 0x0000000000d0cbcf ippl::mpi::Environment::~Environment() ???:0
  5. 16 0x000000000045033a std::default_delete::operator()() ???:0
  6. 17 0x00000000004501f2 std::unique_ptr<ippl::mpi::Environment, std::default_delete >::~unique_ptr() ???:0

It looks like mca_pml_ucx_cleanup( is triggering ompi_mpi_finalize() and subsequently in the Environment destructor

bool Environment::finalized() { int flag = 0; MPI_Finalized(&flag); return (flag != 0); }

In case I do not use Environment::finalized() the error goes away!

matt-frey commented 3 days ago

MPI_Finalized is only checking if the MPI environment got terminated with MPI_Finalize. I do not understand why the call to Environment::finalized in Environment::~Environment() causes the issue.