Skip to content
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

pycuda.driver.CompileError: nvcc preprocessing failed #13

Open
Spenhouet opened this issue Nov 28, 2017 · 13 comments
Open

pycuda.driver.CompileError: nvcc preprocessing failed #13

Spenhouet opened this issue Nov 28, 2017 · 13 comments

Comments

@Spenhouet
Copy link

I'm not sure if you can help on this issue or if someone using this implementation had the same problem but after running the training (for example with --style_option 1 after 1000 iterations), I get the following error:

Traceback (most recent call last):
  File "deep_photostyle.py", line 115, in <module>
    main()
  File "deep_photostyle.py", line 84, in main
    best_ = smooth_local_affine(output_, input_, 1e-7, 3, H, W, args.f_radius, args.f_edge).transpose(1, 2, 0)
  File "C:\Users\spenh\Deep Photo Style Transfer\smooth_local_affine.py", line 332, in smooth_local_affine
    """)
  File "C:\Users\spenh\AppData\Local\Programs\Python\Python36\lib\site-packages\pycuda\compiler.py", line 291, in __init__
    arch, code, cache_dir, include_dirs)
  File "C:\Users\spenh\AppData\Local\Programs\Python\Python36\lib\site-packages\pycuda\compiler.py", line 255, in compile
    return compile_plain(source, options, keep, nvcc, cache_dir, target)
  File "C:\Users\spenh\AppData\Local\Programs\Python\Python36\lib\site-packages\pycuda\compiler.py", line 78, in compile_plain
    checksum.update(preprocess_source(source, options, nvcc).encode("utf-8"))
  File "C:\Users\spenh\AppData\Local\Programs\Python\Python36\lib\site-packages\pycuda\compiler.py", line 55, in preprocess_source
    cmdline, stderr=stderr)
pycuda.driver.CompileError: nvcc preprocessing of C:\Users\spenh\AppData\Local\Temp\tmpzhinmn14.cu failed
[command: nvcc --preprocess -arch sm_61 -m64 -Ic:\users\spenh\appdata\local\programs\python\python36\lib\site-packages\pycuda\cuda C:\Users\spenh\AppData\Local\Temp\tmpzhinmn14.cu --compiler-options -EP]

I couldn't find any help with googling so maybe someone here knows what to do, to try or what this even come from?

My PC:

  • Windows 10 64 bit
  • Nvidia GTX 1080
  • Cuda 8.0
  • cudnn 6.1
  • pycuda 2017.1.1+cuda8061
  • Python 3.6.2rc1
  • tensorflow-gpu 1.4.0
  • numpy 1.13.3+mkl
  • Pillow 4.2.1
  • scipy 0.19.1
@andrewginns
Copy link
Contributor

Looks like a problem with pycuda. Did you add cuda and cudnn to your environment variables as per the install guide?

@Spenhouet
Copy link
Author

@andrewginns Thank you for your quick reply.

Yes, all environment variables are set:

PATH:

  • C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin
  • C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\libnvvp
  • C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\lib\x64
  • C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\extras\CUPTI\libx64

CUDA_PATH: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0
CUDA_PATH_V8_0: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0
NVCUDASAMPLES_ROOT: C:\ProgramData\NVIDIA Corporation\CUDA Samples\v8.0
NVCUDASAMPLES8_0_ROOT: C:\ProgramData\NVIDIA Corporation\CUDA Samples\v8.0

@SystemErrorWang
Copy link

Same problem here, use win10 64bit, gtx1070 gpu, cuda 8.0, python3.6 and tensorflow-gpu 1.3. Tried to search the internet but got nothing worth mention. Would like to know if there could be anyone who can help with this issue. Really appreciate for that.

@LouieYang
Copy link
Owner

LouieYang commented Nov 30, 2017

Could you pass the PyCuda driver-test.py as shown in Linux and run the same command on Windows? @SystemErrorWang @Spenhouet

@SystemErrorWang
Copy link

@LouieYang I am sorry that I am not sure what does it mean by "pass the PyCuda driver-test.py as shown in Linux". I tried to find driver-test.py in windows and found a few, but they were not in the pycuda folder.(one in site-packages/theano, another in site-packages/numba)

@SystemErrorWang
Copy link

@LouieYang I also tested this code under linux(ubuntu 14.04) with default settings, but the code stopped automatically after 30 iterations without any trace-backs or error information, and generated an gray image.

@LouieYang
Copy link
Owner

LouieYang commented Dec 1, 2017

@SystemErrorWang In Linux, there is a python file called "test_driver.py", under "pycuda-version-you-installed/test/", you can run pycuda unit test by python test_driver.py on Linux. You can check the detail in this link.

@andrewginns
Copy link
Contributor

andrewginns commented Dec 1, 2017

@Spenhouet Do you have the environment variables for CUDA_HOME, CUDA_PATH and CUDA_PATH_V8_0 set? Your error looks like a pycuda error as @LouieYang has mentioned. Can you successfully run any other CUDA based propgrams?

Alternatively if you're using windows try my Windows specific fork. It definitely works on my setup:

  • Windows 10 Fall creators update
  • Nvidia GTX 980
  • Cuda 8.0
  • cudnn 6.1
  • pycuda 2017.1.1+cuda8061
  • Python 3.6.2rc1
  • tensorflow-gpu 1.4.0

@Spenhouet
Copy link
Author

@andrewginns Did you see my reply to your first question: #13 (comment)?

I listed there all the environment variables that are set in my system.

Also yes. I can run any other CUDA based program. Also as I already said in my original post, this error occur after running 1000 iterations (so obviously the first 1000 iterations are working).

@marcomarchesi
Copy link

It happened to me recently and I fixed in the following way, I hope it can helps someone.
First of all, you should test if you can run a simple PyCuda code like this:

import pycuda.autoinit
import pycuda.driver as drv
import numpy

from pycuda.compiler import SourceModule
mod = SourceModule(
"""
__global__ void multiply_them(float *dest, float *a, float *b)
{
  const int i = threadIdx.x;
  dest[i] = a[i] * b[i];
}
"""
)

multiply_them = mod.get_function("multiply_them")

a = numpy.random.randn(400).astype(numpy.float32)
b = numpy.random.randn(400).astype(numpy.float32)

dest = numpy.zeros_like(a)
multiply_them(
        drv.Out(dest), drv.In(a), drv.In(b),
        block=(400,1,1), grid=(1,1))

print (dest-a*b)

If not, perhaps you are missing a Visual Studio compiler in the PATH, just add:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin (if VS 14.0 is installed)

@toropippi
Copy link

I had the same problem.I confirmed that the PATH of CUDA and Visual Studio are set.

Windows 10 64 bit
NVIDIA MX150 (Pascal)
CUDA 10.1
PyCuda 2019.1.2
Python 3.6.5 (Anaconda)

and I got the following error message.
[command: nvcc --preprocess -arch sm_61 -m64 -Ic:\users\xxxxx C:\Users\xxxxx\yyyyyy.cu --compiler-options -EP]

Then, I changed the compiler PATH, the compilation was successful.

"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\Hostx64\x64"
->
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\bin\Hostx64\x64"

Thank you.
(But, It is unknown why the error occurred even though the Visual Studio 2017 PATH was set.)

@yichengggg
Copy link

@toropippi Could you please let me know the processes you made to change the complier PATH?

@dhkwnr97
Copy link

@yichengggg,
In my case, I did apply method both @toropippi, @Spenhouet
I appended Path to
"""
Yes, all environment variables are set:

PATH:

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\libnvvp
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\lib\x64
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\extras\CUPTI\libx64
CUDA_PATH: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0
CUDA_PATH_V8_0: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0
NVCUDASAMPLES_ROOT: C:\ProgramData\NVIDIA Corporation\CUDA Samples\v8.0
NVCUDASAMPLES8_0_ROOT: C:\ProgramData\NVIDIA Corporation\CUDA Samples\v8.0
"""
In my case, lastest version is v11.0. So I change whole thing v8.0 -> v11.0 , V8_0 -> V11_0, 8_0_ROOT -> 11_0_ROOT

and
Adding below path into the Path
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\bin\Hostx64\x64
In my case, lastest version is v11.0. So I change 14.23.28105 -> 14.27.29110
And click "Yes"
Lastly I reboot my computer. then I can fix this problem

In my case, I spend so much time because I don't know compiler's system environment setting problem and also VS community problem. So Plz check window's Start button -> search -> Visual Studio Installer -> 'installed' tap -> modification(the first button) -> CHECK : "desktop development by using C++" is checking

Good luck.

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

8 participants