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
It looks like bool types are currently only supported for attributes with our ADIOS2 backend.
Adding support for types with the same convention should be added, too.
To Reproduce
#include<openPMD/openPMD.hpp>
#include<array>
#include<iostream>
#include<memory>
#include<numeric>
#include<cstdlib>using std::cout;
usingnamespaceopenPMD;intmain(int argc, char *argv[])
{
// user input: size of matrix to write, default 3x3size_t size = (argc == 2 ? atoi(argv[1]) : 3);
// matrix dataset to write with values 0...size*size-1
std::array<bool, 3*3> global_data;
//std::iota(global_data.begin(), global_data.end(), 0.);
cout << "Set up a 2D square array (" << size << 'x' << size
<< ") that will be written\n";
// open file for writing
Series series = Series(
"../samples/3_write_serial.bp",
Access::CREATE
);
cout << "Created an empty " << series.iterationEncoding() << " Series\n";
MeshRecordComponent rho =
series
.iterations[1]
.meshes["rho"][MeshRecordComponent::SCALAR];
cout << "Created a scalar mesh Record with all required openPMD attributes\n";
Datatype datatype = determineDatatype<bool>();
Extent extent = {size, size};
Dataset dataset = Dataset(datatype, extent);
cout << "Created a Dataset of size " << dataset.extent[0] << 'x' << dataset.extent[1]
<< " and Datatype " << dataset.dtype << '\n';
rho.resetDataset(dataset);
cout << "Set the dataset properties for the scalar field rho in iteration 1\n";
series.flush();
cout << "File structure and required attributes have been written\n";
Offset offset = {0, 0};
rho.storeChunk(shareRaw(global_data), offset, extent);
cout << "Stored the whole Dataset contents as a single chunk, ""ready to write content\n";
series.flush();
cout << "Dataset content has been fully written\n";
/* The files in 'series' are still open until the object is destroyed, on * which it cleanly flushes and closes all open file handles. * When running out of scope on return, the 'Series' destructor is called.*/return0;
}
Set up a 2D square array (3x3) that will be written
Created an empty groupBased Series
Created a scalar mesh Record with all required openPMD attributes
Created a Dataset of size 3x3 and Datatype BOOL
Set the dataset properties for the scalar field rho in iteration 1
terminate called after throwing an instance of 'std::runtime_error'
what(): [ADIOS2] Trying to access dataset with unallowed datatype: BOOL
Aborted (core dumped)
Expected behavior
Let's apply the same convention as for attributes.
In order to avoid naming collisions, I would propose keep using __is_boolean__/ as prefix for the identifier for attributes and use another one, __is_boolean_var__/ for ADIOS variables.
Software Environment
version of openPMD-api: 0.13.2
installed openPMD-api via: from source
operating system: Ubuntu 20.04
machine: laptop
name and version of Python implementation: N/A
version of HDF5: N/A
version of ADIOS1: N/A
version of ADIOS2: 2.6.0
name and version of MPI: N/A
Additional context
In PIConGPU, we always just mapped bools to adios_unsigned_byte in ADIOS1 (BP3): ComputationalRadiationPhysics/picongpu#1756
This naturally means we cannot round-trip the type (we had no identifier).
I believe that for @PrometheusPi's particle mask flags with openPMD-api (radiation plugin), we do the same work-around at the moment. cc @franzpoeschel
The text was updated successfully, but these errors were encountered:
Describe the bug
It looks like
bool
types are currently only supported for attributes with our ADIOS2 backend.Adding support for types with the same convention should be added, too.
To Reproduce
Expected behavior
Let's apply the same convention as for attributes.
In order to avoid naming collisions, I would propose keep using
__is_boolean__/
as prefix for the identifier for attributes and use another one,__is_boolean_var__/
for ADIOS variables.Software Environment
Additional context
In PIConGPU, we always just mapped bools to
adios_unsigned_byte
in ADIOS1 (BP3): ComputationalRadiationPhysics/picongpu#1756This naturally means we cannot round-trip the type (we had no identifier).
I believe that for @PrometheusPi's particle mask flags with openPMD-api (radiation plugin), we do the same work-around at the moment. cc @franzpoeschel
The text was updated successfully, but these errors were encountered: