From cf63fb7c6226beb4aefaa17f1ae6254c4f4bd40d Mon Sep 17 00:00:00 2001 From: Norbert Podhorszki Date: Thu, 22 Jun 2023 09:01:02 -0400 Subject: [PATCH 1/4] Version constants plus functions to retrieve list of available engines, operators and features. This is a C header but it's part of the core library --- source/adios2/CMakeLists.txt | 6 + source/adios2/core/adios2_libinfo.cpp | 165 ++++++++++++++++++++++++++ source/adios2/core/adios2_libinfo.h | 41 +++++++ source/utils/CMakeLists.txt | 2 +- source/utils/bpls/bpls.cpp | 45 +++++++ source/utils/bpls/bpls.h | 2 + 6 files changed, 260 insertions(+), 1 deletion(-) create mode 100644 source/adios2/core/adios2_libinfo.cpp create mode 100644 source/adios2/core/adios2_libinfo.h diff --git a/source/adios2/CMakeLists.txt b/source/adios2/CMakeLists.txt index cdd3a8d327..a6726ecd2f 100644 --- a/source/adios2/CMakeLists.txt +++ b/source/adios2/CMakeLists.txt @@ -18,6 +18,7 @@ add_library(adios2_core core/VariableBase.cpp core/Span.cpp core/Span.tcc core/Group.cpp core/Group.tcc + core/adios2_libinfo.cpp #operator operator/callback/Signature1.cpp @@ -404,6 +405,11 @@ install(FILES common/ADIOSMacros.h common/ADIOSTypes.h common/ADIOSTypes.inl install(DIRECTORY core/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/adios2/core COMPONENT adios2_core-development FILES_MATCHING PATTERN "*.h" + PATTERN "adios2_libinfo.h" EXCLUDE +) + +install(FILES core/adios2_libinfo.h + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT adios2_core-development ) install(DIRECTORY engine/ diff --git a/source/adios2/core/adios2_libinfo.cpp b/source/adios2/core/adios2_libinfo.cpp new file mode 100644 index 0000000000..cd83d92cb3 --- /dev/null +++ b/source/adios2/core/adios2_libinfo.cpp @@ -0,0 +1,165 @@ +/* + * Distributed under the OSI-approved Apache License, Version 2.0. See + * accompanying file Copyright.txt for details. + * + * adios2_libinfo.h + * + * Created on: June 22, 2023 + * Author: Norbert Podhorszki pnorbert@ornl.gov + */ + +#include "adios2_libinfo.h" +#include "adios2/common/ADIOSConfig.h" + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +const int adios2_version_major = ADIOS2_VERSION_MAJOR; +const int adios2_version_minor = ADIOS2_VERSION_MINOR; +const int adios2_version_patch = ADIOS2_VERSION_PATCH; +const char *const adios2_version_str = ADIOS2_VERSION_STR; + +static const char *aae[] = {"BP3", + "BP4", +#ifdef ADIOS2_HAVE_BP5 + "BP5", +#endif +#ifdef ADIOS2_HAVE_HDF5 + "HDF5", +#endif +#ifdef ADIOS2_HAVE_SST + "SST", +#endif +#ifdef ADIOS2_HAVE_MPI + "SSC", +#endif +#ifdef ADIOS2_HAVE_DataMan + "DataMan", +#endif +#ifdef ADIOS2_HAVE_DataSpaces + "DataSpaces", +#endif + "Inline", +#ifdef ADIOS2_HAVE_DAOS + "DAOS", +#endif +#ifdef ADIOS2_HAVE_MHS + "MHS", +#endif +#ifdef ADIOS2_HAVE_CATALYST + "ParaViewADIOSInSituEngine", +#endif + "Null", + "Skeleton", + nullptr}; + +void adios2_available_engines(int *nentries, char const ***list) +{ + int ne = 0; + while (aae[ne] != nullptr) + ++ne; + *nentries = ne; + *list = aae; + return; +} + +static const char *aao[] = { +#ifdef ADIOS2_HAVE_BZIP2 + "BZip2", +#endif +#ifdef ADIOS2_HAVE_BLOSC2 + "Blosc", +#endif +#ifdef ADIOS2_HAVE_MGARD + "MGARD", + "MGARDPlus", +#endif +#ifdef ADIOS2_HAVE_SZ + "SZ", +#endif +#ifdef ADIOS2_HAVE_ZFP + "ZFP", +#endif +#ifdef ADIOS2_HAVE_PNG + "PNG", +#endif +#ifdef ADIOS2_HAVE_SIRIUS + "Sirius", +#endif +#ifdef ADIOS2_HAVE_LIBPRESSIO + "libpressio", +#ifdef ADIOS2_HAVE_SODIUM + "Sodium plugin", +#endif +#endif + "None", + nullptr}; + +void adios2_available_operators(int *nentries, char const ***list) +{ + int no = 0; + while (aao[no] != nullptr) + ++no; + *nentries = no; + *list = aao; + return; +} + +static const char *aaf[] = { +#ifdef ADIOS2_HAVE_MPI + "MPI", +#endif +#ifdef ADIOS2_HAVE_FORTRAN + "Fortran", +#endif +#ifdef ADIOS2_HAVE_PYTHON + "Python", +#endif +#ifdef ADIOS2_HAVE_IME + "IME", +#endif +#ifdef ADIOS2_HAVE_UCX + "UCX", +#endif +#ifdef ADIOS2_HAVE_AWSSDK + "AWSSDK", +#endif + +#ifdef ADIOS2_HAVE_KOKKOS + "Kokkos (Host" +#ifdef ADIOS2_HAVE_KOKKOS_CUDA + ", CUDA" +#endif +#ifdef ADIOS2_HAVE_KOKKOS_HIP + ", HIP" +#endif +#ifdef ADIOS2_HAVE_KOKKOS_SYCL + ", SYCL" +#endif + ")" +#endif // ADIOS2_HAVE_KOKKOS + +#ifdef ADIOS2_HAVE_CUDA + "CUDA", +#endif + nullptr}; + +void adios2_available_features(int *nentries, char const ***list) +{ + int nf = 0; + while (aaf[nf] != nullptr) + ++nf; + *nentries = nf; + *list = aaf; + return; +} + +void adios2_free_list(int nentries, char const ***list) {} + +#ifdef __cplusplus +} // end extern C +#endif diff --git a/source/adios2/core/adios2_libinfo.h b/source/adios2/core/adios2_libinfo.h new file mode 100644 index 0000000000..29a6645616 --- /dev/null +++ b/source/adios2/core/adios2_libinfo.h @@ -0,0 +1,41 @@ +/* + * Distributed under the OSI-approved Apache License, Version 2.0. See + * accompanying file Copyright.txt for details. + * + * adios2_libinfo.h + * + * Created on: June 22, 2023 + * Author: Norbert Podhorszki pnorbert@ornl.gov + */ + +#ifndef ADIOS2_LIBINFO_H_ +#define ADIOS2_LIBINFO_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +extern const int adios2_version_major; +extern const int adios2_version_minor; +extern const int adios2_version_patch; +extern const char *const adios2_version_str; + +/** Return the list of available Engines in the installed adios2 library */ +void adios2_available_engines(int *nentries, char const ***list); + +/** Return the list of available Engines in the installed adios2 library */ +void adios2_available_operators(int *nentries, char const ***list); + +/** Return the list of available features in the installed adios2 library */ +void adios2_available_features(int *nentries, char const ***list); + +/** Free function for list returned by adios2_available_engines() and + * adios2_available_operators() + */ +void adios2_free_list(int nentries, char const ***list); + +#ifdef __cplusplus +} // end extern C +#endif + +#endif /* ADIOS2_LIBINFO_H_ */ diff --git a/source/utils/CMakeLists.txt b/source/utils/CMakeLists.txt index 227c176754..37153406c0 100644 --- a/source/utils/CMakeLists.txt +++ b/source/utils/CMakeLists.txt @@ -14,7 +14,7 @@ add_executable(bpls ./bpls/bpls.cpp) target_link_libraries(bpls PUBLIC adios2_core adios2sys PRIVATE adios2::thirdparty::pugixml $<$:shlwapi>) -target_include_directories(bpls PRIVATE ${PROJECT_BINARY_DIR}) +target_include_directories(bpls PRIVATE ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR}/bindings/C) set_property(TARGET bpls PROPERTY OUTPUT_NAME bpls${ADIOS2_EXECUTABLE_SUFFIX}) install(TARGETS bpls EXPORT adios2 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT adios2_tools-runtime diff --git a/source/utils/bpls/bpls.cpp b/source/utils/bpls/bpls.cpp index c7e6e166cc..8609fbf5c5 100644 --- a/source/utils/bpls/bpls.cpp +++ b/source/utils/bpls/bpls.cpp @@ -246,6 +246,51 @@ void print_bpls_version() } printf("Target OS: %s\n", ADIOS_INFO_SYSTEM); printf("Target Arch: %s\n", ADIOS_INFO_ARCH); + + int nengines; + char const **list_engines; + adios2_available_engines(&nengines, &list_engines); + printf("Available engines = %d:", nengines); + for (int i = 0; i < nengines; ++i) + { + printf(" %s", list_engines[i]); + if (i < nengines - 1) + { + printf(","); + } + } + printf("\n"); + adios2_free_list(nengines, &list_engines); + + int noperators; + char const **list_operators; + adios2_available_operators(&noperators, &list_operators); + printf("Available operators = %d:", noperators); + for (int i = 0; i < noperators; ++i) + { + printf(" %s", list_operators[i]); + if (i < noperators - 1) + { + printf(","); + } + } + printf("\n"); + adios2_free_list(noperators, &list_operators); + + int nfeatures; + char const **list_features; + adios2_available_features(&nfeatures, &list_features); + printf("Available features = %d:", nfeatures); + for (int i = 0; i < nfeatures; ++i) + { + printf(" %s", list_features[i]); + if (i < nfeatures - 1) + { + printf(","); + } + } + printf("\n"); + adios2_free_list(nfeatures, &list_features); } } diff --git a/source/utils/bpls/bpls.h b/source/utils/bpls/bpls.h index ffce2621b4..aca67f7cd5 100644 --- a/source/utils/bpls/bpls.h +++ b/source/utils/bpls/bpls.h @@ -14,6 +14,8 @@ #include "adios2/core/Variable.h" #include "adios2/helper/adiosFunctions.h" +#include "adios2/core/adios2_libinfo.h" + #include namespace adios2 From b677367afa39ff5c8e3b4a27ea5490037c99ae23 Mon Sep 17 00:00:00 2001 From: Norbert Podhorszki Date: Sun, 25 Jun 2023 13:24:19 -0400 Subject: [PATCH 2/4] add missing comma --- source/adios2/core/adios2_libinfo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/adios2/core/adios2_libinfo.cpp b/source/adios2/core/adios2_libinfo.cpp index cd83d92cb3..31da7a2fc0 100644 --- a/source/adios2/core/adios2_libinfo.cpp +++ b/source/adios2/core/adios2_libinfo.cpp @@ -140,7 +140,7 @@ static const char *aaf[] = { #ifdef ADIOS2_HAVE_KOKKOS_SYCL ", SYCL" #endif - ")" + ")", #endif // ADIOS2_HAVE_KOKKOS #ifdef ADIOS2_HAVE_CUDA From b9dec1e28ecea7bb3f88460df54f222d1dd89b45 Mon Sep 17 00:00:00 2001 From: Norbert Podhorszki Date: Mon, 26 Jun 2023 07:00:47 -0400 Subject: [PATCH 3/4] change const for list and remove free function --- source/adios2/core/adios2_libinfo.cpp | 8 +++----- source/adios2/core/adios2_libinfo.h | 11 +++-------- source/utils/bpls/bpls.cpp | 9 +++------ 3 files changed, 9 insertions(+), 19 deletions(-) diff --git a/source/adios2/core/adios2_libinfo.cpp b/source/adios2/core/adios2_libinfo.cpp index 31da7a2fc0..b36a2349e3 100644 --- a/source/adios2/core/adios2_libinfo.cpp +++ b/source/adios2/core/adios2_libinfo.cpp @@ -57,7 +57,7 @@ static const char *aae[] = {"BP3", "Skeleton", nullptr}; -void adios2_available_engines(int *nentries, char const ***list) +void adios2_available_engines(int *nentries, char const *const **list) { int ne = 0; while (aae[ne] != nullptr) @@ -99,7 +99,7 @@ static const char *aao[] = { "None", nullptr}; -void adios2_available_operators(int *nentries, char const ***list) +void adios2_available_operators(int *nentries, char const *const **list) { int no = 0; while (aao[no] != nullptr) @@ -148,7 +148,7 @@ static const char *aaf[] = { #endif nullptr}; -void adios2_available_features(int *nentries, char const ***list) +void adios2_available_features(int *nentries, char const *const **list) { int nf = 0; while (aaf[nf] != nullptr) @@ -158,8 +158,6 @@ void adios2_available_features(int *nentries, char const ***list) return; } -void adios2_free_list(int nentries, char const ***list) {} - #ifdef __cplusplus } // end extern C #endif diff --git a/source/adios2/core/adios2_libinfo.h b/source/adios2/core/adios2_libinfo.h index 29a6645616..662f43334d 100644 --- a/source/adios2/core/adios2_libinfo.h +++ b/source/adios2/core/adios2_libinfo.h @@ -21,18 +21,13 @@ extern const int adios2_version_patch; extern const char *const adios2_version_str; /** Return the list of available Engines in the installed adios2 library */ -void adios2_available_engines(int *nentries, char const ***list); +void adios2_available_engines(int *nentries, char const *const **list); /** Return the list of available Engines in the installed adios2 library */ -void adios2_available_operators(int *nentries, char const ***list); +void adios2_available_operators(int *nentries, char const *const **list); /** Return the list of available features in the installed adios2 library */ -void adios2_available_features(int *nentries, char const ***list); - -/** Free function for list returned by adios2_available_engines() and - * adios2_available_operators() - */ -void adios2_free_list(int nentries, char const ***list); +void adios2_available_features(int *nentries, char const *const **list); #ifdef __cplusplus } // end extern C diff --git a/source/utils/bpls/bpls.cpp b/source/utils/bpls/bpls.cpp index 8609fbf5c5..ec6171fda4 100644 --- a/source/utils/bpls/bpls.cpp +++ b/source/utils/bpls/bpls.cpp @@ -248,7 +248,7 @@ void print_bpls_version() printf("Target Arch: %s\n", ADIOS_INFO_ARCH); int nengines; - char const **list_engines; + char const *const *list_engines; adios2_available_engines(&nengines, &list_engines); printf("Available engines = %d:", nengines); for (int i = 0; i < nengines; ++i) @@ -260,10 +260,9 @@ void print_bpls_version() } } printf("\n"); - adios2_free_list(nengines, &list_engines); int noperators; - char const **list_operators; + char const *const *list_operators; adios2_available_operators(&noperators, &list_operators); printf("Available operators = %d:", noperators); for (int i = 0; i < noperators; ++i) @@ -275,10 +274,9 @@ void print_bpls_version() } } printf("\n"); - adios2_free_list(noperators, &list_operators); int nfeatures; - char const **list_features; + char const *const *list_features; adios2_available_features(&nfeatures, &list_features); printf("Available features = %d:", nfeatures); for (int i = 0; i < nfeatures; ++i) @@ -290,7 +288,6 @@ void print_bpls_version() } } printf("\n"); - adios2_free_list(nfeatures, &list_features); } } From 6c4c72359fac746e2b95b8d47c97dd636e50ee05 Mon Sep 17 00:00:00 2001 From: Vicente Adolfo Bolea Sanchez Date: Tue, 1 Aug 2023 20:24:55 -0400 Subject: [PATCH 4/4] Use CMake features; add unit test --- cmake/ADIOSFunctions.cmake | 2 + source/adios2/CMakeLists.txt | 6 +- source/adios2/common/ADIOSConfig.h.in | 2 + source/adios2/core/Info.cpp | 113 ++++++++++++ .../adios2/core/{adios2_libinfo.h => Info.h} | 18 +- source/adios2/core/adios2_libinfo.cpp | 163 ------------------ source/utils/bpls/bpls.cpp | 24 +-- source/utils/bpls/bpls.h | 2 +- testing/adios2/interface/CMakeLists.txt | 1 + testing/adios2/interface/TestADIOSInfo.cpp | 41 +++++ 10 files changed, 185 insertions(+), 187 deletions(-) create mode 100644 source/adios2/core/Info.cpp rename source/adios2/core/{adios2_libinfo.h => Info.h} (63%) delete mode 100644 source/adios2/core/adios2_libinfo.cpp create mode 100644 testing/adios2/interface/TestADIOSInfo.cpp diff --git a/cmake/ADIOSFunctions.cmake b/cmake/ADIOSFunctions.cmake index 36257e34d6..7d26bcc355 100644 --- a/cmake/ADIOSFunctions.cmake +++ b/cmake/ADIOSFunctions.cmake @@ -102,10 +102,12 @@ function(GenerateADIOSHeaderConfig) ") if(ADIOS2_HAVE_${OPT}) set(ADIOS2_HAVE_${OPT_UPPER} 1) + string(APPEND ADIOS2_CONFIG_FEATURE_LIST "\"${OPT_UPPER}\",") else() set(ADIOS2_HAVE_${OPT_UPPER}) endif() endforeach() + string(APPEND ADIOS2_CONFIG_FEATURE_LIST "nullptr") configure_file( ${ADIOS2_SOURCE_DIR}/source/adios2/common/ADIOSConfig.h.in diff --git a/source/adios2/CMakeLists.txt b/source/adios2/CMakeLists.txt index a6726ecd2f..6bdbcf38a8 100644 --- a/source/adios2/CMakeLists.txt +++ b/source/adios2/CMakeLists.txt @@ -18,7 +18,7 @@ add_library(adios2_core core/VariableBase.cpp core/Span.cpp core/Span.tcc core/Group.cpp core/Group.tcc - core/adios2_libinfo.cpp + core/Info.cpp #operator operator/callback/Signature1.cpp @@ -405,10 +405,10 @@ install(FILES common/ADIOSMacros.h common/ADIOSTypes.h common/ADIOSTypes.inl install(DIRECTORY core/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/adios2/core COMPONENT adios2_core-development FILES_MATCHING PATTERN "*.h" - PATTERN "adios2_libinfo.h" EXCLUDE + PATTERN "Info.h" EXCLUDE ) -install(FILES core/adios2_libinfo.h +install(FILES core/Info.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT adios2_core-development ) diff --git a/source/adios2/common/ADIOSConfig.h.in b/source/adios2/common/ADIOSConfig.h.in index 2fef35756b..ae0bccbb59 100644 --- a/source/adios2/common/ADIOSConfig.h.in +++ b/source/adios2/common/ADIOSConfig.h.in @@ -31,6 +31,8 @@ @ADIOS2_CONFIG_DEFINES@ +#define ADIOS2_FEATURE_LIST @ADIOS2_CONFIG_FEATURE_LIST@ + /* Everything between here and the note above is programatically generated */ #ifndef ADIOS2_USE_MPI diff --git a/source/adios2/core/Info.cpp b/source/adios2/core/Info.cpp new file mode 100644 index 0000000000..f6fab45756 --- /dev/null +++ b/source/adios2/core/Info.cpp @@ -0,0 +1,113 @@ +/* + * Distributed under the OSI-approved Apache License, Version 2.0. See + * accompanying file Copyright.txt for details. + * + * Info.h + * + * Created on: June 22, 2023 + * Author: Norbert Podhorszki pnorbert@ornl.gov + */ + +#include "Info.h" +#include "adios2/common/ADIOSConfig.h" + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +const int adios2_version_major = ADIOS2_VERSION_MAJOR; +const int adios2_version_minor = ADIOS2_VERSION_MINOR; +const int adios2_version_patch = ADIOS2_VERSION_PATCH; +const char adios2_version_str[] = ADIOS2_VERSION_STR; + +static const char *const engines[] = {"BP3", + "BP4", +#ifdef ADIOS2_HAVE_BP5 + "BP5", +#endif +#ifdef ADIOS2_HAVE_HDF5 + "HDF5", +#endif +#ifdef ADIOS2_HAVE_SST + "SST", +#endif +#ifdef ADIOS2_HAVE_MPI + "SSC", +#endif +#ifdef ADIOS2_HAVE_DataMan + "DataMan", +#endif +#ifdef ADIOS2_HAVE_DataSpaces + "DataSpaces", +#endif + "Inline", +#ifdef ADIOS2_HAVE_DAOS + "DAOS", +#endif +#ifdef ADIOS2_HAVE_MHS + "MHS", +#endif +#ifdef ADIOS2_HAVE_CATALYST + "ParaViewADIOSInSituEngine", +#endif + "Null", + "Skeleton", + nullptr}; + +void adios2_available_engines(size_t *nentries, const char *const **list) +{ + *nentries = (sizeof(engines) / sizeof(const char *)) - 1; + *list = engines; +} + +static const char *const operators[] = { +#ifdef ADIOS2_HAVE_BZIP2 + "BZip2", +#endif +#ifdef ADIOS2_HAVE_BLOSC2 + "Blosc", +#endif +#ifdef ADIOS2_HAVE_MGARD + "MGARD", + "MGARDPlus", +#endif +#ifdef ADIOS2_HAVE_SZ + "SZ", +#endif +#ifdef ADIOS2_HAVE_ZFP + "ZFP", +#endif +#ifdef ADIOS2_HAVE_PNG + "PNG", +#endif +#ifdef ADIOS2_HAVE_SIRIUS + "Sirius", +#endif +#ifdef ADIOS2_HAVE_LIBPRESSIO + "libpressio", +#ifdef ADIOS2_HAVE_SODIUM + "Sodium plugin", +#endif +#endif + nullptr}; + +void adios2_available_operators(size_t *nentries, const char *const **list) +{ + *nentries = (sizeof(operators) / sizeof(const char *)) - 1; + *list = operators; +} + +const char *adios2_feature_list[] = {ADIOS2_FEATURE_LIST}; + +void adios2_available_features(size_t *nentries, const char *const **list) +{ + *nentries = (sizeof(adios2_feature_list) / sizeof(const char *)) - 1; + *list = adios2_feature_list; +} + +#ifdef __cplusplus +} // end extern C +#endif diff --git a/source/adios2/core/adios2_libinfo.h b/source/adios2/core/Info.h similarity index 63% rename from source/adios2/core/adios2_libinfo.h rename to source/adios2/core/Info.h index 662f43334d..657cea1a0e 100644 --- a/source/adios2/core/adios2_libinfo.h +++ b/source/adios2/core/Info.h @@ -2,14 +2,16 @@ * Distributed under the OSI-approved Apache License, Version 2.0. See * accompanying file Copyright.txt for details. * - * adios2_libinfo.h + * Info.h * * Created on: June 22, 2023 * Author: Norbert Podhorszki pnorbert@ornl.gov */ -#ifndef ADIOS2_LIBINFO_H_ -#define ADIOS2_LIBINFO_H_ +#ifndef ADIOS2_INFO_H_ +#define ADIOS2_INFO_H_ + +#include #ifdef __cplusplus extern "C" { @@ -18,19 +20,19 @@ extern "C" { extern const int adios2_version_major; extern const int adios2_version_minor; extern const int adios2_version_patch; -extern const char *const adios2_version_str; +extern const char adios2_version_str[]; /** Return the list of available Engines in the installed adios2 library */ -void adios2_available_engines(int *nentries, char const *const **list); +void adios2_available_engines(size_t *nentries, const char *const **list); /** Return the list of available Engines in the installed adios2 library */ -void adios2_available_operators(int *nentries, char const *const **list); +void adios2_available_operators(size_t *nentries, const char *const **list); /** Return the list of available features in the installed adios2 library */ -void adios2_available_features(int *nentries, char const *const **list); +void adios2_available_features(size_t *nentries, const char *const **list); #ifdef __cplusplus } // end extern C #endif -#endif /* ADIOS2_LIBINFO_H_ */ +#endif /* ADIOS2_INFO_H_ */ diff --git a/source/adios2/core/adios2_libinfo.cpp b/source/adios2/core/adios2_libinfo.cpp deleted file mode 100644 index b36a2349e3..0000000000 --- a/source/adios2/core/adios2_libinfo.cpp +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Distributed under the OSI-approved Apache License, Version 2.0. See - * accompanying file Copyright.txt for details. - * - * adios2_libinfo.h - * - * Created on: June 22, 2023 - * Author: Norbert Podhorszki pnorbert@ornl.gov - */ - -#include "adios2_libinfo.h" -#include "adios2/common/ADIOSConfig.h" - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -const int adios2_version_major = ADIOS2_VERSION_MAJOR; -const int adios2_version_minor = ADIOS2_VERSION_MINOR; -const int adios2_version_patch = ADIOS2_VERSION_PATCH; -const char *const adios2_version_str = ADIOS2_VERSION_STR; - -static const char *aae[] = {"BP3", - "BP4", -#ifdef ADIOS2_HAVE_BP5 - "BP5", -#endif -#ifdef ADIOS2_HAVE_HDF5 - "HDF5", -#endif -#ifdef ADIOS2_HAVE_SST - "SST", -#endif -#ifdef ADIOS2_HAVE_MPI - "SSC", -#endif -#ifdef ADIOS2_HAVE_DataMan - "DataMan", -#endif -#ifdef ADIOS2_HAVE_DataSpaces - "DataSpaces", -#endif - "Inline", -#ifdef ADIOS2_HAVE_DAOS - "DAOS", -#endif -#ifdef ADIOS2_HAVE_MHS - "MHS", -#endif -#ifdef ADIOS2_HAVE_CATALYST - "ParaViewADIOSInSituEngine", -#endif - "Null", - "Skeleton", - nullptr}; - -void adios2_available_engines(int *nentries, char const *const **list) -{ - int ne = 0; - while (aae[ne] != nullptr) - ++ne; - *nentries = ne; - *list = aae; - return; -} - -static const char *aao[] = { -#ifdef ADIOS2_HAVE_BZIP2 - "BZip2", -#endif -#ifdef ADIOS2_HAVE_BLOSC2 - "Blosc", -#endif -#ifdef ADIOS2_HAVE_MGARD - "MGARD", - "MGARDPlus", -#endif -#ifdef ADIOS2_HAVE_SZ - "SZ", -#endif -#ifdef ADIOS2_HAVE_ZFP - "ZFP", -#endif -#ifdef ADIOS2_HAVE_PNG - "PNG", -#endif -#ifdef ADIOS2_HAVE_SIRIUS - "Sirius", -#endif -#ifdef ADIOS2_HAVE_LIBPRESSIO - "libpressio", -#ifdef ADIOS2_HAVE_SODIUM - "Sodium plugin", -#endif -#endif - "None", - nullptr}; - -void adios2_available_operators(int *nentries, char const *const **list) -{ - int no = 0; - while (aao[no] != nullptr) - ++no; - *nentries = no; - *list = aao; - return; -} - -static const char *aaf[] = { -#ifdef ADIOS2_HAVE_MPI - "MPI", -#endif -#ifdef ADIOS2_HAVE_FORTRAN - "Fortran", -#endif -#ifdef ADIOS2_HAVE_PYTHON - "Python", -#endif -#ifdef ADIOS2_HAVE_IME - "IME", -#endif -#ifdef ADIOS2_HAVE_UCX - "UCX", -#endif -#ifdef ADIOS2_HAVE_AWSSDK - "AWSSDK", -#endif - -#ifdef ADIOS2_HAVE_KOKKOS - "Kokkos (Host" -#ifdef ADIOS2_HAVE_KOKKOS_CUDA - ", CUDA" -#endif -#ifdef ADIOS2_HAVE_KOKKOS_HIP - ", HIP" -#endif -#ifdef ADIOS2_HAVE_KOKKOS_SYCL - ", SYCL" -#endif - ")", -#endif // ADIOS2_HAVE_KOKKOS - -#ifdef ADIOS2_HAVE_CUDA - "CUDA", -#endif - nullptr}; - -void adios2_available_features(int *nentries, char const *const **list) -{ - int nf = 0; - while (aaf[nf] != nullptr) - ++nf; - *nentries = nf; - *list = aaf; - return; -} - -#ifdef __cplusplus -} // end extern C -#endif diff --git a/source/utils/bpls/bpls.cpp b/source/utils/bpls/bpls.cpp index ec6171fda4..462598d90a 100644 --- a/source/utils/bpls/bpls.cpp +++ b/source/utils/bpls/bpls.cpp @@ -247,11 +247,11 @@ void print_bpls_version() printf("Target OS: %s\n", ADIOS_INFO_SYSTEM); printf("Target Arch: %s\n", ADIOS_INFO_ARCH); - int nengines; - char const *const *list_engines; + size_t nengines; + const char *const *list_engines; adios2_available_engines(&nengines, &list_engines); - printf("Available engines = %d:", nengines); - for (int i = 0; i < nengines; ++i) + printf("Available engines = %zu:", nengines); + for (size_t i = 0; i < nengines; ++i) { printf(" %s", list_engines[i]); if (i < nengines - 1) @@ -261,11 +261,11 @@ void print_bpls_version() } printf("\n"); - int noperators; - char const *const *list_operators; + size_t noperators; + const char *const *list_operators; adios2_available_operators(&noperators, &list_operators); - printf("Available operators = %d:", noperators); - for (int i = 0; i < noperators; ++i) + printf("Available operators = %zu:", noperators); + for (size_t i = 0; i < noperators; ++i) { printf(" %s", list_operators[i]); if (i < noperators - 1) @@ -275,11 +275,11 @@ void print_bpls_version() } printf("\n"); - int nfeatures; - char const *const *list_features; + size_t nfeatures; + const char *const *list_features; adios2_available_features(&nfeatures, &list_features); - printf("Available features = %d:", nfeatures); - for (int i = 0; i < nfeatures; ++i) + printf("Available features = %zu:", nfeatures); + for (size_t i = 0; i < nfeatures; ++i) { printf(" %s", list_features[i]); if (i < nfeatures - 1) diff --git a/source/utils/bpls/bpls.h b/source/utils/bpls/bpls.h index aca67f7cd5..f0a715a94f 100644 --- a/source/utils/bpls/bpls.h +++ b/source/utils/bpls/bpls.h @@ -14,7 +14,7 @@ #include "adios2/core/Variable.h" #include "adios2/helper/adiosFunctions.h" -#include "adios2/core/adios2_libinfo.h" +#include "adios2/core/Info.h" #include diff --git a/testing/adios2/interface/CMakeLists.txt b/testing/adios2/interface/CMakeLists.txt index 050be805b9..25d7ccbf8b 100644 --- a/testing/adios2/interface/CMakeLists.txt +++ b/testing/adios2/interface/CMakeLists.txt @@ -29,3 +29,4 @@ gtest_add_tests_helper(Selection MPI_NONE ADIOS Interface. .BP3 gtest_add_tests_helper(Selection MPI_NONE ADIOS Interface. .BPfile WORKING_DIRECTORY ${BPfile_DIR} EXTRA_ARGS "BPfile") gtest_add_tests_helper(NoMpi MPI_NONE ADIOS Interface. "") +gtest_add_tests_helper(Info MPI_NONE ADIOS Interface. "") diff --git a/testing/adios2/interface/TestADIOSInfo.cpp b/testing/adios2/interface/TestADIOSInfo.cpp new file mode 100644 index 0000000000..b719537ab3 --- /dev/null +++ b/testing/adios2/interface/TestADIOSInfo.cpp @@ -0,0 +1,41 @@ +#include +#include + +TEST(ADIOSInterface, info_available_features) +{ + size_t nfeatures = 0; + const char *const *list_features = nullptr; + adios2_available_features(&nfeatures, &list_features); + + EXPECT_GE(nfeatures, 0); + EXPECT_NE(list_features, nullptr); + EXPECT_EQ(list_features[nfeatures], nullptr); +} + +TEST(ADIOSInterface, info_available_engines) +{ + size_t nengines = 0; + const char *const *list_engines = nullptr; + adios2_available_engines(&nengines, &list_engines); + + EXPECT_GE(nengines, 1); + EXPECT_NE(list_engines, nullptr); + EXPECT_EQ(list_engines[nengines], nullptr); +} + +TEST(ADIOSInterface, info_available_operators) +{ + size_t noperators = 0; + const char *const *list_operators = nullptr; + adios2_available_operators(&noperators, &list_operators); + + EXPECT_GE(noperators, 0); + EXPECT_NE(list_operators, nullptr); + EXPECT_EQ(list_operators[noperators], nullptr); +} + +int main(int argc, char **argv) +{ + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +}