PyCuda Ubuntu 12.04 issues

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

PyCuda Ubuntu 12.04 issues

albeam
I'm having issues getting pycuda to run properly. I had issues installing, which I suspect is the root of my issue now. Following these instructions:

http://wiki.tiker.net/PyCuda/Installation/Linux/Ubuntu

I had to remove the last configuration flag --no-use-shipped-boost, because it said there was no such argument. Also, I'm not using python3, so I changed all references to python.

Doing that, I got it to install. I can import all of the tools, but when I try to get to the SourceModule reference in demo.py, I get the following error:

Traceback (most recent call last):
  File "hello_gpu.py", line 14, in <module>
    """)
  File "/usr/local/lib/python2.7/dist-packages/pycuda-2013.1-py2.7-linux-x86_64.egg/pycuda/compiler.py", line 262, in __init__
    arch, code, cache_dir, include_dirs)
  File "/usr/local/lib/python2.7/dist-packages/pycuda-2013.1-py2.7-linux-x86_64.egg/pycuda/compiler.py", line 252, in compile
    return compile_plain(source, options, keep, nvcc, cache_dir)
  File "/usr/local/lib/python2.7/dist-packages/pycuda-2013.1-py2.7-linux-x86_64.egg/pycuda/compiler.py", line 134, in compile_plain
    cmdline, stdout=stdout.decode("utf-8"), stderr=stderr.decode("utf-8"))
pycuda.driver.CompileError: nvcc compilation of /tmp/tmpxghGAe/kernel.cu failed
[command: nvcc --cubin -arch sm_30 -I/usr/local/lib/python2.7/dist-packages/pycuda-2013.1-py2.7-linux-x86_64.egg/pycuda/cuda kernel.cu]
[stderr:
nvcc fatal   : Value 'sm_30' is not defined for option 'gpu-architecture'
]

If I change the shader model to a smaller value, e.g. sm_21, I get the following error:

>>> mod = SourceModule(
... """
... __global__ void multiply_them(float *dest, float *a, float *b)
... {
...   const int i = threadIdx.x;
...   dest[i] = a[i] * b[i];
... }
... """,arch="sm_21")
Traceback (most recent call last):
  File "<stdin>", line 8, in <module>
  File "/usr/local/lib/python2.7/dist-packages/pycuda-2013.1-py2.7-linux-x86_64.egg/pycuda/compiler.py", line 265, in __init__
    self.module = module_from_buffer(cubin)
pycuda._driver.LogicError: cuModuleLoadDataEx failed: invalid source -

Can someone point me to a resource to fix this?

Thanks.
Reply | Threaded
Open this post in threaded view
|

Re: PyCuda Ubuntu 12.04 issues

Andreas Kloeckner
albeam <[hidden email]> writes:
> I'm having issues getting pycuda to run properly. I had issues installing,
> which I suspect is the root of my issue now. Following these instructions:
>
> http://wiki.tiker.net/PyCuda/Installation/Linux/Ubuntu
>
> I had to remove the last configuration flag --no-use-shipped-boost, because
> it said there was no such argument. Also, I'm not using python3, so I
> changed all references to python.

The flag should exist if you don't already have a PyCUDA configuration
sitting around (siteconf.py, ~/.aksetup-defaults.py).

> Doing that, I got it to install. I can import all of the tools, but when I
> try to get to the SourceModule reference in demo.py, I get the following
> error:
>
> Traceback (most recent call last):
>   File "hello_gpu.py", line 14, in <module>
>     """)
>   File
> "/usr/local/lib/python2.7/dist-packages/pycuda-2013.1-py2.7-linux-x86_64.egg/pycuda/compiler.py",
> line 262, in __init__
>     arch, code, cache_dir, include_dirs)
>   File
> "/usr/local/lib/python2.7/dist-packages/pycuda-2013.1-py2.7-linux-x86_64.egg/pycuda/compiler.py",
> line 252, in compile
>     return compile_plain(source, options, keep, nvcc, cache_dir)
>   File
> "/usr/local/lib/python2.7/dist-packages/pycuda-2013.1-py2.7-linux-x86_64.egg/pycuda/compiler.py",
> line 134, in compile_plain
>     cmdline, stdout=stdout.decode("utf-8"), stderr=stderr.decode("utf-8"))
> pycuda.driver.CompileError: nvcc compilation of /tmp/tmpxghGAe/kernel.cu
> failed
> [command: nvcc --cubin -arch sm_30
> -I/usr/local/lib/python2.7/dist-packages/pycuda-2013.1-py2.7-linux-x86_64.egg/pycuda/cuda
> kernel.cu]
> [stderr:
> nvcc fatal   : Value 'sm_30' is not defined for option 'gpu-architecture'
> ]
>
> If I change the shader model to a smaller value, e.g. sm_21, I get the
> following error:
>
>>>> mod = SourceModule(
> ... """
> ... __global__ void multiply_them(float *dest, float *a, float *b)
> ... {
> ...   const int i = threadIdx.x;
> ...   dest[i] = a[i] * b[i];
> ... }
> ... """,arch="sm_21")
> Traceback (most recent call last):
>   File "<stdin>", line 8, in <module>
>   File
> "/usr/local/lib/python2.7/dist-packages/pycuda-2013.1-py2.7-linux-x86_64.egg/pycuda/compiler.py",
> line 265, in __init__
>     self.module = module_from_buffer(cubin)
> pycuda._driver.LogicError: cuModuleLoadDataEx failed: invalid source -
>
> Can someone point me to a resource to fix this?

This looks like your CUDA toolkit is too old. Specifically, your GPU
appears to be a Kepler (compute capability 3.0), but hte nvcc you've got
installed apparently can't generated code for that. My best guess for a
fix: Upgrade the CUDA toolkit.

HTH,
Andreas

_______________________________________________
PyCUDA mailing list
[hidden email]
http://lists.tiker.net/listinfo/pycuda
Reply | Threaded
Open this post in threaded view
|

Re: PyCuda Ubuntu 12.04 issues

albeam
Thanks for the help. I've upgraded the Cuda toolkit to 5.0 and my driver and reinstalled PyCuda. The installation was much smoother this time (I still had to clone into git submodule update --init), but it seems to have installed. I did not have to remove the --no-use-shipped-boost flag this time, like I did last time. Now when I try import pycuda.driver as cuda, I'm greeted by this error:

 File "/usr/local/lib/python2.7/dist-packages/pycuda-2013.1-py2.7-linux-x86_64.egg/pycuda/driver.py", line 2, in <module>
    from pycuda._driver import *
ImportError: /usr/lib/libboost_python-py32.so.1.46.1: undefined symbol: PyBytes_Size

which I think means I have a problem with my boost library. I'm going to remove it and reinstall I guess, but do you have any suggestions beyond that?
Reply | Threaded
Open this post in threaded view
|

Re: PyCuda Ubuntu 12.04 issues

albeam
I just realized that boost_python-mt-py32 probably specifies a python version, so I changed it to mt-py27 (I'm using python 2.7) and reinstalled pycuda. I have a different error now, but I can import pycuda. Now I import pycuda.driver as cuda throws:

ImportError: No module named _driver

but the statement import pycuda does work.
Reply | Threaded
Open this post in threaded view
|

Re: PyCuda Ubuntu 12.04 issues

albeam
It seems that the import error was similar to what was happening here:

http://pycuda.2962900.n2.nabble.com/ImportError-No-module-named-driver-td4099529.html

Changing out of the install director seems to have fixed the issue and it seems I can run the demo examples.

For posterity, what I did was:

Following these instructions:
http://sn0v.wordpress.com/2012/12/07/installing-cuda-5-on-ubuntu-12-04/

- Upgrade drivers
- Upgrade to Cuda 5.0
- Installed pycuda using this configuration:
./configure.py --python-exe=/usr/bin/python --cuda-root=/usr/local/cuda --cudadrv-lib-dir=/usr/lib --boost-inc-dir=/usr/include --boost-lib-dir=/usr/lib --boost-python-libname=boost_python-mt-py27 --boost-thread-libname=boost_thread-mt --no-use-shipped-boost
- Changed out of the install directory and ran demo.py and gpu_hello.py