Skip to content

Cuda build errors in Windows 10 and 11 using VS 2022 #1567

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

Closed
alevonian opened this issue Jun 18, 2023 · 5 comments
Closed

Cuda build errors in Windows 10 and 11 using VS 2022 #1567

alevonian opened this issue Jun 18, 2023 · 5 comments

Comments

@alevonian
Copy link

Can anyone help me resolve these cuda errors?
The setup goes for for a long time then I eventually error out.
I am not using ninja in the setup.py

C:/Program Files (x86)/Windows Kits/10//include/10.0.19041.0//um\combaseapi.h(356): warning #174-D: expression has no effect

C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.7/include\cub/device/dispatch/dispatch_segmented_sort.cuh(338): error: invalid combination of type specifiers

C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.7/include\cub/device/dispatch/dispatch_segmented_sort.cuh(338): error: expected an identifier

C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.7/include\cub/device/dispatch/dispatch_segmented_sort.cuh(379): error: expected a member name

3 errors detected in the compilation of "C:/Projects/pytorch3d/pytorch3d/csrc/pulsar/cuda/renderer.backward.gpu.cu".
error: command 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\bin\nvcc.exe' failed with exit code 2
PS C:\Projects\pytorch3d>

@artths
Copy link

artths commented Jun 19, 2023

Just had the same error when building with CUDA 11.8 and PyTorch 2.0.1 under Windows 11.
Add the "-DWIN32_LEAN_AND_MEAN" flag to the nvcc_args in setup.py. This helped me.
Based on this microsoft/onnxruntime#11578

@bottler
Copy link
Contributor

bottler commented Jun 19, 2023

This is similar to #1227 which might help you fix.

@artths
Copy link

artths commented Jun 19, 2023

This is similar to #1227 which might help you fix.

Not sure about CUDA 11.7, but it doesn't work for 11.8.
It's not a CUB version issue either way. Following microsoft/onnxruntime#11578 fix: "A Windows SDK header #defines small, which clashes with a typedef in the CUDA 11.6 (and possibly other versions) headers."

@alevonian
Copy link
Author

Hah! So yes, that link mentions replacing cub directory (C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\include\cub) with NVIDIA cub 1.17. Also you have to define THRUST_IGNORE_CUB_VERSION_CHECK in version.cuh for it to build, otherwise it throws a cub version mismatch.
But it worked!
Thanks!

@TerryLiu007
Copy link

This is similar to #1227 which might help you fix.

Not sure about CUDA 11.7, but it doesn't work for 11.8. It's not a CUB version issue either way. Following microsoft/onnxruntime#11578 fix: "A Windows SDK header #defines small, which clashes with a typedef in the CUDA 11.6 (and possibly other versions) headers."

Built on Windows10 with cuda 11.8 and torch 2.4.1. Adding "-DWIN32_LEAN_AND_MEAN" flag to the nvcc_args in setup.py solves the problem.

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

4 participants