Differences between revisions 26 and 27
Revision 26 as of 2014-01-19 15:04:03
Size: 5307
Comment:
Revision 27 as of 2015-06-22 09:21:05
Size: 5497
Editor: ::ffff:130
Comment: some update with lastest change and experience
Deletions are marked like this. Additions are marked like this.
Line 23: Line 23:
Download AMP APP from [[http://developer.amd.com/tools-and-sdks/opencl-zone/amd-accelerated-parallel-processing-app-sdk/download-archive/|here]] after accepting licence and run
Line 24: Line 26:
wget http://developer.amd.com/Downloads/AMD-APP-SDK-v2.6-lnx64.tgz
tar zxvf AMD-APP-SDK-v2.6-lnx64.tgz
chmod +x Install-AMD-APP.sh
./Install-AMD-APP.sh
tar zxvf icd-registration.tgz
sudo cp -r etc/OpenCL/* /etc/OpenCL/
tar zxvf AMD-APP-SDK-v[version]-lnx64.tgz
sudo ./Install-AMD-APP.sh
Line 34: Line 32:
Use synaptic or apt-get to install python-setuptools python-numpy libboost1.38-dev or libboost1.40-all-dev Use synaptic or apt-get to install python-setuptools python-numpy and libboost1.55-all-dev
Line 37: Line 35:
sudo apt-get install python-setuptools python-numpy libboost1.40-all-dev sudo apt-get install python-setuptools python-numpy libboost1.55-all-dev
Line 59: Line 57:

Line 77: Line 73:

Even writing the code above, some parameters are not always well taken into account on '''siteconfig.py '''configuration file, you may need to edit it with your favourite text editor.
Line 120: Line 118:
== Additional Notes (Dell Inspiron laptop with Intel and Nvidia cards) ==
I am using Ubuntu 12.04 on a Dell Inspiron laptop. I needed to install [[https://wiki.ubuntu.com/Bumblebee#Installation|bumblebee]] in order to use the Nvidia graphics card. In order to run tests, I needed to do
Line 121: Line 121:
== Additional Notes (Dell Inspiron laptop with Intel and Nvidia cards) ==
I am using Ubuntu 12.04 on a Dell Inspiron laptop. I needed to install
[[https://wiki.ubuntu.com/Bumblebee#Installation|bumblebee]] in order to use the Nvidia graphics card.
In order to run tests, I needed to do
Line 129: Line 125:
Line 132: Line 129:
It turns out optirun redefines my '''LD_LIBRARY_PATH''' so now I pick up '''libOpenCL.so.1''' from
/usr/lib/nvidia-current/libOpenCL.so.1
where I want the one from
/usr/lib/x86_64-linux-gnu/libOpenCL.so.1
Once I moved it, for example with
It turns out optirun redefines my '''LD_LIBRARY_PATH''' so now I pick up '''libOpenCL.so.1''' from  /usr/lib/nvidia-current/libOpenCL.so.1 where I want the one from /usr/lib/x86_64-linux-gnu/libOpenCL.so.1 Once I moved it, for example with
Line 140: Line 134:
running the benchmark (under optirun, don't forget) gave me  running the benchmark (under optirun, don't forget) gave me
Line 145: Line 140:
Line 148: Line 144:

PyOpenCL in Ubuntu repositories

Ubuntu Maverick Meerkat (10.10) contains PyOpenCL packages for architectures amd64 and i386 in multiverse. Package is called python-pyopencl and depends on NVIDIA drivers.

For Ubuntu Lucid Lynx (10.04 LTS) there is PPA with backported python-pyopencl packages: https://launchpad.net/~fajran/+archive/opencl

To be able to install PyOpenCL in Lucid Lynx you can:

Add ppa:fajran/opencl to the Software Sources

or add following lines to the software sources list /etc/apt/sources.list:

deb http://ppa.launchpad.net/fajran/opencl/ubuntu lucid main
deb-src http://ppa.launchpad.net/fajran/opencl/ubuntu lucid main

Installing PyOpenCL on Ubuntu

These instructions were originally written for Ubuntu 9.10 but have been updated for Ubuntu 11.04. Older versions work just like this, except for a changed boost version number. You may also look at the generic instructions if you'd like to install manually.

Step 0: Install OpenCL

There are many sources for the OpenCL SDK. Here we use the AMD source. Runs on any x86 64bit platform:

Download AMP APP from here after accepting licence and run

tar zxvf AMD-APP-SDK-v[version]-lnx64.tgz
sudo ./Install-AMD-APP.sh

(there may be ldconfig errors, they can be ignored)

Step 1: Install Boost and numpy

Use synaptic or apt-get to install python-setuptools python-numpy and libboost1.55-all-dev

sudo apt-get install python-setuptools python-numpy libboost1.55-all-dev

Step 2: Download and unpack PyOpenCL

Download PyOpenCL and unpack it:

$ tar xfz pyopencl-VERSION.tar.gz

Step 3: Build PyOpenCL

For the AMD Stream (64bit)

$ cd pyopencl-VERSION # if you're not there already
$ python configure.py \
  --boost-inc-dir=/usr/include/boost \
  --boost-lib-dir=/usr/lib \
  --no-use-shipped-boost \
  --boost-python-libname=boost_python-mt-py26 \
  --cl-inc-dir=/opt/AMDAPP/include \
  --cl-lib-dir=/opt/AMDAPP/lib/x86_64 \
  --cl-libname=OpenCL

If instead of the AMD SDK, you have the ATI Stream (64bit) beta4-implementation:

$ cd pyopencl-VERSION # if you're not there already
$ python configure.py \
  --boost-inc-dir=/usr/include/boost \
  --boost-lib-dir=/usr/lib \
  --no-use-shipped-boost \
  --boost-python-libname=boost_python-mt-py26 \
  --cl-inc-dir=/etc/ati-stream-sdk-v2.0-beta4-lnx64/include \
  --cl-lib-dir=/etc/ati-stream-sdk-v2.0-beta4-lnx64/lib/x86_64 \
  --cl-libname=OpenCL

If you want to compile in 32bit, change the cl-lib-dir from x86_64 to x86. You Should you also change -lnx64 to lnx32 in ati-stream-sdk-v2.0-beta4-lnx64.

The configure.py command converts the command line arguments in a siteconfig.py configuration file. You can later edit it, if necessary. You should delete it if you want to run configure.py again.

Even writing the code above, some parameters are not always well taken into account on siteconfig.py configuration file, you may need to edit it with your favourite text editor.

Now type:

$ make
$ sudo make install

Now you should be done with compiling and installing. You can test it with

cd examples
python demo.py

Putting it all together

Here is a complete script starting from scratch for downloading, configuring, and installing OpenCL and pyOpenCL, and running the examples. Tested a x86_64 Ubuntu 11.04:

wget http://developer.amd.com/Downloads/AMD-APP-SDK-v2.6-lnx64.tgz
tar zxvf AMD-APP-SDK-v2.6-lnx64.tgz
chmod +x Install-AMD-APP.sh
./Install-AMD-APP.sh
tar zxvf icd-registration.tgz
sudo cp -r etc/OpenCL/* /etc/OpenCL/
rm -r etc

sudo apt-get install python-numpy libboost1.40-all-dev python-setuptools

wget http://pypi.python.org/packages/source/p/pyopencl/pyopencl-2011.2.tar.gz
tar xfz pyopencl-2011.2.tar.gz
cd pyopencl-2011.2/
python configure.py                            \
   --boost-inc-dir=/usr/include/boost          \
   --boost-lib-dir=/usr/lib                    \
   --no-use-shipped-boost                      \
   --boost-python-libname=boost_python-mt-py26 \
   --cl-inc-dir=/opt/AMDAPP/include/           \
   --cl-lib-dir=/opt/AMDAPP/lib/x86_64         \
   --cl-libname=OpenCL
make
sudo make install
cd examples
python demo.py

Additional Notes (Dell Inspiron laptop with Intel and Nvidia cards)

I am using Ubuntu 12.04 on a Dell Inspiron laptop. I needed to install bumblebee in order to use the Nvidia graphics card. In order to run tests, I needed to do

optirun python examples/benchmark.py

which gave me the error

clRetainDevice, version OPENCL_1.2 not defined in file libOpenCL.so.1

It turns out optirun redefines my LD_LIBRARY_PATH so now I pick up libOpenCL.so.1 from /usr/lib/nvidia-current/libOpenCL.so.1 where I want the one from /usr/lib/x86_64-linux-gnu/libOpenCL.so.1 Once I moved it, for example with

#mv /usr/lib/nvidia-current/libOpenCL.so.1{,.1}

running the benchmark (under optirun, don't forget) gave me

clGetPlatformIDs failed: platform not found khr

which was solved by

#echo libnvidia-opencl.so.1 >> /etc/OpenCL/vendors/nvidia.icd


CategoryPyOpenCl

PyOpenCL/Installation/Linux/Ubuntu (last edited 2015-06-22 09:21:05 by ::ffff:130)