CMake idiom regarding minimum microarchitecture checking

57 Views Asked by At

Suppose I have a CUDA project and I'm writing its CMakeLists.txt.

In my project, I have several .cu source files with kernels, each of which has a minimum NVIDIA microarchitecture version it supports.

In my CMakeLists.txt, I would like to be able to...

  • Detect, or at least be able to specify, this minimum uarch of each file (not the set of uarchitectures to build for - a minimum for which the target may be built).
  • (perhaps) Compute and print the intersection of these acceptable ranges of compute capabuilties (since I've only talked about minimum - it's the maximum of the minima).
  • Have CMake configuration fail if there are no GPUs on the system supporting a uarch in the intersection (... unless this is a cross-build, in which case the user has specified the target architecture/s and the build system GPUs are irrelevant).
  • Be able to specify which GPU I'm targetting, so that only its CC is checked against the range of acceptable uarches/CC values.

I don't really see any of that when looking at the documentation, e.g. at the CUDA_ARCHITECTURES and CMAKE_CUDA_ARCHITECTURES pages.

1

There are 1 best solutions below

0
On

Apparently, CMake does not support this. I have filed a bug with Kitware for adding such support via a source file property and some set arithmetic during configuration time.