cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

Natt
Journeyman III

[SOLVED] How to install Python wrapper for OpenCL in Ubuntu

Hi,

Dear devs, I need your help.

I have spent the day trying to install the ATI SDK in combination with the python bindings for OpenCL, ie. PyOpenCL, in order to do some simulations on a HD5870. I'm pretty sure I'll go crazy soon, but I will summarize my problems first.

Okay - first I tried win7-64bit to no avail. SDK installed neatly, but the python wrapper failed to import in my code.

Then I tried Ubuntu 10.10-32bit. Installed Catalyst driver through Administration>Hardware Drivers. Worked. Installed the SDK using this deb-package:

http://forums.amd.com/forum/messageview.cfm?catid=390&threadid=125792

(Thanks, Nou).  Then I got numpy and finally pyopencl through the software center. However pyopencl presented me with an error basically saying my package installer was now broken. I reinstalled and tried again. Same problem.

Then I tried Ubuntu 10.04. Did the same as above, but used the package from ppa:fajran/opencl as described on the PyOpenCL web page. That gave a similar problem as before: Error at end of installation, then I got a recommended update prompt for nVidia binary Xorg driver, and during install i got an error:

E: /var/cache/apt/archives/nvidia-current_195.36.24-0ubuntu1~10.04_i386.deb: trying to overwrite '/usr/lib/libOpenCL.so', which is also in package ati-opencl-runtime 0

And at this point I surrender and hoist the white flag...

Tags (3)
0 Likes
4 Replies
nou
Exemplar

How to install Python wrapper for OpenCL in Ubuntu

ok i recomend download normal AMD SDK from http://developer.amd.com/gpu/ATIStreamSDK/Pages/default.aspx just extract. then run some samples.

first FindNumDevices from CAL samples. it should print number of ATI GPU in the system.

if it find some device then you can run some samples from opencl. like CLInfo. or run this samples with --device cpu it should work even without GPU.

there is maybe problem with driver. i recomend download fglrx driver from amd page and then build distro specific package like this "ati-driver-installer-10-10-x86.x86_64.run --buildpkg Ubuntu/lucid" then install generated packages with dpkg -i *.deb

0 Likes
Natt
Journeyman III

How to install Python wrapper for OpenCL in Ubuntu

Thanks for the help, Nou.

FindNumDevices returns 1 device - my cpu

CLInfo returns a lot of info about this cpu device in relation to OpenCL

So the GPU is still hiding.

I sucessfully made the distro specific ati-driver package and installed it after removing my old catalyst drivers, but CLInfo still detects only one device.

I tried reinstalling your SDK deb package as well, but same thing.

Also, glrxinfo doesn't return anything. With the previous catalyst drivers it would return the name of the GPU. I wish I could provide more specific info, but I'm not even sure where things are going wrong...

At least it is comforting to be able to detect the CPU...

EDIT: Installed catalyst from the .run file. Now CLInfo detects both the GPU and CPU. Yay, I feel like it is going somewhere! Next I will try to install pyopencl again, and pray that nothing breaks again...

Installing PyOpenCL still fails. Can anyone guess how to configure the siteconf.py file who has done it before? I think I have to edit these parameters:

BOOST_INC_DIR = []
BOOST_LIB_DIR = []
BOOST_COMPILER = 'gcc43'
BOOST_PYTHON_LIBNAME = ['boost_python-gcc43-mt']
USE_SHIPPED_BOOST = True
CL_TRACE = False
CL_ENABLE_GL = False
CL_INC_DIR = []
CL_LIB_DIR = []
CL_LIBNAME = ['OpenCL']
CXXFLAGS = []
LDFLAGS = []

When I "make" in the pyopencl extract dir I currently get an error:

plz@plz-HD5870:~/Downloads/pyopencl-0.92$ sudo  make
ctags -R src || true
/usr/bin/python setup.py build
running build
running build_py
running build_ext
building '_cl' extension
gcc -pthread -fno-strict-aliasing -fwrapv -Wall -O3 -DNDEBUG -fPIC -DBOOST_MULTI_INDEX_DISABLE_SERIALIZATION=1 -Isrc/cpp -Ibpl-subset/bpl_subset -I/usr/lib/python2.6/dist-packages/numpy/core/include -I/usr/include/python2.6 -c src/wrapper/wrap_cl.cpp -o build/temp.linux-i686-2.6/src/wrapper/wrap_cl.o
In file included from src/wrapper/wrap_cl.cpp:1:
src/wrapper/wrap_cl.hpp:20:19: error: CL/cl.h: No such file or directory
In file included from bpl-subset/bpl_subset/boost/python/detail/wrap_python.hpp:50,
                 from bpl-subset/bpl_subset/boost/python/detail/prefix.hpp:13,
                 from bpl-subset/bpl_subset/boost/python/slice.hpp:9,
                 from src/wrapper/wrap_cl.hpp:41,
                 from src/wrapper/wrap_cl.cpp:1:
/usr/include/python2.6/pyconfig.h:1031:1: warning: "_POSIX_C_SOURCE" redefined
In file included from /usr/include/c++/4.4/i486-linux-gnu/bits/os_defines.h:39,
                 from /usr/include/c++/4.4/i486-linux-gnu/bits/c++config.h:243,
                 from /usr/include/c++/4.4/exception:37,
                 from /usr/include/c++/4.4/stdexcept:38,
                 from src/wrapper/wrap_cl.hpp:36,
                 from src/wrapper/wrap_cl.cpp:1:
/usr/include/features.h:158:1: warning: this is the location of the previous definition
In file included from bpl-subset/bpl_subset/boost/python/detail/wrap_python.hpp:50,
                 from bpl-subset/bpl_subset/boost/python/detail/prefix.hpp:13,
                 from bpl-subset/bpl_subset/boost/python/slice.hpp:9,
                 from src/wrapper/wrap_cl.hpp:41,
                 from src/wrapper/wrap_cl.cpp:1:
/usr/include/python2.6/pyconfig.h:1040:1: warning: "_XOPEN_SOURCE" redefined
In file included from /usr/include/c++/4.4/i486-linux-gnu/bits/os_defines.h:39,
                 from /usr/include/c++/4.4/i486-linux-gnu/bits/c++config.h:243,
                 from /usr/include/c++/4.4/exception:37,
                 from /usr/include/c++/4.4/stdexcept:38,
                 from src/wrapper/wrap_cl.hpp:36,
                 from src/wrapper/wrap_cl.cpp:1:
/usr/include/features.h:160:1: warning: this is the location of the previous definition
In file included from src/wrapper/wrap_cl.cpp:1:
src/wrapper/wrap_cl.hpp:240: error: ‘cl_int’ does not name a type
src/wrapper/wrap_cl.hpp:243: error: ‘cl_int’ has not been declared
src/wrapper/wrap_cl.hpp:256: error: ‘cl_int’ has not been declared
src/wrapper/wrap_cl.hpp:266: error: ‘cl_int’ does not name a type
src/wrapper/wrap_cl.hpp:271: error: expected ‘;’ before ‘(’ token
src/wrapper/wrap_cl.cpp:20: error: expected ‘;’ at end of input
src/wrapper/wrap_cl.cpp:20: error: expected ‘}’ at end of input
In file included from src/wrapper/wrap_cl.cpp:1:
src/wrapper/wrap_cl.hpp: In static member function ‘static std::string pyopencl::error::make_message(const char*, int, const char*)’:
src/wrapper/wrap_cl.hpp:247: error: ‘cl_error_to_str’ was not declared in this scope
src/wrapper/wrap_cl.hpp: In constructor ‘pyopencl::error::error(const char*, int, const char*)’:
src/wrapper/wrap_cl.hpp:258: error: class ‘pyopencl::error’ does not have any field named ‘m_code’
src/wrapper/wrap_cl.hpp: At global scope:
src/wrapper/wrap_cl.hpp:264: error: expected unqualified-id at end of input
src/wrapper/wrap_cl.hpp:264: error: expected ‘}’ at end of input
error: command 'gcc' failed with exit status 1
make: *** [all] Error 1

All help is much appreciated.

0 Likes
nou
Exemplar

How to install Python wrapper for OpenCL in Ubuntu

try install my second package ati-opencl-dev

0 Likes
Natt
Journeyman III

[SOLVED] How to install Python wrapper for OpenCL in Ubuntu

Nou, that did it! Thank you

To summarize installation in Ubuntu 10.04:

0: Deactivate any proprietary Catalyst drivers you might have and install the Catalyst driver from AMDs web-page (go to dir in terminal and type "chmod +x nameoffile.run", then "./nameoffile.run"). Confirm installation by typing "fglrxinfo" in terminal. This should print some info about your graphics card. 

1: Install ati-opencl-runtime deb from Nou's topic: http://forums.amd.com/forum/messageview.cfm?catid=390&threadid=125792 (Go to download dir in terminal and type "dpkg -i *.deb" where the * is the name of the file)

2: Install ati-opencl-dev deb from Nou's topic: http://forums.amd.com/forum/messageview.cfm?catid=390&threadid=125792

3: Optional, but really neat: Python OpenCL bindings. First install python 2.6 unless you already have it. Then install numpy package which is required for the bindings to work. Then get libboost and liboost-python. Then download PyOpenCL and go to the dir in your terminal and type "python configure.py". Next type "su -c "make install"".

0 Likes