Skip to content
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

ADIOS2: Require v2.9 as minimum #1711

Open
wants to merge 11 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ spack:
hdf5:
variants: ~mpi
adios2:
variants: ~mpi ~zfp ~sz ~png ~dataman ~python ~fortran ~ssc ~shared ~bzip2
variants: ~mpi ~zfp ~sz ~png ~dataman ~python ~fortran ~ssc ~shared ~bzip2 ~mgard
cmake:
externals:
- spec: [email protected]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#
spack:
specs:
- adios2
- adios2@2.10
- hdf5
- openmpi

Expand Down
2 changes: 1 addition & 1 deletion .github/ci/spack-envs/clang8_py38_mpich_h5_ad2/spack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#
spack:
specs:
- adios2@2.7.1
- adios2@2.10
- hdf5
- mpich

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#
spack:
specs:
- adios2
- adios2@2.10
- hdf5
- openmpi

Expand Down
2 changes: 1 addition & 1 deletion .github/ci/spack-envs/gcc7_py36_ompi_h5_ad2/spack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#
spack:
specs:
- adios2
- adios2@2.10
- hdf5
- openmpi

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dependencies/install_spack
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

set -eu -o pipefail

spack_ver="0.17.1"
spack_ver="0.22.3"

cd /opt
if [[ -d spack && ! -f spack_${spack_ver} ]]
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ jobs:
mpiexec --version
perl --version
python --version
sudo ln -s "$(which cmake)" /usr/bin/cmake
eval $(spack env activate --sh .github/ci/spack-envs/clang7_nopy_ompi_h5_ad2_libcpp/)
spack install

Expand Down Expand Up @@ -99,6 +100,7 @@ jobs:
- name: Build
env: {CC: clang-7, CXX: clang++-7, CXXFLAGS: -Werror}
run: |
sudo ln -s "$(which cmake)" /usr/bin/cmake
eval $(spack env activate --sh .github/ci/spack-envs/clang7_nopy_ompi_h5_ad2/)
spack install

Expand Down Expand Up @@ -184,6 +186,7 @@ jobs:
mpiexec --version
perl --version
python --version
sudo ln -s "$(which cmake)" /usr/bin/cmake
eval $(spack env activate --sh .github/ci/spack-envs/clang8_py38_mpich_h5_ad2/)
spack install

Expand Down Expand Up @@ -235,6 +238,7 @@ jobs:
- name: Build
env: {CC: gcc-7, CXX: g++-7, CXXFLAGS: -Werror}
run: |
sudo ln -s "$(which cmake)" /usr/bin/cmake
eval $(spack env activate --sh .github/ci/spack-envs/gcc7_py36_ompi_h5_ad2/)
spack install

Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/tooling.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
- name: Build
env: {CC: clang, CXX: clang++}
run: |
sudo ln -s "$(which cmake)" /usr/bin/cmake
eval $(spack env activate --sh .github/ci/spack-envs/clangtidy_nopy_ompi_h5_ad2/)
spack install

Expand Down Expand Up @@ -54,6 +55,7 @@ jobs:
- name: Build
env: {CC: mpicc, CXX: mpic++, OMPI_CC: clang-10, OMPI_CXX: clang++-10, CXXFLAGS: -Werror, OPENPMD_HDF5_CHUNKS: none, OPENPMD_TEST_NFILES_MAX: 100}
run: |
sudo ln -s "$(which cmake)" /usr/bin/cmake
eval $(spack env activate --sh .github/ci/spack-envs/clangtidy_nopy_ompi_h5_ad2/)
spack install
SOURCEPATH="$(pwd)"
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -365,14 +365,14 @@ if(openPMD_HAVE_MPI)
list(APPEND openPMD_REQUIRED_ADIOS2_COMPONENTS MPI)
endif()
if(openPMD_USE_ADIOS2 STREQUAL AUTO)
find_package(ADIOS2 2.7.0 CONFIG COMPONENTS ${openPMD_REQUIRED_ADIOS2_COMPONENTS})
find_package(ADIOS2 2.9.0 CONFIG COMPONENTS ${openPMD_REQUIRED_ADIOS2_COMPONENTS})
if(ADIOS2_FOUND)
set(openPMD_HAVE_ADIOS2 TRUE)
else()
set(openPMD_HAVE_ADIOS2 FALSE)
endif()
elseif(openPMD_USE_ADIOS2)
find_package(ADIOS2 2.7.0 REQUIRED CONFIG COMPONENTS ${openPMD_REQUIRED_ADIOS2_COMPONENTS})
find_package(ADIOS2 2.9.0 REQUIRED CONFIG COMPONENTS ${openPMD_REQUIRED_ADIOS2_COMPONENTS})
set(openPMD_HAVE_ADIOS2 TRUE)
else()
set(openPMD_HAVE_ADIOS2 FALSE)
Expand Down
4 changes: 0 additions & 4 deletions include/openPMD/IO/ADIOS/ADIOS2Auxiliary.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,7 @@ namespace detail
case adios2::Mode::Write:
return false;
case adios2::Mode::Read:
#if openPMD_HAS_ADIOS_2_8
case adios2::Mode::ReadRandomAccess:
#endif
return true;
case adios2::Mode::Undefined:
case adios2::Mode::Sync:
Expand All @@ -217,9 +215,7 @@ namespace detail
case adios2::Mode::Write:
return true;
case adios2::Mode::Read:
#if openPMD_HAS_ADIOS_2_8
case adios2::Mode::ReadRandomAccess:
#endif
return false;
case adios2::Mode::Undefined:
case adios2::Mode::Sync:
Expand Down
13 changes: 0 additions & 13 deletions include/openPMD/IO/ADIOS/macros.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,6 @@

#include <adios2.h>

/*
* ADIOS2 v2.8 brings mode::ReadRandomAccess
*/
#define openPMD_HAS_ADIOS_2_8 \
(ADIOS2_VERSION_MAJOR * 100 + ADIOS2_VERSION_MINOR >= 208)
/*
* ADIOS2 v2.9 brings modifiable attributes (technically already in v2.8, but
* there are too many bugs, so we only support it beginning with v2.9).
* Group table feature requires ADIOS2 v2.9.
*/
#define openPMD_HAS_ADIOS_2_9 \
(ADIOS2_VERSION_MAJOR * 100 + ADIOS2_VERSION_MINOR >= 209)

#define openPMD_HAS_ADIOS_2_10 \
(ADIOS2_VERSION_MAJOR * 100 + ADIOS2_VERSION_MINOR >= 210)

Expand Down
23 changes: 1 addition & 22 deletions src/IO/ADIOS/ADIOS2File.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -428,8 +428,6 @@ void ADIOS2File::configure_IO()
// these properties are inferred from the opened dataset in read mode
if (writeOnly(m_mode))
{

#if openPMD_HAS_ADIOS_2_9
if (!m_impl->m_useGroupTable.has_value())
{
switch (m_impl->m_handler->m_encoding)
Expand All @@ -456,15 +454,6 @@ void ADIOS2File::configure_IO()
? ADIOS2IOHandlerImpl::ModifiableAttributes::Yes
: ADIOS2IOHandlerImpl::ModifiableAttributes::No;
}
#else
if (!m_impl->m_useGroupTable.has_value())
{
m_impl->m_useGroupTable = UseGroupTable::No;
}

m_impl->m_modifiableAttributes =
ADIOS2IOHandlerImpl::ModifiableAttributes::No;
#endif
}

// set engine type
Expand Down Expand Up @@ -764,9 +753,7 @@ adios2::Engine &ADIOS2File::getEngine()
streamStatus = StreamStatus::DuringStep;
break;
}
#if openPMD_HAS_ADIOS_2_8
case adios2::Mode::ReadRandomAccess:
#endif
case adios2::Mode::Read: {
m_engine =
std::make_optional(adios2::Engine(m_IO.Open(m_file, m_mode)));
Expand Down Expand Up @@ -1320,9 +1307,7 @@ void ADIOS2File::markActive(Writable *writable)
{
case UseGroupTable::No:
break;
case UseGroupTable::Yes:
#if openPMD_HAS_ADIOS_2_9
{
case UseGroupTable::Yes: {
if (writeOnly(m_mode) && m_impl->m_writeAttributesFromThisRank)
{
auto currentStepBuffered = currentStep();
Expand All @@ -1346,12 +1331,6 @@ void ADIOS2File::markActive(Writable *writable)
m_pathsMarkedAsActive.end());
}
}
#else
(void)writable;
throw error::OperationUnsupportedInBackend(
m_impl->m_handler->backendName(),
"Group table feature requires ADIOS2 >= v2.9.");
#endif
break;
}
}
Expand Down
84 changes: 8 additions & 76 deletions src/IO/ADIOS/ADIOS2IOHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,21 +293,6 @@ void ADIOS2IOHandlerImpl::init(
defaultOperators = std::move(operators.value());
}
}
#if !openPMD_HAS_ADIOS_2_9
if (m_modifiableAttributes == ModifiableAttributes::Yes)
{
throw error::OperationUnsupportedInBackend(
m_handler->backendName(),
"Modifiable attributes require ADIOS2 >= v2.9.");
}
if (m_useGroupTable.has_value() &&
m_useGroupTable.value() == UseGroupTable::Yes)
{
throw error::OperationUnsupportedInBackend(
m_handler->backendName(),
"ADIOS2 group table feature requires ADIOS2 >= v2.9.");
}
#endif
}

std::optional<std::vector<ADIOS2IOHandlerImpl::ParameterizedOperator>>
Expand Down Expand Up @@ -378,7 +363,7 @@ std::string ADIOS2IOHandlerImpl::fileSuffix(bool verbose) const
{
// SST engine adds its suffix unconditionally
// so we don't add it
#if openPMD_HAVE_ADIOS2_BP5 && openPMD_HAS_ADIOS_2_9
#if openPMD_HAVE_ADIOS2_BP5
constexpr char const *const default_file_ending = ".bp5";
#else
constexpr char const *const default_file_ending = ".bp4";
Expand Down Expand Up @@ -661,12 +646,9 @@ void ADIOS2IOHandlerImpl::createFile(
// print this warning only in the new layout (with group table)
if (m_useGroupTable.value_or(UseGroupTable::No) ==
UseGroupTable::Yes &&
(m_engineType == "bp5"
#if openPMD_HAS_ADIOS_2_9
|| (m_engineType == "file" || m_engineType == "filestream" ||
m_engineType == "bp")
#endif
))
(m_engineType == "bp5" ||
(m_engineType == "file" || m_engineType == "filestream" ||
m_engineType == "bp")))
{
std::cerr << warningADIOS2NoGroupbasedEncoding << std::endl;
printedWarningsAlready.noGroupBased = true;
Expand Down Expand Up @@ -775,13 +757,7 @@ void ADIOS2IOHandlerImpl::createDataset(
"[ADIOS2] Creating a dataset in a file opened as read "
"only is not possible.");
}
#if !openPMD_HAS_ADIOS_2_9
if (parameters.joinedDimension.has_value())
{
error::throwOperationUnsupportedInBackend(
"ADIOS2", "Joined Arrays require ADIOS2 >= v2.9");
}
#endif

if (!writable->written)
{
/* Sanitize name */
Expand Down Expand Up @@ -1073,14 +1049,6 @@ void ADIOS2IOHandlerImpl::writeAttribute(
{
return;
}
#if !openPMD_HAS_ADIOS_2_9
if (parameters.changesOverSteps ==
Parameter<Operation::WRITE_ATT>::ChangesOverSteps::Yes)
{
// cannot do this
return;
}
#endif
switchType<detail::AttributeWriter>(
parameters.dtype, this, writable, parameters);
}
Expand Down Expand Up @@ -1552,12 +1520,8 @@ adios2::Mode ADIOS2IOHandlerImpl::adios2AccessMode(
constexpr std::array<pair_t, 4> modeNames{
pair_t{"write", adios2::Mode::Write},
pair_t{"read", adios2::Mode::Read},
pair_t{"append", adios2::Mode::Append}
#if openPMD_HAS_ADIOS_2_8
,
pair_t{"readrandomaccess", adios2::Mode::ReadRandomAccess}
#endif
};
pair_t{"append", adios2::Mode::Append},
pair_t{"readrandomaccess", adios2::Mode::ReadRandomAccess}};
for (auto const &[name, mode] : modeNames)
{
if (name == access_mode_string)
Expand Down Expand Up @@ -1589,7 +1553,6 @@ adios2::Mode ADIOS2IOHandlerImpl::adios2AccessMode(
return adios2::Mode::Append;
}
break;
#if openPMD_HAS_ADIOS_2_8
case Access::READ_LINEAR:
switch (m_handler->m_encoding)
{
Expand All @@ -1603,11 +1566,6 @@ adios2::Mode ADIOS2IOHandlerImpl::adios2AccessMode(
break;
case Access::READ_ONLY:
return adios2::Mode::ReadRandomAccess;
#else
case Access::READ_LINEAR:
case Access::READ_ONLY:
return adios2::Mode::Read;
#endif
case Access::READ_WRITE:
if (auxiliary::directory_exists(fullPath) ||
auxiliary::file_exists(fullPath))
Expand All @@ -1622,11 +1580,7 @@ adios2::Mode ADIOS2IOHandlerImpl::adios2AccessMode(
case adios_defs::OpenFileAs::Create:
return adios2::Mode::Write;
case adios_defs::OpenFileAs::Open:
#if openPMD_HAS_ADIOS_2_8
return adios2::Mode::ReadRandomAccess;
#else
return adios2::Mode::Read;
#endif
case adios_defs::OpenFileAs::ReopenFileThatWeCreated:
/* In order to write new data to an Iteration that was
* created and closed previously, the only applicable access
Expand Down Expand Up @@ -1921,12 +1875,10 @@ namespace detail
adios2::IO IO = filedata.m_IO;
impl->m_dirty.emplace(std::move(file));

#if openPMD_HAS_ADIOS_2_9
if (impl->m_modifiableAttributes ==
ADIOS2IOHandlerImpl::ModifiableAttributes::No &&
parameters.changesOverSteps ==
Parameter<Operation::WRITE_ATT>::ChangesOverSteps::No)
#endif // we only support modifiable attrs for ADIOS2 >= 2.9, so no `if`
{
std::string t = IO.AttributeType(fullName);
if (!t.empty()) // an attribute is present <=> it has a type
Expand Down Expand Up @@ -1987,41 +1939,21 @@ namespace detail
}

auto &value = std::get<T>(parameters.resource);
#if openPMD_HAS_ADIOS_2_9
bool modifiable = impl->m_modifiableAttributes ==
ADIOS2IOHandlerImpl::ModifiableAttributes::Yes ||
parameters.changesOverSteps !=
Parameter<Operation::WRITE_ATT>::ChangesOverSteps::No;
#else
bool modifiable = impl->m_modifiableAttributes ==
ADIOS2IOHandlerImpl::ModifiableAttributes::Yes ||
parameters.changesOverSteps ==
Parameter<Operation::WRITE_ATT>::ChangesOverSteps::Yes;
#endif

auto defineAttribute =
[&IO, &fullName, &modifiable, &impl](auto const &...args) {
#if openPMD_HAS_ADIOS_2_9
(void)impl;
auto attr = IO.DefineAttribute(
fullName,
args...,
/* variableName = */ "",
/* separator = */ "/",
/* allowModification = */ modifiable);
#else
/*
* Defensive coding, normally this condition should be checked
* before getting this far.
*/
if (modifiable)
{
throw error::OperationUnsupportedInBackend(
impl->m_handler->backendName(),
"Modifiable attributes require ADIOS2 >= v2.8.");
}
auto attr = IO.DefineAttribute(fullName, args...);
#endif

if (!attr)
{
throw std::runtime_error(
Expand Down
Loading
Loading