You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Trying to use the Span API in an engine opened with Append mode will lead to this error:
terminate called after throwing an instance of 'std::invalid_argument'
what(): [Wed Jun 07 15:43:29 2023] [ADIOS2 EXCEPTION] <Core> <Engine> <CheckOpenModes> : Engine open mode not valid for for variable somevariable, in call to Variable<T>::Span Put
To Reproduce
#include<adios2.h>
#include<numeric>intmain(int argsc, char **argsv)
{
constexprsize_t num_items = 100;
std::string engine = "bp5";
std::string filename = "append." + engine;
// Creating a file with append mode works fine
{
adios2::ADIOS adios;
auto IO = adios.DeclareIO("asdf");
IO.SetEngine(engine);
auto engine = IO.Open(filename, adios2::Mode::Append);
engine.BeginStep();
{
auto var = IO.DefineVariable<int>(
"somevariable", {num_items}, {0}, {num_items});
std::vector<int> data(num_items);
std::iota(data.begin(), data.end(), 0);
engine.Put(var, data.data());
}
engine.EndStep();
engine.Close();
}
// Appending to the file with normal Put() works too
{
adios2::ADIOS adios;
auto IO = adios.DeclareIO("asdf");
IO.SetEngine(engine);
auto engine = IO.Open(filename, adios2::Mode::Append);
engine.BeginStep();
{
auto var = IO.DefineVariable<int>(
"somevariable", {num_items}, {0}, {num_items});
std::vector<int> data(num_items);
std::iota(data.begin(), data.end(), 0);
engine.Put(var, data.data());
}
engine.EndStep();
engine.Close();
}
// Appending to the file with span Put() will crash
{
adios2::ADIOS adios;
auto IO = adios.DeclareIO("asdf");
IO.SetEngine(engine);
auto engine = IO.Open(filename, adios2::Mode::Append);
engine.BeginStep();
{
auto var = IO.DefineVariable<int>(
"somevariable", {num_items}, {0}, {num_items});
auto span = engine.Put(var);
int *ptr = &span[0];
std::iota(ptr, ptr + num_items, 0);
engine.EndStep();
}
engine.Close();
}
}
Describe the bug
Trying to use the Span API in an engine opened with Append mode will lead to this error:
To Reproduce
Replacing
bp5
withbp4
gives the same type of error.Expected behavior
The open mode verification should recognize the Append mode for Span-based Put.
Desktop (please complete the following information):
Following up
Was the issue fixed? Please report back.
The text was updated successfully, but these errors were encountered: