Upgrading the ATI drivers and configuring OpenCL in Ubuntu
Published on September 6, 2010
I’m planning a series of post about OpenCL basics and its use ( simple kernels, smoke modelling with Navier-Stokes equation and usage with python) , but before that, a short post on upgrading drivers and basic environment configuration could be useful. Especially when done in conjunction with a kernel upgrade, the update of the ATI graphic drivers is a bit tricky.Unlike CUDA or Stream, OpenCL library is CPU/GPU architecture-independent, so this will be the only post where you’ll read something limited to ATI card owners.
We’ll use ATI Radeon 57xx logical schematics in the next post to understand how modern GPUs are structured internally but every consideration will also apply to GPUs from other vendors.
The recommended procedure to perform a driver update consists of three steps: uninstalling the old drivers, building custom .deb packages/installing them, build the initial configuration.So, first of all, uninstall the drivers and delete the obsolete fglrx packages:
sudo sh /usr/share/ati/fglrx-uninstall.sh
sudo apt-get remove --purge fglrx_* xorg-driver-fglrx
Download from ati.com the latest driver, generate .deb and install (using 10.04, same procedure applies to other recent builds):
sh ati-driver-installer-10-8-x86.x86_64.run --buildpkg Ubuntu/lucid
sudo dpkg -i fglrx*.deb
Initialize /etc/X11/xorg.conf (a backup is generated) and after this reboot/restart X:
sudo aticonfig --initial -f
To verify that everything has gone as expected (this will display the current driver version):
./fglrxinfo
Regarding OpenCL environment configuration, the installation is easy and fast and the official ATI documentation does a good job.
Get the Stream SDK and the OpenCL ICD configuration (new in 2.2) from the developer site and follow these steps.Untar the SDK in a directory of your choice and add to your .bash_profile (or equivalent) these lines, customizing where needed:
export ATISTREAMSDKROOT=<...>/ati-stream-sdk-v2.2-lnx64export LD_LIBRARY_PATH=$ATISTREAMSDKROOT/lib/x86_64:$LD_LIBRARY_PATH
Untar the ICD configuration archive (will put vendor-specific configuration files in /etc/OpenCL/vendors):
cd /
sudo tar xfz icd-registration.tgz
To verify the successful installation, reload your .bash_profile (source ~/.bash_profile) go to …/ati-stream-sdk-v2.2-lnx64/samples/opencl , compile the opencl samples with make and then run from …/ati-stream-sdk-v2.2-lnx64/samples/opencl/bin/x86_64:
./CLInfo
Verify that both CL_DEVICE_TYPE_CPU and CL_DEVICE_TYPE_GPU are present in the output.As last test and if you want to qualitatively evaluate performance differences, try Mandelbrot with –device cpu and –device gpu.
Follow me on Twitter