Reputation: 195
I want to run code that I got off this site - https://documen.tician.de/pycuda/tutorial.html - it's what's below.
import pycuda.gpuarray as gpuarray
import pycuda.driver as cuda
import pycuda.autoinit
import numpy
a_gpu = gpuarray.to_gpu(numpy.random.randn(4,4).astype(numpy.float32))
a_doubled = (2*a_gpu).get()
print(a_doubled)
print(a_gpu)
Basically, for the line "import pycuda.driver as cuda", I get the error message:
File "C:\Users\David\Anaconda3\lib\site-packages\pycuda\driver.py", line 5, in from pycuda._driver import * # noqa
ModuleNotFoundError: No module named 'pycuda._driver'
This makes sense, because when I look as the driver text file, I see the following lines
try:
from pycuda._driver import * # noqa
except ImportError as e:
if "_v2" in str(e):
from warnings import warn
warn("Failed to import the CUDA driver interface, with an error "
"message indicating that the version of your CUDA header "
"does not match the version of your CUDA driver.")
raise
And there is in fact no text file called _driver in my pycuda folder. So how can I fix this? I thought I should have all the folders when I write "pip install pycuda" in my terminal.
Upvotes: 0
Views: 8978
Reputation: 904
Depending on your OS make sure you have configured pycuda on correct cuda lib path.. Follow https://wiki.tiker.net/PyCuda/Installation/Windows carefully.
HOWEVER: It looks like you want to install this on Anaconda, therefore I would advise you to follow this guide instead. https://www.ibm.com/developerworks/community/blogs/jfp/entry/Installing_PyCUDA_On_Anaconda_For_Windows?lang=en
Upvotes: 0