alpaka-group / cupla

C++ User interface for the Platform independent Library Alpaka :arrows_clockwise:
Other
37 stars 18 forks source link

Modernize CMake #203

Closed SimeonEhrig closed 3 years ago

SimeonEhrig commented 3 years ago

The CMake is completely modernized. The main targets are

Address issue #158

TODO

SimeonEhrig commented 3 years ago

@psychocoderHPC Ready for review

SimeonEhrig commented 3 years ago

From the review in our developer meeting today:

psychocoderHPC commented 3 years ago

@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 .
psychocoderHPC commented 3 years ago

@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 commented 3 years ago

@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 commented 3 years ago

@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 https://github.com/Kitware/CMake/commit/a3cafa4237930d1ec1bcbdddc8a9c592e32458ca but this is currently in no release available.

psychocoderHPC commented 3 years ago

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

psychocoderHPC commented 3 years ago

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

fwyzard commented 3 years ago

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 commented 3 years ago

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.