I recently updated CUDA to 11.6 and now when I try to use pyCuda I get
pycuda.driver.CompileError: nvcc compilation of C:\Users\imsog\AppData\Local\Temp\tmpkgtu92cq\kernel.cu failed [command: nvcc --cubin -arch sm_75 -m64 -Ic:\users\imsog\anaconda3\lib\site-packages\pycuda\cuda kernel.cu] [stdout: nvcc fatal : nvcc cannot find a supported version of Microsoft Visual Studio. Only the versions between 2017 and 2019 (inclusive) are supported! The nvcc flag '-allow-unsupported-compiler'
I already have VS2019 installed though. I went to https://visualstudio.microsoft.com/vs/older-downloads/ to try to install it again and only saw the "professional" version and downloaded it. So now I have both community and professional VS2019 installed.
I also removed all Cuda 11.6 files and reinstalled it. Still the same error.
In my path variables related to VS I have -
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\bin\Hostx64\x64
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE
I have verified that pyCuda is compiling with Cuda 11.6. I just can't figure out why it can't find what it needs in VS. There are many options in downloading VS, perhaps I don't have the files Cuda is looking for? I'm also not sure what path variables I need, or if having multiple different ones is confusing it.
I have verified that removing Cuda 11.6 and going back to the old version allows everything to run fine.
CodePudding user response:
I just resoled this.
I was following the last recommend in this link: https://forums.developer.nvidia.com/t/cuda-10-1-vs2019-environment-problem/73453/3
and install VC 2019 into a short path like this C:\VS19,
then open a prompt in C:\VS19\VC\Auxiliary\Build and run " vcvarsall.bat amd64 ",
now you can test nvcc in this prompt to see if it works.
but through this way, you would have to work on that prompt.
CodePudding user response:
I still can't figure this out but I figured out how to use the unsupported compiler flag with pycuda and it actually works.
In the PyCuda folder open compiler.py and go to line 129.
Change
cmdline = [nvcc, "--" target] options [cu_file_name]
To
cmdline = [nvcc, "--" target] ["-allow-unsupported-compiler"] options [cu_file_name]