Commit cf63fb7c authored by Podhorszki, Norbert's avatar Podhorszki, Norbert Committed by Bolea Sanchez, Vicente Adolfo
Browse files

Version constants plus functions to retrieve list of available engines,...

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
parent 0a45ddee
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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/
+165 −0
Original line number Diff line number Diff line
/*
 * 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 <stdio.h>
#include <stdlib.h>

#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
+41 −0
Original line number Diff line number Diff line
/*
 * 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_ */
+1 −1
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@ add_executable(bpls ./bpls/bpls.cpp)
target_link_libraries(bpls
                      PUBLIC adios2_core adios2sys
                      PRIVATE adios2::thirdparty::pugixml $<$<PLATFORM_ID:Windows>: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
+45 −0
Original line number Diff line number Diff line
@@ -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);
    }
}

Loading