parsec
parsec copied to clipboard
CMake 3.26 fails due to missing CUDA_ARCHITECTURES
On xsdk, with the following modules loaded CMake fails:
$ module list
Currently Loaded Modulefiles:
1) ncurses/6.4/gcc-9.5.0-vqn4xj 5) numactl/2.0.14/gcc-9.5.0-dyxri7 9) gdbm/1.23/gcc-9.5.0-5wbzex 13) perl/5.36.0/gcc-9.5.0-mwcs4w
2) cmake/3.26.3/gcc-9.5.0-dhly6i 6) openmpi/4.1.5/gcc-9.5.0-pbscs6 10) sqlite/3.40.1/gcc-9.5.0-xvfh2h 14) git/2.40.0/gcc-9.5.0-tuvipl
3) cuda/11.8.0/gcc-9.5.0-tuyfl7 7) intel-oneapi-mkl/2023.1.0/gcc-9.5.0-ytnolx 11) python/3.10.10/gcc-9.5.0-m4pa6k 15) gcc/11.3.0/gcc-9.5.0-kpiwtc
4) hwloc/2.9.1/gcc-9.5.0-6is6iv 8) boost/1.82.0/gcc-9.5.0-nx5nk4 12) gdb/13.1/gcc-9.5.0-ysvglt
(there is a newer version of CUDA but that doesn't work with any installed OMPI module, afaics)
CMake complains about missing CUDA_ARCHITECTURES:
CMake Error in build/_deps/parsec-src/tests/dsl/dtd/CMakeLists.txt:
CUDA_ARCHITECTURES is empty for target "dtd_test_new_tile".
CMake Warning (dev) in tests/unit/CMakeLists.txt:
Policy CMP0104 is not set: CMAKE_CUDA_ARCHITECTURES now detected for NVCC,
empty CUDA_ARCHITECTURES not allowed. Run "cmake --help-policy CMP0104"
for policy details. Use the cmake_policy command to set the policy and
suppress this warning.
CUDA_ARCHITECTURES is empty for target "core-unittests-ttg-mad".
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) in tests/unit/CMakeLists.txt:
Policy CMP0104 is not set: CMAKE_CUDA_ARCHITECTURES now detected for NVCC,
empty CUDA_ARCHITECTURES not allowed. Run "cmake --help-policy CMP0104"
for policy details. Use the cmake_policy command to set the policy and
suppress this warning.
CUDA_ARCHITECTURES is empty for target "core-unittests-ttg-parsec".
This warning is for project developers. Use -Wno-dev to suppress it.
See https://cmake.org/cmake/help/latest/policy/CMP0104.html.
Not sure how to fix this. We cannot force a CUDA architecture that works on all platforms, or can we?
Mhh, this happens when PaRSEC is built as part of TTG, not when I try to build it by itself. Strange.
My understanding of CMP0104 is that if we want the same level of portability as the local nvcc provides, we should set CUDA_ARCHITECTURES to OFF if it is not set to something else by the user. This would have basically the same effect as going to the status before the policy change, and I don't see how we could decide what the user needs (especially since in many cases, the user compiles on a node that doesn't have a GPU, so we can't decide what architectures we need to support).
An alternative is to let CMake complain, and the user will have to select which architectures they want (good luck to them).
A second alternative is to detect the problem and ask ourselves for the user to set the variable (or set it to OFF AND warn that we set it to OFF).
Mhh, this happens when PaRSEC is built as part of TTG, not when I try to build it by itself. Strange.
I think it's because we enable the CUDA language in TTG, when we don't enable the CUDA language in the parsec master. This only happens when we put nvcc in the loop, as basically now CMake requires to know what architecture flags to pass to nvcc, or to explicitly pass no architecture flags.
The error message is somewhat misleading. Policy CMP0104 is not set actually means that it is not set but implicitly NEW (because of cmake_required_version(3.18)).
We may want to explicitly set it to OLD to avoid dealing with the problem, but that means we have to update ourselves the list of architectures.