Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows: Cannot create new files with Append mode #3358

Open
franzpoeschel opened this issue Oct 4, 2022 · 1 comment
Open

Windows: Cannot create new files with Append mode #3358

franzpoeschel opened this issue Oct 4, 2022 · 1 comment

Comments

@franzpoeschel
Copy link
Contributor

Describe the bug
On Linux, the Append mode can be used to create new files. On Windows, the program aborts if the file does not yet exist.

To Reproduce

#include <adios2.h>

int main()
{
    adios2::ADIOS adios;
    auto IO = adios.DeclareIO("adsf");
    auto engine = IO.Open("asdf.bp", adios2::Mode::Append);
}
cmake_minimum_required(VERSION 3.12.0)

project(adios_testing)
find_package(ADIOS2 REQUIRED)

add_executable(adios2_append adios2_append.cpp)
target_link_libraries(adios2_append PRIVATE adios2::cxx11)

Expected behavior
Creating a file with Append mode should consistently work on all supported platforms.
This is useful e.g. for simulation codes, e.g. setting Append mode by default, so that restarting from a checkpoint will not delete previous data, but append to the data.

Desktop (please complete the following information):

  • OS/Platform: Windows 10
  • Build: ADIOS2 v2.8.3, Visual Studio 2019 Compiler, Debug build

Additional context
Add any other context about the problem here.

Following up
Was the issue fixed? Please report back.

franzpoeschel added a commit to franzpoeschel/openPMD-api that referenced this issue Oct 4, 2022
ax3l added a commit to openPMD/openPMD-api that referenced this issue Oct 7, 2022
* Add failing test

* Allow creating file-based Series with Append mode

even if the specified directory does not exist

* Add Mpi.hpp with MPI helpers

Needed later for checking file presence in parallel situations

* Add CHECK_FILE IO task and implement in the backends

* Only write top-level attributes when really needed

* Enable Series creation in Append mode

* Add Windows CI workaround

* Windows Workaround: Fallback to Create mode

* Avoid MPI mocking, use ifdefs

Also use parallel logical or for file existence check

* Append mode: test in parallel

* Don't alias sendbfr and recvbfr

* Undo unused changes

* Remove unused Mock_MPI_Comm

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Replace MPI specializations by if constexpr

* Try making this constexpr

I think that this won't work with every MPI implementation

* Link ADIOS2 issue

ornladios/ADIOS2#3358

Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
@franzpoeschel
Copy link
Contributor Author

franzpoeschel commented Aug 10, 2023

Catching and printing the error:

[ADIOS2 EXCEPTION] <Toolkit> <transport::file::FileFStream> <CheckFile> : coudn't open file asdf.bp\data.0, check permissions or path existence, in call to fstream open : iostream stream error

@pnorbert suggested adding IO.AddTransport("file", {{"Library", "stdio"}});, this results in another error ("Invalid file open mode", 0).

As we have a workaround for this in our implementation, this is not really critical.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant