diff --git a/include/openPMD/IO/AbstractIOHandlerImplCommon.hpp b/include/openPMD/IO/AbstractIOHandlerImplCommon.hpp index 7261b4bf71..4c995be817 100644 --- a/include/openPMD/IO/AbstractIOHandlerImplCommon.hpp +++ b/include/openPMD/IO/AbstractIOHandlerImplCommon.hpp @@ -28,10 +28,10 @@ #include "openPMD/auxiliary/StringManip.hpp" #include "openPMD/backend/Writable.hpp" +#include #include #include #include -#include namespace openPMD { @@ -50,7 +50,10 @@ class AbstractIOHandlerImplCommon : public AbstractIOHandlerImpl * without the OS path */ std::unordered_map m_files; - std::unordered_set m_dirty; + // MUST be an ordered set in order to consistently flush on different + // parallel processes (same logic cant apply to m_files since Writable* + // pointers are not predictable) + std::set m_dirty; enum PossiblyExisting { diff --git a/include/openPMD/IO/InvalidatableFile.hpp b/include/openPMD/IO/InvalidatableFile.hpp index 6bdc24cbe6..6ac0051cbe 100644 --- a/include/openPMD/IO/InvalidatableFile.hpp +++ b/include/openPMD/IO/InvalidatableFile.hpp @@ -82,4 +82,14 @@ struct hash result_type operator()(argument_type const &s) const noexcept; }; + +template <> +struct less +{ + using first_argument_type = openPMD::InvalidatableFile; + using second_argument_type = first_argument_type; + using result_type = typename std::less::result_type; + result_type + operator()(first_argument_type const &, second_argument_type const &) const; +}; } // namespace std diff --git a/src/IO/ADIOS/ADIOS2IOHandler.cpp b/src/IO/ADIOS/ADIOS2IOHandler.cpp index e9e5c7e53f..3f16bcf155 100644 --- a/src/IO/ADIOS/ADIOS2IOHandler.cpp +++ b/src/IO/ADIOS/ADIOS2IOHandler.cpp @@ -1747,7 +1747,7 @@ void ADIOS2IOHandlerImpl::listPaths( */ auto &fileData = getFileData(file, IfFileNotOpen::ThrowError); - std::unordered_set subdirs; + std::set subdirs; /* * When reading an attribute, we cannot distinguish * whether its containing "folder" is a group or a @@ -1889,7 +1889,7 @@ void ADIOS2IOHandlerImpl::listDatasets( auto &fileData = getFileData(file, IfFileNotOpen::ThrowError); - std::unordered_set subdirs; + std::set subdirs; for (auto var : fileData.availableVariablesPrefixed(myName)) { // if string still contains a slash, variable is a dataset below the diff --git a/src/IO/InvalidatableFile.cpp b/src/IO/InvalidatableFile.cpp index cb6930da2b..c4a5d2c69f 100644 --- a/src/IO/InvalidatableFile.cpp +++ b/src/IO/InvalidatableFile.cpp @@ -80,3 +80,9 @@ std::hash::operator()( return std::hash>{}( s.fileState); } +auto std::less::operator()( + first_argument_type const &first, second_argument_type const &second) const + -> result_type +{ + return less<>()(*first, *second); +}