我正在尝试安装pycuda来在python中进行一些图像处理。我按照以下链接安装它:
我觉得我已经安装好了所有东西但是当我使用pycharm运行示例代码时:
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)
我收到错误:
ModuleNotFoundError:没有名为' pycuda.autoinit&#39 ;;的模块' pycuda'不是包
当我在CMD中跑步时,我得到了
File "C:\Users\Nitharshini\Miniconda3\lib\site-packages\pycuda\autoinit.py", line 2, in <module>
import pycuda.driver as cuda
File "C:\Users\Nitharshini\Miniconda3\lib\site-packages\pycuda\driver.py", line 5, in <module>
from pycuda._driver import *
# noqa ImportError: DLL load failed: The specified module could not be found.
知道为什么会这样吗?