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

GPU branches: Missing dependency imports in ectrans-import.cmake #92

Open
reuterbal opened this issue Apr 25, 2024 · 2 comments
Open

GPU branches: Missing dependency imports in ectrans-import.cmake #92

reuterbal opened this issue Apr 25, 2024 · 2 comments

Comments

@reuterbal
Copy link
Contributor

For $reason I attempted a standalone build of redgreengpu (outside of a bundle) on an NVIDIA GPU machine and link IFS in a bundle build against it. (I can share more details if required.)

In that scenario, ectrans is imported into ifs-source via the CMake config files. The link interfaces in ectrans-targets.cmake include (correctly) CUDA::cufft, CUDA::cublas and OpenACC::OpenACC_Fortran. However, the dependencies to CUDAToolkit and OpenACC are not captured in the corresponding ectrans-import.cmake.

The import file does correctly issue the dependencies on OpenMP and fiat, but from a quick glance I wasn't able to figure out how to achieve the same for OpenACC, CUDA and CUDAToolkit. Manually editing the file and adding the following worked:

    if( NOT CMAKE_CUDA_COMPILER_LOADED )
        enable_language( CUDA )
    endif()
    find_dependency( CUDAToolkit )
    find_package( OpenACC )
    if( OpenACC_Fortran_FOUND AND OpenACC_C_FOUND )
        set( OpenACC_FOUND ON )
    endif()

For some reason, using find_dependency(OpenACC) did not work and made the entire ectrans import fail. Using instead find_package and doing the usual set(OpenACC_FOUND ON) hack worked.

Presumably, similar issues would appear with HIP on AMD platforms, and are likely affecting the optimised GPU branch, too.

@wdeconinck might have an idea where the CMake needs to be changed for this?

@wdeconinck
Copy link
Collaborator

wdeconinck commented May 2, 2024

Hi @reuterbal which version of CMake is used?

From my tests of a "find_package( CUDAToolkit )" it is not required that CUDA is enabled as language, so that find_dependency( CUDAToolkit ) should be sufficient.

CUDA should also not be required for find_package( OpenACC )
The reason that find_dependency( OpenACC ) might not have worked here, is when you have this triggered due to
find_package( ectrans REQUIRED )
it then implicitly adds the REQUIRED keyword to all find_dependency: find_dependency( OpenACC REQUIRED ) which fails due to the "usual" workaround issue. That is in fact the only difference between find_package and find_dependency: find_dependency inherits REQUIRED from the parent find_package.

@reuterbal
Copy link
Contributor Author

Thanks! As discussed offline, CUDA is probably redundant, I didn't check this carefully enough.

The CMake version was 3.24.3, so you're likely right that this may be the issue with OpenACC_FOUND not being set.

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

No branches or pull requests

2 participants