pycuda ImportError in pycuda.driver

2019-06-24 23:49发布

问题:

I try compile some source for working with my GPU. I use pycuda for this. When I compile source code, I recive some errors from python:

C:\Users\Dmitriy\wcm>python ws_gpu.py test.dcm Traceback (most recent call last): File "ws_gpu.py", line 2, in import pycuda.gpuarray as gpu File "C:\Python27\lib\site-packages\pycuda\gpuarray.py", line 3, in import pycuda.elementwise as elementwise File "C:\Python27\lib\site-packages\pycuda\elementwise.py", line 33, in from pycuda.tools import context_dependent_memoize File "C:\Python27\lib\site-packages\pycuda\tools.py", line 30, in import pycuda.driver as cuda File "C:\Python27\lib\site-packages\pycuda\driver.py", line 2, in from pycuda._driver import * ImportError: DLL load failed: ═х эрщфхэ єърчрээ√щ ьюфєы№.

Has anyone encountered a similar problem? How can I solve this? I use Win7 64bit, last driver for my gpu (NVIDIA GT520M) and CUDA Toolkit v.5.0.

回答1:

This sort of error is almost always because of a broken PyCUDA installation. There is a library file called _driver.dll which provides bindings to the CUDA driver API. The error message is coming because that dll can either not be found or the libraries it depends on (ie. CUDA) can't be loaded. I can't say more because I can't read the cryllic error text you posted.

One way of diagnosing this sort of problem is to try the following in an interactive python shell:

>>> import pycuda
>>> pycuda.__file__

The second command will tell you where the root path for the active PyCUDA installation is (taken from a mailing list post). Searching in that path will find you the locate of the _driver.dll and running a dependency diagnostic tool on the dll file will show what can or cannot be found. If that doesn't work I recommend taking your question to the PyCUDA mailing list.