Reconcile supported compilers, cuda, and cmake versions
This change means that informative error messages will be printed when a user tries to build with a non-functional combination of cuda and compiler. Previously a (cryptic, though somewhat informative) cuda compilation failure error message would be printed.
Also removed some conditionals that are no longer needed with cmake minimum version being 3.18.
Example error using gcc-10.2 and cuda-11.0. If one does not set CMAKE_CUDA_ARCHITECTURES one gets the following error.
CUDA_ARCHITECTURES is empty for target "cmTC_baa5f".
If one then sets CMAKE_CUDA_ARCHITECTURES (for example, to 52) and deletes the build cache, then the following error appears.
CMake Error at /opt/tcbsys/cmake/3.22.1/share/cmake-3.22/Modules/CMakeDetermineCompilerId.cmake:726 (message):
Compiling the CUDA compiler identification source file
"CMakeCUDACompilerId.cu" failed.
Compiler: /opt/tcbsys/cuda/11.0/bin/nvcc
Build flags:
Id flags: --keep;--keep-dir;tmp;-gencode=arch=compute_52,code=sm_52 -v
The output was:
1
#$ _NVVM_BRANCH_=nvvm
#$ _SPACE_=
#$ _CUDART_=cudart
#$ _HERE_=/opt/tcbsys/cuda/11.0/bin
#$ _THERE_=/opt/tcbsys/cuda/11.0/bin
#$ _TARGET_SIZE_=
#$ _TARGET_DIR_=
#$ _TARGET_DIR_=targets/x86_64-linux
#$ TOP=/opt/tcbsys/cuda/11.0/bin/..
#$ NVVMIR_LIBRARY_DIR=/opt/tcbsys/cuda/11.0/bin/../nvvm/libdevice
#$
LD_LIBRARY_PATH=/opt/tcbsys/cuda/11.0/bin/../lib:/opt/tcbsys/cuda/11.0/lib64:/opt/tcbsys/gcc/10.2/lib64:/nethome/jjordan/libs/amber18/lib
#$
PATH=/opt/tcbsys/cuda/11.0/bin/../nvvm/bin:/opt/tcbsys/cuda/11.0/bin:/opt/tcbsys/cuda/11.0/bin:/opt/tcbsys/gcc/10.2/bin:/opt/tcbsys/cmake/3.22.1/bin:/nethome/jjordan/bin:/nethome/jjordan/.local/bin:/nethome/jjordan/libs/ninja:/nethome/jjordan/libs/openbabel-2.4.1/build/bin:/nethome/jjordan/libs/amber18/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
#$ INCLUDES="-I/opt/tcbsys/cuda/11.0/bin/../targets/x86_64-linux/include"
#$ LIBRARIES=
"-L/opt/tcbsys/cuda/11.0/bin/../targets/x86_64-linux/lib/stubs"
"-L/opt/tcbsys/cuda/11.0/bin/../targets/x86_64-linux/lib"
#$ CUDAFE_FLAGS=
#$ PTXAS_FLAGS=
#$ rm tmp/a_dlink.reg.c
#$ gcc -D__CUDA_ARCH__=520 -E -x c++ -DCUDA_DOUBLE_MATH_FUNCTIONS
-D__CUDACC__ -D__NVCC__
"-I/opt/tcbsys/cuda/11.0/bin/../targets/x86_64-linux/include"
-D__CUDACC_VER_MAJOR__=11 -D__CUDACC_VER_MINOR__=0
-D__CUDACC_VER_BUILD__=221 -include "cuda_runtime.h" -m64
"CMakeCUDACompilerId.cu" -o "tmp/CMakeCUDACompilerId.cpp1.ii"
In file included from
/opt/tcbsys/cuda/11.0/bin/../targets/x86_64-linux/include/cuda_runtime.h:83,
from <command-line>:
/opt/tcbsys/cuda/11.0/bin/../targets/x86_64-linux/include/crt/host_config.h:139:2:
error: #error -- unsupported GNU version! gcc versions later than 9 are not
supported! The nvcc flag '-allow-unsupported-compiler' can be used to
override this version check; however, using an unsupported host compiler
may cause compilation failure or incorrect run time execution. Use at your
own risk.
139 | #error -- unsupported GNU version! gcc versions later than 9 are not supported! The nvcc flag '-allow-unsupported-compiler' can be used to override this version check; however, using an unsupported host compiler may cause compilation failure or incorrect run time execution. Use at your own risk.
| ^~~~~
# --error 0x1 --
Call Stack (most recent call first):
/opt/tcbsys/cmake/3.22.1/share/cmake-3.22/Modules/CMakeDetermineCompilerId.cmake:6 (CMAKE_DETERMINE_COMPILER_ID_BUILD)
/opt/tcbsys/cmake/3.22.1/share/cmake-3.22/Modules/CMakeDetermineCompilerId.cmake:48 (__determine_compiler_id_test)
/opt/tcbsys/cmake/3.22.1/share/cmake-3.22/Modules/CMakeDetermineCUDACompiler.cmake:298 (CMAKE_DETERMINE_COMPILER_ID)
CMakeLists.txt:617 (enable_language)
The important text that a user would need to spot is unsupported GNU version! gcc versions later than 9 are not supported!
Note that I have validated that the results are the same both on the tcblab cluster and on Piz Daint.