简体   繁体   中英

Pycuda or cuda failed to compile

When I try to run a Python code that uses CUDA, however I came across the following error:

pycuda.driver.CompileError: nvcc compilation of C:\Users\user\AppData\Local\Temp\tmplh36ro6y\kernel.cu failed
[command: nvcc --cubin -arch sm_75 -m64 -IC:\Users\user\Documents\deep-master\Deep\cubic -Ic:\users\user\anaconda3\envs\deep-master1\lib\site-packages\pycuda\cuda kernel.cu]
[stdout:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\include\vcruntime.h(197): error: invalid redeclaration of type name "size_t"

C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\include\vcruntime_new.h(48): error: first parameter of allocation function must be of type "size_t"

C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\include\vcruntime_new.h(53): error: first parameter of allocation function must be of type "size_t"

C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\include\vcruntime_new.h(59): error: first parameter of allocation function must be of type "size_t"

...

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1\include\sm_32_intrinsics.hpp(120): error: asm operand type size(8) does not match type/size implied by constraint 'r'

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1\include\sm_32_intrinsics.hpp(122): error: asm operand type size(8) does not match type/size implied by constraint 'r'

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1\include\sm_32_intrinsics.hpp(123): error: asm operand type size(8) does not match type/size implied by constraint 'r'

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1\include\sm_32_intrinsics.hpp(124): error: asm operand type size(8) does not match type/size implied by constraint 'r'

Error limit reached.
100 errors detected in the compilation of "kernel.cu".
Compilation terminated.
kernel.cu
]

Environment setup:
Python: 3.6.13
PyCuda: 2020.1
CUDA Toolkit: 10.1/ 11.1
MSVC: 2019

I installed the PyCuda from this link using pycuda-2020.1+cuda101-cp36-cp36m-win_amd64.whl. For which I also installed both cuda toolkit 10.1 and 11.1. I set either 10.1 and 11.1 separately in the system path:
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\libnvvp
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\lib\x64
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\extras\CUPTI\lib64
-Either set of settings give the same errors.

I don't quite understand this error. What is the use of kernel.cu and why does it need to compile? Did anyone came across similar errors or have any hints? Much appreciated. Thanks a lot.

This looks like a architecture mismatch issue. You are trying to compile the code on 64 bit jetpack.

You would need to change the code little bit, wherever the return value is r you would need to change that to l. Then recompile.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM