ornladios / ADIOS2

Next generation of ADIOS developed in the Exascale Computing Program
https://adios2.readthedocs.io/en/latest/index.html
Apache License 2.0
268 stars 125 forks source link

Windows: Cannot create new files with Append mode #3358

Open franzpoeschel opened 1 year ago

franzpoeschel commented 1 year ago

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):

Additional context Add any other context about the problem here.

Following up Was the issue fixed? Please report back.

franzpoeschel commented 1 year ago

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.