facebookresearch / pytorch3d

PyTorch3D is FAIR's library of reusable components for deep learning with 3D data
https://pytorch3d.org/
Other
8.62k stars 1.29k forks source link

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

Closed alevonian closed 1 month ago

alevonian commented 1 year ago

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 commented 1 year ago

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 https://github.com/microsoft/onnxruntime/pull/11578

bottler commented 1 year ago

This is similar to https://github.com/facebookresearch/pytorch3d/issues/1227 which might help you fix.

artths commented 1 year ago

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 https://github.com/microsoft/onnxruntime/pull/11578 fix: "A Windows SDK header #defines small, which clashes with a typedef in the CUDA 11.6 (and possibly other versions) headers."

alevonian commented 1 year ago

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!