Thursday, August 6, 2009

Installing AMD's opencl implementation for CPU

I just installed AMD's implementation of OpenCL for it's CPU's on Fedora 11, x86-64. Here's how to do it.

1. Download the SDK from here. and unpack the sdk.

1A. Move the decompressed archive into the place where you want to install it. I chose /home/rpg/bin. I don't like binary crap arbitrarily polluting my system directories and settings.

2. Enter the directory of the sdk and do


You could use make -j2 or even make -j4 if you have multiple cores to burn.

3. Now you need to add a few places to your paths. Add this to your .bashrc and .bash_profile files. Both of them should be in your home folder.




The installation notes provided by SDK have some typos. For a start, it is lib and not bin and you add different folders for different architectures. And you definitely don't need root access for this.

Lucky me though, I have a SSE3 capable CPU. It is ironic to note that the inventor of x86-64 is leaving behind the classic x86-64. I wonder why they felt SSE3 was mandatory.

After all this, this is what I get to see,

$ ./BlackScholes
For test only: Expires on Wed Sep 30 00:00:00 2009

0.118873 7.04261 0 0.00272289 0 33.9944 5.90269 0.0174322 15.6142 31.8218 0.208182 31.4897 36.4303 4.70751 0 0 0.180582 0 23.1549 0 56.4034 19.635 38.0241 0.00524368 2.9981 52.4114 33.1443 50.3665 0 36.6461 0.167021 0.00245133

9.18383 0.216879 56.2858 23.5745 51.5608 3.39307e-06 0.0396819 14.4737 0.00709584 0 5.18874 0 0 3.79125 63.0257 49.3472 17.1783 51.754 0.191513 16.1561 0 0 0 29.3654 0.00833774 0 0 4.21006e-06 17.8919 6.60636e-05 4.04936 31.1893

Option samples Time taken(sec) Options / sec
4096 1.565 2617.25

The exact paths have been scrubbed from the output here though. Enjoy!


Kashyap said...

nice... though the moot point for me is:
I have a single core cpu (maybe i shud try it in the lab), and then the funny "For test only: Expires on Wed Sep 30 00:00:00 2009"

RPG said...

Well, yeah, mainly for the lab.

They say, newer versions will be available before that, so let's hope a situation like povray won't crop up here.

Details on povray situation,

Matthieu Brucher said...


Did you notice a speed gain compared to the usual code (or even Fortran code)?

RPG said...

I haven't benchmarked it yet. It may very well be the case that this version's aim is correctness over optimization.