Subtracting GPUArrays raises CompileError
(too old to reply)
Joseph Valles
2017-06-27 17:16:50 UTC
Subtracting two GPUArrays raises a CompleError for me. I reinstalled pycuda to no avail. Running Visual Studio 2015 with Cuda Toolkit 8.0 on Windows 10 x64.

(C:\Program Files\Anaconda3) C:\Users\Joseph\Desktop>pythonPython 3.5.2 |Anaconda custom (64-bit)| (default, Jul  5 2016, 11:41:13) [MSC v.1900 64 bit (AMD64)] on win32Type "help", "copyright", "credits" or "license" for more information.>>> import pycuda.autoinit>>> import pycuda.gpuarray as gpuarray>>> import numpy as np>>> a = np.ones((10000000,2),dtype=np.float64)>>> a_gpu = gpuarray.to_gpu(a)>>> a_gpu - a_gpu``````Traceback (most recent call last):  File "C:\Program Files\Anaconda3\lib\site-packages\pycuda\tools.py", line 426, in context_dependent_memoize    return ctx_dict[cur_ctx][args]KeyError: <pycuda._driver.Context object at 0x000001B1DD826BE0>
During handling of the above exception, another exception occurred:
Traceback (most recent call last):  File "<stdin>", line 1, in <module>  File "C:\Program Files\Anaconda3\lib\site-packages\pycuda\gpuarray.py", line 418, in __sub__    return self._axpbyz(1, other, -1, result)  File "C:\Program Files\Anaconda3\lib\site-packages\pycuda\gpuarray.py", line 304, in _axpbyz    func = elementwise.get_axpbyz_kernel(self.dtype, other.dtype, out.dtype)  File "<decorator-gen-7>", line 2, in get_axpbyz_kernel  File "C:\Program Files\Anaconda3\lib\site-packages\pycuda\tools.py", line 430, in context_dependent_memoize    result = func(*args)  File "C:\Program Files\Anaconda3\lib\site-packages\pycuda\elementwise.py", line 410, in get_axpbyz_kernel    "axpbyz")  File "C:\Program Files\Anaconda3\lib\site-packages\pycuda\elementwise.py", line 161, in get_elwise_kernel    arguments, operation, name, keep, options, **kwargs)  File "C:\Program Files\Anaconda3\lib\site-packages\pycuda\elementwise.py", line 147, in get_elwise_kernel_and_types    keep, options, **kwargs)  File "C:\Program Files\Anaconda3\lib\site-packages\pycuda\elementwise.py", line 75, in get_elwise_module    options=options, keep=keep)  File "C:\Program Files\Anaconda3\lib\site-packages\pycuda\compiler.py", line 291, in __init__    arch, code, cache_dir, include_dirs)  File "C:\Program Files\Anaconda3\lib\site-packages\pycuda\compiler.py", line 255, in compile    return compile_plain(source, options, keep, nvcc, cache_dir, target)  File "C:\Program Files\Anaconda3\lib\site-packages\pycuda\compiler.py", line 78, in compile_plain    checksum.update(preprocess_source(source, options, nvcc).encode("utf-8"))  File "C:\Program Files\Anaconda3\lib\site-packages\pycuda\compiler.py", line 55, in preprocess_source    cmdline, stderr=stderr)pycuda.driver.CompileError: nvcc preprocessing of C:\Users\Joseph\AppData\Local\Temp\tmpnkdrtwg3.cu failed[command: nvcc --preprocess -arch sm_35 -m64 -Ic:\program files\anaconda3\lib\site-packages\pycuda\cuda C:\Users\Joseph\AppData\Local\Temp\tmpnkdrtwg3.cu --compiler-options -EP]
Joseph Josephson
2017-06-28 16:08:50 UTC
Again I’m just using a standard install from pip, with ordinary Windows 10, Anaconda3, VS2015 and CUDA Toolkit 8.0 and simple usage of GPUArrays such as the following throws CompileErrors for me:

import pycuda.autoinit
import pycuda.gpuarray as gpuarray
import numpy as np
a_gpu = gpuarray.to_gpu( np.ones(100) )
a_gpu - a_gpu

Help would be greatly appreciated.