NVIDIA / nvbench

CUDA Kernel Benchmarking Library
Apache License 2.0
481 stars 63 forks source link

Zero Documentation on CMAKE_CUDA_ARCHITECTURES values #128

Closed Qubitium closed 1 year ago

Qubitium commented 1 year ago

What are the values for CMAKE_CUDA_ARCHITECTURES? For example, for Ampere 3090 series.

Cannot find this value anywhere. Thanks.

jrhemstad commented 1 year ago

CMAKE_CUDA_ARCHITECTURES is a CMake option documented here: https://cmake.org/cmake/help/latest/variable/CMAKE_CUDA_ARCHITECTURES.html

It is used as the default value for CUDA_ARCHITECTURES on a CUDA target.

This option is akin to the architecture specification options in nvcc: https://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/#base-notation

You can look up the compute capability of a GPU here: https://developer.nvidia.com/cuda-gpus

So for your example of a 3090, the compute capability is 8.6. So to build both PTX and SASS for that GPU you would specify -DCMAKE_CUDA_ARCHITECTURES=86.

A nice feature starting with CMake 3.24 is the ability to say -DCMAKE_CUDA_ARCHITECTURES=native which will automatically detect the GPU on your system and build for that GPU.