Skip to content

Decay ReadWrite mode into adios2::Mode::Read if the file exists#943

Merged
ax3l merged 3 commits intoopenPMD:devfrom
franzpoeschel:fix-adios2-accessmode
Mar 23, 2021
Merged

Decay ReadWrite mode into adios2::Mode::Read if the file exists#943
ax3l merged 3 commits intoopenPMD:devfrom
franzpoeschel:fix-adios2-accessmode

Conversation

@franzpoeschel
Copy link
Contributor

@franzpoeschel franzpoeschel commented Mar 11, 2021

Bug detected while working on #855.
EDIT: Alright, found out why this bug was triggered by #855, but not previously. Until now, the ADIOS2 backend delayed the opening of the .bp file until an actual access happened. So this test never actually created the file for iteration 6, bypassing this bug. Now, with eager opening, this bug is exposed.

TODO:

  • Write test that exposes this
  • The test exposed the same issue in HDF5. Fix that in this PR too?
    That was a different issue. I wrote a little mesh dataset to that iteration in the test originally. Now, that iteration had a defined /meshesPath attribute. While reading the file back in some lines further down, the openPMD API expected to find meshes in the other iterations, too, didn't find any and crashed. Is our workflow with the meshesPath really that good right now?

std::cerr << "ADIOS2 does currently not yet implement ReadWrite "
"(Append) mode. "
<< "Replacing with Write mode." << std::endl;
return adios2::Mode::Write;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this safe to keep going instead of asking for another mode?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choosing read mode is safe anyway and write mode is only chosen if the file does not exist, so it should be safe, too. I can imagine that there might be issues in parallel, I should test how ADIOS2 behaves for that and potentially add an MPI barrier.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to some quick experiments I did, ADIOS does not create files on the disk if not all of the parallel writers have called Engine::open() yet. So we could leave it as it is or alternatively add an MPI Barrier for some extra safety.

@franzpoeschel franzpoeschel force-pushed the fix-adios2-accessmode branch from efc8c44 to a64a8bb Compare March 19, 2021 11:46
@ax3l ax3l merged commit 2f1798f into openPMD:dev Mar 23, 2021
ax3l added a commit to ax3l/openPMD-api that referenced this pull request Apr 9, 2021
…PMD#943)

* Decay ReadWrite mode into adios2::Mode::Read if the file exists
* Add test for read-write mode

Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants