Skip to content

Conversation

@pmarguinaud
Copy link
Collaborator

Shared libraries are working with nvhpc 25.7; this PR will enable them.

@awnawab awnawab added the approved-for-ci Approved to run hpc-ci label Oct 21, 2025
## determine lib type
cmake_dependent_option(BUILD_SHARED_LIBS "Dynamically link field_api" ON "NOT (HAVE_ACC OR HAVE_OMP_OFFLOAD)" OFF)
if( HAVE_ACC OR HAVE_OMP_OFFLOAD )

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks a lot @pmarguinaud for testing and contributing this, it's great to be able to have shared libs with offload enabled. This is ok in principle, but it removes the ability for the user to manually ask for static builds. I propose something like this instead:

set( SHARED_LIBS_FOR_OFFLOAD_DEFAULT OFF )
if( CMAKE_Fortran_COMPILER_ID MATCHES "PGI|NVHPC" AND
    CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL 25.7.0)
    set( SHARED_LIBS_FOR_OFFLOAD_DEFAULT ON )
endif()
cmake_dependent_option(BUILD_SHARED_LIBS "Dynamically link field_api" ON "NOT (HAVE_ACC OR HAVE_OMP_OFFLOAD)" ${SHARED_LIBS_FOR_OFFLOAD_DEFAULT})

if( (HAVE_ACC OR HAVE_OMP_OFFLOAD) AND NOT ${SHARED_LIBS_FOR_OFFLOAD_DEFAULT} )
  ecbuild_warn("Enabling GPU offload forces static linking.")
endif()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved-for-ci Approved to run hpc-ci contributor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants