getkeops / keops

KErnel OPerationS, on CPUs and GPUs, with autodiff and without memory overflows
https://www.kernel-operations.io
MIT License
1.04k stars 63 forks source link

Update cmake minimum version to 3.18 #122

Closed keckj closed 3 years ago

keckj commented 3 years ago

Current cmake minimum version is set to cmake 3.10 in keops/pykeops/CMakeLists.txt. This version allows to define CMAKE_CUDA_STANDARD up to 14 as seen in the cmake documentation.

Using keops with a recent cuda version (>=11.1) leads to keops setting CMAKE_CUDA_STANDARD to 17 which is not supported by old cmake versions (this is done in keops/cuda.cmake). This results in the following cmake error:

CMake Error at CMakeLists.txt:342 (add_library):
  CUDA_STANDARD is set to invalid value '17'

and other errors result of the C++17 flags not being passed to nvcc:

pykeops/keops/core/formulas/maths/TensorDotNoTao.h(84): error: "auto" is not allowed here
pykeops/keops/core/formulas/maths/TensorDotNoTao.h(90): error: "auto" is not allowed here

In the end the build fails and keops fails with recipe for target 'libKeOpstorch...' failed.

Support for CMAKE_CUDA_STANDARD 17 and 20 have only been introduced recently in cmake 3.18. A simple fix would be to crash early by requiring a cmake version of a least 3.18 when cuda >=11.1 is detected (and maybe keep current cmake 3.10 for earlier cuda versions).

bcharlier commented 3 years ago

Hi @keckj ,

thanks for the clear feedback. 8e393893 includes the cmake 3.18 requirement when compiling cuda code with c++17 standard.

b.