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

Version constants plus functions to retrieve list of ... #3676

Merged
merged 4 commits into from
Aug 2, 2023

Conversation

pnorbert
Copy link
Contributor

available engines, operators and features. This is a C header but it's part of the core library.

Fixes #3630

$ bpls -Vv
blps: ADIOS file introspection utility

Build configuration:
ADIOS version: 2.9.0.144 (9a69cb875)
C++ Compiler:  GNU 9.4.0
Target OS:     Linux-5.15.90.1-microsoft-standard-WSL2
Target Arch:   x86_64
Available engines = 10: BP3, BP4, BP5, SST, SSC, Inline, MHS, ParaViewADIOSInSituEngine, Null, Skeleton
Available operators = 6: BZip2, Blosc, MGARD, MGARDPlus, ZFP, None
Available features = 4: MPI, Fortran, Python, AWSSDK

C example:

#include <stdio.h>
#include "adios2_libinfo.h"

int main (int argc, char *argv[])
{
    printf("ADIOS2 C lib version %d.%d.%d\n", adios2_version_major,
            adios2_version_minor, adios2_version_patch);
    printf("ADIOS2 C lib version str %s\n", adios2_version_str);

    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);

    return 0;
}

Build C example:

gcc -o test_adios2_libinfo -I/opt/adios2/include test_adios2_libinfo.c -Wl,-rpath,/opt/adios2/lib /opt/adios2/lib/libadios2_core.so.2.9

@pnorbert
Copy link
Contributor Author

@eschnett @ax3l Please review.

@pnorbert
Copy link
Contributor Author

@vicentebolea What went wrong here in the Ascent test? The Install.cmake.* tests failed but it's not clear what was wrong and what could be done about it.

@vicentebolea
Copy link
Collaborator

vicentebolea commented Jun 27, 2023 via email

anagainaru
anagainaru previously approved these changes Jun 29, 2023
Copy link
Contributor

@anagainaru anagainaru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested with the GPU backends and it looks good:

Available features = 4: MPI, Fortran, Python, Kokkos (Host, CUDA)

Copy link
Collaborator

@vicentebolea vicentebolea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, I am not too strong on the const char/char const, I can see that you are trying to make the char const *const ** easier to read. I can see both trade-offs, I am happy both ways :)

source/adios2/CMakeLists.txt Outdated Show resolved Hide resolved
source/adios2/core/adios2_libinfo.cpp Outdated Show resolved Hide resolved
source/utils/bpls/bpls.cpp Outdated Show resolved Hide resolved
source/adios2/core/adios2_libinfo.cpp Outdated Show resolved Hide resolved
source/adios2/core/adios2_libinfo.cpp Outdated Show resolved Hide resolved
source/adios2/core/adios2_libinfo.cpp Outdated Show resolved Hide resolved
source/adios2/core/adios2_libinfo.cpp Outdated Show resolved Hide resolved
source/adios2/core/adios2_libinfo.h Outdated Show resolved Hide resolved
@vicentebolea
Copy link
Collaborator

Clicking update branch with rebase should get rid of the failed tests in Ascent.

@vicentebolea
Copy link
Collaborator

@pnorbert I made the edit as per your request, I added a unit test just to be complete and made a few changes.

@vicentebolea
Copy link
Collaborator

@eisenhauer Norbert needs this in the incoming 2.9.1 release, he asked me to finish the task instead of him as he is not available at the moment. I wonder if you could review this

eisenhauer
eisenhauer previously approved these changes Aug 2, 2023
Copy link
Member

@eisenhauer eisenhauer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me...

@vicentebolea vicentebolea self-assigned this Aug 2, 2023
@vicentebolea vicentebolea added this to the v2.9.1 milestone Aug 2, 2023
vicentebolea
vicentebolea previously approved these changes Aug 2, 2023
@pnorbert
Copy link
Contributor Author

pnorbert commented Aug 2, 2023

Looks good to me, just please make sure a C code can still use this, nothing breaks with expecting C++.

@vicentebolea vicentebolea dismissed stale reviews from eisenhauer and themself via 6c4c723 August 2, 2023 17:22
@vicentebolea vicentebolea merged commit 490bed5 into ornladios:master Aug 2, 2023
25 checks passed
vicentebolea added a commit to vicentebolea/ADIOS2 that referenced this pull request Aug 2, 2023
Version constants plus functions to retrieve list of ...

(cherry picked from commit 490bed5)
vicentebolea added a commit that referenced this pull request Aug 3, 2023
* release_29:
  Bump version to v2.9.1
  Merge pull request #3676 from pnorbert/c_version2
  Merge pull request #3697 from ornladios/dependabot/pip/docs/cryptography-41.0.2
  Merge pull request #3698 from vicentebolea/add-gitattribute-file
  Merge pull request #3704 from ornladios/dependabot/pip/docs/pygments-2.15.0
  Merge pull request #3712 from ornladios/dependabot/pip/docs/certifi-2023.7.22
  Merge pull request #3687 from dmitry-ganyushin/i3646-mult-macos
  Merge pull request #3699 from vicentebolea/revert-normalize-eol
  Merge pull request #3689 from vicentebolea/fix-evpath-modules
@pnorbert pnorbert deleted the c_version2 branch September 1, 2023 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Want function to get ADIOS2 library version at run time
5 participants