mr-sk
mr-sk

Reputation: 13397

Cannot compile simple PyCuda OSX application

I've followed the PyCuda instructions here: http://wiki.tiker.net/PyCuda/Installation/Mac

I'm trying to compile the following code:

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

And I'm receiving the following error:

> 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
]

I've searched google and found the following threads, but they don't help solve the issue; http://lists.tiker.net/pipermail/pycuda/2011-June/003244.html ...

TIA!

Upvotes: 0

Views: 708

Answers (1)

mr-sk
mr-sk

Reputation: 13397

So the problem is that I hadn't installed a minor update from the nvidia control panel. After that and updating my bash_profile it works. Heh.

Upvotes: 1

Related Questions