[PATCH] D75811: [CUDA] Choose default architecture based on CUDA installation
Raul Tambre via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Mar 14 23:58:13 PDT 2020
tambre added a comment.
In D75811#1923278 <https://reviews.llvm.org/D75811#1923278>, @csigg wrote:
> > I'll be adding a `CUDA_ROOT` option to CMake that will be passed to clang as `--cuda-path`.
>
> I'm not familiar with CMake and whether that option is picked up from an environment variable, but on Windows that environment variable that the CUDA installer sets is `CUDA_PATH`:
> https://docs.nvidia.com/cuda/cuda-installation-guide-microsoft-windows/index.html#build-customizations-for-existing-projects
CMake's FindCUDAToolkit <https://cmake.org/cmake/help/latest/module/FindCUDAToolkit.html> module indeed already uses `CUDA_PATH` on Windows.
> On Linux you are expected to add the <cuda root>/bin directory to the `PATH` environment variable.
The CMake way is to usually provide an environment variable alongside a CMake variable (e.g. `CUDACXX` and `CMAKE_CUDA_COMPILER`). The environment variable will be respected above, then the CMake variable if set (e.g. in a toolchain file) and finally CMake tries common paths, executable names, etc to find what it needs.
In D75811#1923280 <https://reviews.llvm.org/D75811#1923280>, @csigg wrote:
> > I've gone with the approach of trying the architectures in the most recent non-deprecated order – sm_52, sm_30.
>
> I'm curious why you added sm_52 (I'm currently writing bazel rules for better CUDA support, and I'm using just sm_30 because that's been nvcc's default for a while now).
> Do you consider sm_52 GPUs to be particularly common or does sm_52 introduce a commonly used feature?
> (fp16 requires sm_53, but I don't think that needs to be included in the out of the box experience)
I added sm_52 as the first one to try because support for sm_35, sm_37 and sm_50 is deprecated in CUDA 10.2.
CUDA 11 will probably remove them, so this ensures we're compatible with it ahead of time.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D75811/new/
https://reviews.llvm.org/D75811
More information about the cfe-commits
mailing list