-
Notifications
You must be signed in to change notification settings - Fork 51
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
ADIOS1 backend #126
ADIOS1 backend #126
Conversation
@@ -41,7 +41,7 @@ endfunction() | |||
|
|||
openpmd_option(MPI "Enable MPI support" AUTO) | |||
openpmd_option(HDF5 "Enable HDF5 support" AUTO) | |||
openpmd_option(ADIOS1 "Enable ADIOS1 support" OFF) | |||
openpmd_option(ADIOS1 "Enable ADIOS1 support" AUTO) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also occurs in README.md
, docs/source/dev/buildoptions.rst
and docs/source/dev/dependencies.rst
Determine and check the parallel/serial status of a found ADIOS1 lib
CMakeLists.txt
Outdated
#endif() | ||
# TODO we could support more combinations than MPI+pADIOS and noMPI+sADIOS | ||
if(openPMD_HAVE_MPI AND openPMD_HAVE_ADIOS1 AND ADIOS_HAVE_SEQUENTIAL) | ||
message(FATAL_ERROR "Found MPI but requested ADIOS1 is serial. " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are you sure a MPI-parallel ADIOS not not still ship a "sequential" component "as well"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The library itself might provide both, but with the used FindAdios.cmake
only mutually exclusive versions get linked. Since ADIOS has a unified interface (with dummy MPI if serial), I doubt you can link both simultaneously.
cmake/FindADIOS.cmake
Outdated
@@ -178,6 +179,9 @@ if(ADIOS_FOUND) | |||
endforeach() | |||
# we could append ${CMAKE_PREFIX_PATH} now but that is not really necessary | |||
|
|||
# determine whether found library is serial only |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can only determine:
- is serial and parallel
- is serial only
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, the vocabulary in this comment is not sufficient. This determines if the library links as serial only with the specified components.
The library itself might be serial + parallel.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok cool.
want I wanted to say is just: if you build serial, the lib/
dir will contain a regular and a _nompi
version, as far as I remember.
If you check that only the noMPI is linked this is fine, but you might want to prefer it someway during search and validate it with two adios installations (/w and /wo MPI), printing all vars to make sure. Also includes (and their #defines
) should match.
Bump required ADIOS1 version to 1.13.0. Enable serial ADIOS1 through -D_NOMPI. Enable tests according to used backends.
Move ADIOS1 logic form parallel to serial (dummy MPI allows for mostly the same code).
.travis/spack/packages.yaml
Outdated
@@ -16,6 +16,9 @@ packages: | |||
openmpi@1.6.5%gcc@7.2.0 arch=linux-ubuntu14-x86_64: /usr | |||
openmpi@1.6.5%clang@5.0.0 arch=linux-ubuntu14-x86_64: /usr | |||
buildable: False | |||
packages: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh oh, pls remove this single line
I think there is more to do for the CI than we can do in the next few days. |
This is probably not a problem with our build process. The errors are caused by timeouts during download of our dependencies (e.g. https://zlib.net was down yesterday). Now, Boost & HDF5 are horribly slow, but making progress. |
Yes, also that but I restarted them later on and saw some other issues, also spack-dependency-wise, that I need to investigate properly.
|
Remove not yet implemented status for ADIOS1. Bump required ADIOS1 version.
include/openPMD/auxiliary/Memory.hpp
Outdated
@@ -83,6 +99,9 @@ allocatePtr(Datatype dtype, size_t numPoints) | |||
data = new bool[numPoints]; | |||
del = [](void* p){ delete[] static_cast< bool* >(p); p = nullptr; }; | |||
break; | |||
case DT::STRING: | |||
/* user assings c_str pointer */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: assigns
src/IO/ADIOS/ADIOS1IOHandler.cpp
Outdated
dims.c_str(), | ||
global_dims.c_str(), | ||
local_offsets.c_str()); | ||
ASSERT(id >= 0 /* ??? */, "Internal error: Failed to define ADIOS variable during Dataset writing"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good candidate for a VERIFY
macro - seen this a lot in the last on startup/env issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very much agreed. We should not exclude these assertions in production code, unless the user really wants to.
src/IO/ADIOS/ADIOS1IOHandler.cpp
Outdated
break; | ||
} | ||
case DT::BOOL: | ||
throw std::runtime_error("No workaround for ADIOS1 bool implemented"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Current PIConGPU representation: ComputationalRadiationPhysics/picongpu#1756
also just as ints, unfortunately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently tinkering with this. Adapting the behaviour of using unsigned bytes for bools means we can store them but not read them back typesafe.
Having every uint8_t of value 0 be reinterpreted to a bool false and every uint8_t of value 1 be reinterpreted to a bool true is undesirable when reading a file.
Dataset opening, path & dataset listing. Change frontend logic to rely less on HDF5 backend implementation quirks. Working ADIOS test case.
Working ADIOS read test case. ADIOS attribute datatype test case.
To fit ADIOS's workflow better and to avoid redundant file open/file closing, separate the IO operations in ADIOS1 backend into two queues: Defines and file context preperation (m_setup) that gets drained before a file is opened for writing. Actual data transfers that require an open file but do not re-open it ( m_work).
1.13.1 is very mich desired.
@@ -126,8 +126,9 @@ join(std::vector< std::string > const& vs, std::string const& delimiter) | |||
default: | |||
std::ostringstream ss; | |||
std::copy(vs.begin(), | |||
vs.end(), | |||
vs.end() - 1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
o.0
this changes looks a bit unsave, e.g. for zero-lengths :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
offline discussion: add comment // do not append separator after last element
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The empty and size 1 vector cases are handled above ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, saw this too late :)
@C0nsultant can you pls add a little to-do list in the PR description what is still missing in this PR? :) Just curious :) |
I added the major two things that have me refrain from merging yet. |
Adapt the different ADIOS workflow to work with fileBased output. This requires closing and flushing open handles as ADIOS handles are only one-directional (in- or out-put).
sounds good. |
Treat booleans as unsigned bytes. This allows us to write them, but not read them back as bool (they are uint8_t).
Include new matcher functionality in tutorial.
ADIOS1 does not offer deletion inside files, so handle those request non-gracefully.
@C0nsultant but if I build the parallel version and satisfy the MPI dependency e.g. when running in mpiexec - can I still create a serial |
CMakeLists.txt
Outdated
@@ -301,6 +303,10 @@ if(openPMD_HAVE_ADIOS1) | |||
target_link_libraries(openPMD PUBLIC ${ADIOS_LIBRARIES}) | |||
target_include_directories(openPMD SYSTEM PUBLIC ${ADIOS_INCLUDE_DIRS}) | |||
target_compile_definitions(openPMD PUBLIC "-DopenPMD_HAVE_ADIOS1=1") | |||
if(ADIOS_HAVE_SEQUENTIAL) | |||
# TODO might be smarter to get ALL definitions from adios-config -s & parse it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, ideally in FindADIOS.cmake
we should populate ADIOS_DEFINITIONS
. We then use that var here.
CMakeLists.txt
Outdated
if(${examplename} MATCHES ".+parallel$") | ||
if(openPMD_HAVE_MPI) | ||
# Current examples all use HDF5, elaborate if other backends are used | ||
if(openPMD_HAVE_HDF5) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't exclude the build, just the test below is fine.
the examples should still be build and only throw errors at runtime if they try to use a backend that does not exist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I included the examples as tests in CI. With this approach, CI tests without HDF5 will always fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, the add_tests
are in the block below and properly guarded. Those are the runtimeand require HDF5 files and backend. but the compile should still be done.
case DT::UNDEFINED: | ||
throw std::runtime_error("Unknown Attribute datatype"); | ||
default: | ||
throw std::runtime_error("Datatype not implemented in HDF5 IO"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ADIOS :)
include/openPMD/Series.hpp
Outdated
/** Create a functor to determine if a file can be of a format given the filename on disk. | ||
* | ||
* @param name String containing desired filename without filename extension. | ||
* @param f File format to check plausibility for. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe write "backend applicability" instead of "plausibility"?
break; | ||
case DT::UNDEFINED: | ||
case DT::DATATYPE: | ||
throw std::runtime_error("Unknown Attribute datatype"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am wondering if one has still to break
after a throw...?
probably, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Execution at that point aborts until you reach the next mathcing catch
(if it reaches the top level, the process aborts). And even inside that catch, you can not possilbly recover to the point of failure (unless you use goto
-fuckery).
So no, there is no break
required after a throw
just like after a return
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, I was more wondering if the default
can be reached without the break
.
src/IO/ADIOS/ADIOS1IOHandler.cpp
Outdated
for( int i = 0; i < size; ++i ) | ||
{ | ||
vs[i] = auxiliary::strip(std::string(c[i], std::strlen(c[i])), {'\0'}); | ||
/* TODO pointer should be freed, but this causes memory curruption */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make this a doxygen todo please: /** @todo ...
char const* c = params.str().c_str(); | ||
|
||
int status; | ||
/* TODO ADIOS_READ_METHOD_BP_AGGREGATE */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//! @todo ...
REQUIRE(s.getAttribute("vecDouble").get< std::vector< double > >() == std::vector< double >({0., 1.79769e+308})); | ||
REQUIRE(s.getAttribute("vecLongdouble").get< std::vector< long double > >() == std::vector< long double >({0.L, 1.18973e+4932L})); | ||
REQUIRE(s.getAttribute("vecString").get< std::vector< std::string > >() == std::vector< std::string >({"vector", "of", "strings"})); | ||
REQUIRE(s.getAttribute("bool").get< uint8_t >() == static_cast< uint8_t >(true)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add a comment on bool reads please?
maybe we also want to write this in the manual in a section on "backends: features & limitations" or so.
|
||
TEST_CASE( "hzdr_adios1_sample_content_test", "[serial][adios1]" ) | ||
{ | ||
// since this file might not be publicly available, gracefully handle errors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add /** @todo add bp example files to https://github.com/openPMD/openPMD-example-datasets */
Yes. Yes, that always works with single-size MPI communicators. |
Use adios_config -c to get compile definitions.
Funny, I just saw this: https://github.com/ornladios/ADIOS/blob/v1.13.1/KNOWN_BUGS That means writing a var for each chunk's dimensions is indeed the right way to go in ADIOS1 ;) |
This adds both a serial and parallel ADIOS1 backend.
One potential drawback of this backend is that it can only mutually exclusively build a non-MPI/parallel version. This might induce contraints on other backends as well, depending on how they are built.
The implementation in this PR does the bare minimum to use ADIOS1 effectively:
Series::flush()
is called before new a variable is defined (there may be more complex ones that we have not recognized yet).