How to set up OpenCL

From KratosWiki
Revision as of 10:31, 10 February 2011 by Roigcarlo (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


How to set up OpenCL

Before you can use OpenCL, your system needs a set of libraries and compilers depending of your hardware.

Nvidia Cards

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

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

 # ./

for instance:

 # chmod -777
 # ./

reconfigure xserver

 # 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 ./
 # ./

In order run kernels on your CPU, you shold install the ATI Stream SDK.

ATI Cards

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:


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
Personal tools