spirit-code / spirit

Atomistic Spin Simulation Framework
http://spirit-code.github.io
MIT License
118 stars 52 forks source link

compile error with cuda-11.4 "Define THRUST_IGNORE_CUB_VERSION_CHECK to ignore this." #602

Open zhouxzh opened 3 years ago

zhouxzh commented 3 years ago

When I compile the code with cuda-11.4, I got the following error massage. But I could correctly compile the code with cuda-10.0.

/usr/local/cuda-11.4/bin/../targets/x86_64-linux/include/thrust/system/cuda/config.h:78:2: error: #error The version of CUB in your include path is not compatible with this release of Thrust. CUB is now included in the CUDA Toolkit, so you no longer need to use your own checkout of CUB. Define THRUST_IGNORE_CUB_VERSION_CHECK to ignore this.
   78 | #error The version of CUB in your include path is not compatible with this release of Thrust. CUB is now included in the CUDA Toolkit, so you no longer need to use your own checkout of CUB. Define THRUST_IGNORE_CUB_VERSION_CHECK to ignore this.
      |  ^~~~~
make[2]: *** [core/CMakeFiles/Spirit.dir/build.make:141: core/CMakeFiles/Spirit.dir/src/engine/Hamiltonian_Heisenberg.cu.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:510: core/CMakeFiles/Spirit.dir/all] Error 2
make: *** [Makefile:163: all] Error 2

Ubuntu 20.04, gcc 9.3.0 cuda-11.4 Geforce 2080

GPMueller commented 3 years ago

If, as the message suggests, you add #define THRUST_IGNORE_CUB_VERSION_CHECK above the cub-includes here https://github.com/spirit-code/spirit/blob/14ed7782bd23f4828bf23ab8136ae31a21037bb3/core/include/engine/Backend_par.hpp#L7-L9 and here https://github.com/spirit-code/spirit/blob/14ed7782bd23f4828bf23ab8136ae31a21037bb3/core/src/engine/Vectormath.cu#L15-L18 does it compile fine again?


@MSallermann I suppose the better fix would be to exclude cub in cmake if the cuda-version is >= 11.0 (?which version exactly introduced cub?) and at some point support for older cuda-versions could be dropped.