【问题标题】:Cannot compile simple PyCuda OSX application无法编译简单的 PyCuda OSX 应用程序
【发布时间】:2014-07-31 23:13:00
【问题描述】:

我在这里按照 PyCuda 的说明进行操作:http://wiki.tiker.net/PyCuda/Installation/Mac

我正在尝试编译以下代码:

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

我收到以下错误:

> python test.py

Traceback (most recent call last):
  File "test.py", line 12, in <module>
    """)
  File "/Library/Python/2.7/site-packages/pycuda-2013.1.1-py2.7-macosx-10.9-intel.egg/pycuda/compiler.py", line 251, in __init__
    arch, code, cache_dir, include_dirs)
  File "/Library/Python/2.7/site-packages/pycuda-2013.1.1-py2.7-macosx-10.9-intel.egg/pycuda/compiler.py", line 241, in compile
    return compile_plain(source, options, keep, nvcc, cache_dir)
  File "/Library/Python/2.7/site-packages/pycuda-2013.1.1-py2.7-macosx-10.9-intel.egg/pycuda/compiler.py", line 132, in compile_plain
    stderr=stderr.decode("utf-8", "replace"))
pycuda.driver.CompileError: nvcc compilation of /var/folders/xr/m_rf4dp96mn2tb4yxlwcft7h0000gp/T/tmpqQcztC/kernel.cu failed
[command: nvcc --cubin -arch sm_30 -m64 -I/Library/Python/2.7/site-packages/pycuda-2013.1.1-py2.7-macosx-10.9-intel.egg/pycuda/cuda kernel.cu]
[stderr:
nvcc fatal   : Path to libdevice library not specified
]

我搜索了谷歌并找到了以下线程,但它们无助于解决问题; http://lists.tiker.net/pipermail/pycuda/2011-June/003244.html ...

TIA!

【问题讨论】:

  • 谷歌 nvcc 错误nvcc fatal : Path to libdevice library not specified,然后你可能会发现一些东西
  • 我做到了。一个人提到了一个过时的 CUDA 包,但我有来自 nvidia 的最新包。

标签: python macos cuda gpu pycuda


【解决方案1】:

所以问题是我没有从 nvidia 控制面板安装小更新。之后,更新我的 bash_profile 就可以了。呵呵。

【讨论】:

    猜你喜欢
    • 2017-05-19
    • 2012-12-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-05-07
    • 2020-11-13
    相关资源
    最近更新 更多