openPMD / openPMD/openPMD-api

Finalization order

Open
#1,122 2 comments 0 reactions 0 assignees View on GitHub
feature request
Dominant language
C++
Stars
161
Forks
59
Avg merge
2d 22h
Merged PRs (30d)
7

Description

Julia is a garbage collected language. That means that it is very difficult, if not impossible, to ensure that objects are finalized (destroyed) in a particular order or at a particular time. One particular problem is ensuring that the last openPMD object is finalized before `MPI_Finalize` is called.

This does not involve writing to files, since any correct code will need to call `Series::flush` or similar anyway. However, when a Series object is open in read-only mode, then it would be quite convenient to check, via calling `MPI_Finalized`, whether MPI is still active, and if not, forego certain parallel cleanup actions that have no externally visible consequences anyway since the application is already being shut down.

The symptoms I am seeing is output such as
```
Attempting to use an MPI routine after finalizing MPICH
```
which (presumably) is caused either by openPMD or by ADIOS2. At this time, a file `hello.bp` is probably still open for reading. It might also still be open for writing but has been flushed.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.