I’ve been working with CUDA for a few years now, and a while back I wrote some notes on how to install the CUDA SDK in Ubuntu. My new laptop has an ATI/Radeon graphics card, which can’t use CUDA. CUDA was developed by nVidia, and it won’t work on other companies’ cards. For GPU acceleration, ATI and Radeon both use OpenCL.
As its name suggests, OpenCL is an open and royalty-free standard developed by the Khronos consortium. OpenCL was invented by Apple, and has since been adopted by Intel, ARM, AMD and even nVidia. There are a few commercial projects in the pipeline that aim to compile OpenCL routines so they can run directly on FPGAs.
Installing AMD’s APP SDK on Ubuntu 12.04 was much easier than installing CUDA. Here is how I did it:
Installing the AMD/ATI OpenCL SDK on Ubuntu 12.04
- Take a look at your hardware to make sure it’s compatible
- Install dependencies (just libglu1-mesa-dev in most cases)
- Download and untar the AMD-APP SDK
- Run the installation shell script and restart
- Change permissions on the install directory
- Compile and run the test apps
Checking hardware and installing dependencies
To figure out what kind of graphics card my laptop had, I typed $ sudo lspci -v | less . You can also try grepping for “VGA” to zero in on your graphics card.
I found my hardware and checked online to make sure it was all compatible.
After installing everything and trying to compile examples, the compiler gave me the error “GL/glu.h: No such file or directory.” GL/glu.h is provided by libglu1-mesa-dev, so $ sudo apt-get install libglu1-mesa-dev fixed my dependency issues.
Download and untar the AMD-APP SDK
Get the right installer for your architecture from the AMD APP SDK Downloads page. Once it’s finished downloading, untar it with $ tar xzvf [filename].tgz , replacing [filename] with whatever you downloaded. When it’s finished untarring, type $ sudo ./Install-AMD-APP to install the files. By default, they will install to /opt/AMDAPP. When installation is complete, reboot your computer.
Reboot and change permissions of the install directory
To finalize the installation, type $ sudo chown -R user:user /opt/AMDAPP (replacing “user” with your username) to set yourself as the owner of the installation directory.
Compile and run the test apps
If everything has worked so far, you should be able to compile the sample applications by going into the /opt/AMDAPP directory and typing $ make . When compilation is complete, go into the samples/opencl/bin/ directory to run the executables.
There are some pretty cool sample applications, including an FFT routine, a Black-Scholes calculator and a Mersenne twister PRNG.
AMD Installation Notes (pdf)