Replies: 4 comments 1 reply
-
thank you for this! |
Beta Was this translation helpful? Give feedback.
-
Thanks!It really works for me! |
Beta Was this translation helpful? Give feedback.
-
Works for me as well (Win10, CUDA11.3, torch1.10.0). Debugged into it and it seems to me that the problem is that any compiler flags apart from include directories are removed from the compiler command in https://github.com/pytorch/pytorch/blob/v1.10.0/torch/utils/cpp_extension.py#L623 (not using ninja). The spawn function received the '-DWITH_CUDA' flag, and for a 'cpp' module it was kept, however for cuda objects, the command is completely rewritten and the extra preprocessor arguments other than include folders are discarded. Note that in win_wrap_ninja_compile all arguments are added (https://github.com/pytorch/pytorch/blob/36449ea93134574c2a22b87baad3de0bf8d64d42/torch/utils/cpp_extension.py#L695) and indeed after installing ninja, detectron2 builds successfully. We can see how the compile command differs for 'cpp' and 'cu' modules - while they got the same arguments in spawn function apart from file names:
|
Beta Was this translation helpful? Give feedback.
-
I have the same error, but on the different line:
Unfortunately, neither reinstalling ninja, nor editing |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Instructions To Reproduce the 🐛 Bug:
Installation of detectron2 from source failed on cuda-enabled platform during compilation of nms_rotated_cuda.cu.
Logs:
Expected behavior:
Compilation and installation complete successfullly
Environment:
Solution
As there is no official support for Windows, I propose a solution that works for me. Feedbacks are welcome to know if assumptions behind the fix are correct and if the fix itself is convenient in all cases.
My assumption is that the macro WITH_CUDA is undefined when compiling the CUDA kernel nms_rotated_cuda.cu. Thus, a mandatory #include is missing in the code below of nms_rotated_cuda.cu because none of these conditions are met:
It seems that the macro WITH_CUDA is well defined in the setup.py but it is not passed to the nvcc compiler for unknown reasons. A solution is to set the WITH_CUDA macro directly in the nvcc options in setup.py as pointed here
With this little fix, compilation and installation complete successfully .
Beta Was this translation helpful? Give feedback.
All reactions