Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set Default CUDA Arch #43

Closed
mikemhenry opened this issue Nov 22, 2021 · 2 comments
Closed

Set Default CUDA Arch #43

mikemhenry opened this issue Nov 22, 2021 · 2 comments

Comments

@mikemhenry
Copy link
Collaborator

I think we need to add something like this:

cmake_minimum_required(VERSION)

if(NOT DEFINED CMAKE_CUDA_ARCHITECTURES)
  set(CMAKE_CUDA_ARCHITECTURES 75)
endif()

project(example LANGUAGES CUDA)

to our CMakeLists.txt.
That way if we are on a system that has nvcc but doesn't have a GPU, there is a fallback on which CUDA arch to build. I ran into this issue when building on conda-forge since they have nvcc in their pipeline but no GPU, so then the arch doesn't get set and the build fails.

I'll have to test this in a VM later, but let me know if you think this is unnecessary or handled in a better way.

@raimis
Copy link
Contributor

raimis commented Nov 23, 2021

The CI machines don't have GPUs, but CMake has no problems with nvcc (https://github.com/openmm/NNPOps/runs/4287486053):

-- Autodetected CUDA architecture(s): 3.5;5.0;5.2;6.0;6.1;7.0;7.5;8.0;8.6;8.6+PTX
-- Added CUDA NVCC flags for: -gencode;arch=compute_35,code=sm_35;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_52,code=sm_52;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_61,code=sm_61;-gencode;arch=compute_70,code=sm_70;-gencode;arch=compute_75,code=sm_75;-gencode;arch=compute_80,code=sm_80;-gencode;arch=compute_86,code=sm_86;-gencode;arch=compute_86,code=compute_86

@mikemhenry
Copy link
Collaborator Author

grumble I'm not sure what conda-forge is doing then with their cuda/nvcc setup since if I don't set the cuda arch I get CUDA_ARCHITECTURES is empty for target "cmTC_60975" so it must be a configuration issue then, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants