How to set up OpenCL
How to set up OpenCL
Before you can use OpenCL, your system needs a set of libraries and compilers depending of your hardware.
In order to set up a correct OpenCL environment you need to install both dev-drivers and cuda tool set.
There are 2 choices to install dev-drivers
Download the latest version of GPU drivers that can be found here:
note: all commands below must be executed with superuser privileges In order to run the package falg it with execution permission
# chmod -777 devdriver_X.Y_linux_Z_VERSION.run
This installer can't be executed while running X-server, so, first it must shut down
Its recommended shift to another shell, ctrl+alt+F1 for instance.
# /etc/init.d/gdm stop
Note: use kdm instead of gdm in KDE environments
Run the downloaded package
# chmod -777 devdriver_3.2_linux_64_260.24.run # ./devdriver_3.2_linux_64_260.24.run
# dpkg-reconfigure xserver-xorg
and enable X-server again:
# /etc/init.d/gdm start
Note: ubuntu 10.04 use "Nouveau" as default nvidia driver. Before you can correct install the drivers, remove the current ones
# apt-get remove nvidia-* # apt-get remove xserver-xorg-video-nouveau
Now you should be able to check if drivers are correctly installed: System -> Administration -> Hardware Drivers
If driver is disabled, enable it and reboot the machine.
You can also use aptitude to install them
# apt-get install nvidia-current
and don't forget to install dev packages
# apt-get install nvidia-current-dev
Once you have correctly installed dev-drivers, its time to get CUDA tool set, you can download from:
When you have the .run file (make sure you download the correct distro/version package)
# chmod 777 ./cudatoolkit_3.2.9_linux_64_ubuntu10.04.run # ./cudatoolkit_3.2.9_linux_64_ubuntu10.04.run
In order run kernels on your CPU, you shold install the ATI Stream SDK.
If you are using a computer with ATI card, you should install ATI-Catalyst first:
Select your graphic card, and dowload the drivers. Ati dirver installation is pretty easy, just execute .run file you downloaded below.
ATI Stream SDK
Once you get the drivers installetd correctly, its recomended to install ati stream sdk.
You can get the last version of sdk here:
Now its time to configure the system to use the sdk.
1 - Uncompress .tgz
$ tar -xvzf ati-stream-sdk-v2.2-lnx32.tgz
2 - Set the enviorment variable ATISTREAMSDKROOT pointing to ati-stream-sdk folder. assuming you extrcted in /home/<user>/ and you have a x86_64 Os:
$ export ATISTREAMSDKROOT=/home/<user>/ati-stream-sdk-v2.2-lnx64
3 - (Optional) if you want the samples runing:
$ export ATISTREAMSDKSAMPLESROOT=/home/<user>/ati-stream-sdk-v2.2-lnx64
4 - Set the library path:
$ export LD_LIBRARY_PATH=$ATISTREAMSDKROOT/lib/x86_64:$LD_LIBRARY_PATH
You will also need the ICD files to allow openCL using CPU. If you don't do that, will recive a "CL_PLATFORM_NOT_FOUND_KHR (-1001)" while executing the code on cpu.
# tar xfz icd-registration.tgz