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

Modernize CMake #203

Merged
merged 1 commit into from
Sep 1, 2021
Merged

Modernize CMake #203

merged 1 commit into from
Sep 1, 2021

Conversation

SimeonEhrig
Copy link
Member

@SimeonEhrig SimeonEhrig commented Jul 7, 2021

The CMake is completely modernized. The main targets are

  • make cupla installable and findable via cmake find_package()
  • make the usage of add_subdirectory() more common
  • remove legacy cmake code

Address issue #158

TODO

  • setup initial CMakeLists.txt
  • remove legacy CMake code
  • overwork usage via add_subdirectory
  • allow to install cupla and use find_package()
  • add CI integration tests
  • enable examples
  • writing documentation!
  • create cupla release branch before this PR is merged

CMakeLists.txt Outdated Show resolved Hide resolved
CMakeLists.txt Outdated Show resolved Hide resolved
CMakeLists.txt Outdated Show resolved Hide resolved
@SimeonEhrig
Copy link
Member Author

@psychocoderHPC Ready for review

@SimeonEhrig
Copy link
Member Author

SimeonEhrig commented Jul 13, 2021

From the review in our developer meeting today:

  • force to build libcupla as archive file -> makes no sense to use shared lib, because libcupla is strongly depend of the build parameter of the project and avoids LD_LIBRARY_PATH problem
  • downgrade to CMake 3.18 -> same version like alpaka - we don't use any advantage of CMake 3.19

@psychocoderHPC
Copy link
Member

psychocoderHPC commented Jul 30, 2021

@SimeonEhrig Do you tested this PR with nvcc as CUDA compiler too? I working on moving alpaka 0.7.0 to cupla and integrated your changes. When try to use cmake with CUDA I get

cmake ../cupla -DCMAKE_INSTALL_PREFIX=$HOME/lib/cupla -Dcupla_BUILD_EXAMPLES=ON -DALPAKA_ACC_GPU_CUDA_ENABLE=ON
...
List of compiler flags added by alpaka
device compiler:
    $<$<COMPILE_LANGUAGE:CUDA>:--expt-relaxed-constexpr>;$<$<COMPILE_LANGUAGE:CUDA>:-Xcudafe=--display_error_number>;$<$<COMPILE_LANGUAGE:CUDA>:-Xcudafe=--diag_suppress=esa_on_defaulted_function_ignored>

-- Configuring done
CMake Error in CMakeLists.txt:
  No known features for CUDA compiler

  ""

  version .


cmake/cuplaTargetHelper.cmake Outdated Show resolved Hide resolved
@psychocoderHPC
Copy link
Member

@SimeonEhrig Do you tested this PR with nvcc as CUDA compiler too? I working on moving alpaka 0.7.0 to cupla and integrated your changes. When try to use cmake with CUDA I get

cmake ../cupla -DCMAKE_INSTALL_PREFIX=$HOME/lib/cupla -Dcupla_BUILD_EXAMPLES=ON -DALPAKA_ACC_GPU_CUDA_ENABLE=ON
...
List of compiler flags added by alpaka
device compiler:
    $<$<COMPILE_LANGUAGE:CUDA>:--expt-relaxed-constexpr>;$<$<COMPILE_LANGUAGE:CUDA>:-Xcudafe=--display_error_number>;$<$<COMPILE_LANGUAGE:CUDA>:-Xcudafe=--diag_suppress=esa_on_defaulted_function_ignored>

-- Configuring done
CMake Error in CMakeLists.txt:
  No known features for CUDA compiler

  ""

  version .

This error happens only with alpaka 0.7.0 so ignore it for now.

@SimeonEhrig
Copy link
Member Author

@SimeonEhrig Do you tested this PR with nvcc as CUDA compiler too? I working on moving alpaka 0.7.0 to cupla and integrated your changes. When try to use cmake with CUDA I get

cmake ../cupla -DCMAKE_INSTALL_PREFIX=$HOME/lib/cupla -Dcupla_BUILD_EXAMPLES=ON -DALPAKA_ACC_GPU_CUDA_ENABLE=ON
...
List of compiler flags added by alpaka
device compiler:
    $<$<COMPILE_LANGUAGE:CUDA>:--expt-relaxed-constexpr>;$<$<COMPILE_LANGUAGE:CUDA>:-Xcudafe=--display_error_number>;$<$<COMPILE_LANGUAGE:CUDA>:-Xcudafe=--diag_suppress=esa_on_defaulted_function_ignored>

-- Configuring done
CMake Error in CMakeLists.txt:
  No known features for CUDA compiler

  ""

  version .

This error happens only with alpaka 0.7.0 so ignore it for now.

We can't ignore alpaka 0.7.0. This PR should become part of cupla 0.4.0 which bases on alpaka 0.7.0.

@psychocoderHPC
Copy link
Member

@SimeonEhrig Do you tested this PR with nvcc as CUDA compiler too? I working on moving alpaka 0.7.0 to cupla and integrated your changes. When try to use cmake with CUDA I get

cmake ../cupla -DCMAKE_INSTALL_PREFIX=$HOME/lib/cupla -Dcupla_BUILD_EXAMPLES=ON -DALPAKA_ACC_GPU_CUDA_ENABLE=ON
...
List of compiler flags added by alpaka
device compiler:
    $<$<COMPILE_LANGUAGE:CUDA>:--expt-relaxed-constexpr>;$<$<COMPILE_LANGUAGE:CUDA>:-Xcudafe=--display_error_number>;$<$<COMPILE_LANGUAGE:CUDA>:-Xcudafe=--diag_suppress=esa_on_defaulted_function_ignored>

-- Configuring done
CMake Error in CMakeLists.txt:
  No known features for CUDA compiler

  ""

  version .

This error happens only with alpaka 0.7.0 so ignore it for now.

We can't ignore alpaka 0.7.0. This PR should become part of cupla 0.4.0 which bases on alpaka 0.7.0.

I played a little bit more with the error. If I install alpaka and use -Dcupla_ALPAKA_PROVIDER=external all works fine.
It could be that the issue will be solved with Kitware/CMake@a3cafa4 but this is currently in no release available.

@psychocoderHPC
Copy link
Member

I tested the latest master branch from CMake, the issue still exists, therefore something else is wrong :-(

- CMakeLists.txt can be included in Projects via add_subdirectory
 and find_package
- add mechanism to extract version number from header file (copied
 from alpaka - thanks to Jan stephan)
- add cuplaConfig.cmake and cuplaTargets.cmake
- add CMake integration tests
  - build external project, which uses cupla via
    - add_subdirectory() and internal alpaka
    - add_subdirectory() and external alpaka
    - find_package()
- add cmake option to build examples
@psychocoderHPC
Copy link
Member

We will not merge this PR directly, if #213 is merged this PR will be merged automatically.

@sbastrakov sbastrakov merged commit d586575 into alpaka-group:dev Sep 1, 2021
@fwyzard
Copy link
Contributor

fwyzard commented Sep 22, 2021

force to build libcupla as archive file -> makes no sense to use shared lib, because libcupla is strongly depend of the build parameter of the project and avoids LD_LIBRARY_PATH problem

FWIW, in CMSSW we have been building cupla as a shared library, even though we are not using it in production yet.
The rationale is that it would be linked to from many different shared libraries, so using a static archive would duplicate it into each shared library that uses it.

@SimeonEhrig
Copy link
Member Author

force to build libcupla as archive file -> makes no sense to use shared lib, because libcupla is strongly depend of the build parameter of the project and avoids LD_LIBRARY_PATH problem

FWIW, in CMSSW we have been building cupla as a shared library, even though we are not using it in production yet.
The rationale is that it would be linked to from many different shared libraries, so using a static archive would duplicate it into each shared library that uses it.

Good point. I opened an issue (#218 ) to address your comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants