OpenCL for Cell

Investigation into how Linux on the PS3 might lead to homebrew development.

Moderators: cheriff, emoon

Post Reply
carlosn
Posts: 38
Joined: Thu Mar 10, 2005 2:14 am
Location: Orlando, Florida, US
Contact:

OpenCL for Cell

Post by carlosn »

This is great news! Cell now supports opencl. I installed the OpenCL Development Kit in my ps3. The Julia set sample outputs to the ps3 framebuffer with minor modifications to the Makefile.

Here is a link to the IBM website.

http://www.ibm.com/developerworks/forum ... 8&tstart=0
rapso
Posts: 140
Joined: Mon Mar 28, 2005 6:35 am

Post by rapso »

thx for sharing that, that's frickin cool. now all major platforms are supported by opencl, easy to write code once and get all the power from all kind of hardware.
I wonder if that will be also part of the cell sdk for ps3, just seen IBM server support so far.
carlosn
Posts: 38
Joined: Thu Mar 10, 2005 2:14 am
Location: Orlando, Florida, US
Contact:

Post by carlosn »

rapso wrote: I wonder if that will be also part of the cell sdk for ps3, just seen IBM server support so far.
The packages posted in the IBM website support the PS3 as well. The IBM BladeCenter QS22 has 2 cell processors inside. The software is compatible with the PS3. You have to install the cell sdk prior to installing the opencl sdk.
kengreen
Posts: 13
Joined: Thu Jul 31, 2008 9:34 am

Post by kengreen »

I had some problems running the julia example, whether I use the --ps3 switch or not. I have IBM SDK 3.1 installed on YDL 6.2 with IBM XLC-SSC 0.9 from SDK 3.0. The julia example compiles without error but running it, it complains about an incompatible kernel in the src directory.
carlosn
Posts: 38
Joined: Thu Mar 10, 2005 2:14 am
Location: Orlando, Florida, US
Contact:

Post by carlosn »

I am also running YDL 6.2 and cell sdk 3.1. The compiler I am using is good old reliable gcc/g++.

Besides installing the OpenCL Development Kit, did you also install the IBM XL Compiler for OpenCL, V0.1? Both downloads are provided by IBM.
KaL
Posts: 41
Joined: Sun Apr 03, 2005 9:59 pm

Post by KaL »

Well...
I installed the OpenCL rpms succesfully on my system...
But when I try executing the samples I get the following errors :

Code: Select all

[root@ramen ppc]# make clean
[root@ramen ppc]# make
gcc -I. -g -O3 -m32 -DPPM=0    -c -o julia_ocl.o ../src/julia_ocl.c
gcc -I. -g -O3 -m32 -DPPM=0    -c -o clock.o ../src/clock.c
gcc -I. -g -O3 -m32 -DPPM=0    -c -o ps3.o ../src/ps3.c
gcc -lCL -lnetpbm -m32 -lm -lstdc++  julia_ocl.o clock.o ps3.o ../src/ppm_util.h   -o julia_ocl
cp -f ../src/julia_kernel.cl .
[root@ramen ppc]# ./julia_ocl
Device: "ACCELERATOR CellBE processor"
Loading program source 'julia_kernel.cl'....
Error Log -- ERROR: no valid __kernel function found in source

[root@ramen ppc]#
I tried to tweak the .cl code, but still not working. Any idea of what's going wrong ? :/
carlosn
Posts: 38
Joined: Thu Mar 10, 2005 2:14 am
Location: Orlando, Florida, US
Contact:

Post by carlosn »

I had similar issues at the beginning. I believe the IBM XL Compiler for OpenCL is not installed properly. Installing the rpms located in the iso is not enough. You have to run the xlc_install (bash script) for proper installation. The only problem is the script checks for Fedora 7 or Red Hat Enterprise 5 installations before running.

My work around was to copy all the files from the iso to the local hard drive. Edit xlc_install and change lines number 56 and 82 to the following:

56. local ($cmpFixVer) = "0.1.0-0";
82. local (%cmp_pkgs) = &get_package_names ($prod, "$cmpVer$cmpFixVer");

Run the local copy of xlc_install and you should get this output on the screen.

Code: Select all

---------------------------------------------------------------------------- 
Starting IBM XL C for OpenCL for Multicore Acceleration for Linux
Installation Script 

---------------------------------------------------------------------------- 
[Stage 1]  Validating ./images-ppc/rpms/ Directory 
   INFORMATIONAL: -------- 0 
   Checking "opencl-xlc-lic--.ppc64.rpm" in "./images-ppc/rpms" .. (FAILED)
   WARNING: opencl-xlc-lic ... OK to miss 
[Stage 1]  Validating ./images-ppc/rpms/ Directory ----- (PASSED) 
---------------------------------------------------------------------------- 

---------------------------------------------------------------------------- 
[Stage 2]  Checking System Pre-requisites 
[Stage 2]  Checking System Pre-requisites ----- (PASSED) 
---------------------------------------------------------------------------- 

---------------------------------------------------------------------------- 
[Stage 3]  Retrieving installed XL compiler(s) info 
[Stage 3]  Retrieving installed XL compiler(s) info ----- (PASSED) 
---------------------------------------------------------------------------- 

---------------------------------------------------------------------------- 
[Stage 4]  Confirming to proceed with this installation 
[Stage 4]  Confirming to proceed with this installation ----- (PASSED) 
---------------------------------------------------------------------------- 

---------------------------------------------------------------------------- 
[Stage 5]  Uninstalling previous installations 
   No packages to be uninstalled. 
[Stage 5]  Uninstalling previous installations ----- (PASSED) 
---------------------------------------------------------------------------- 

---------------------------------------------------------------------------- 
[Stage 6]  Installing "XL C for OpenCL for Multicore Acceleration for Linux"
Version -0.1.0-0 
   Preparing... 	      
   ################################################## 
   opencl-xlc-cmp	      
   ################################################## 
   Warning:  already exists 
   opencl-xlc-man	      
   ################################################## 
   opencl-xlc-rte	      
   ################################################## 
   opencl-xlc-lib	      
   ################################################## 
   opencl-xlc-help	      
   ################################################## 
   opencl-cell-xlc-lib	      
   ################################################## 
   opencl-cell-xlc-cmp	      
   ################################################## 
   opencl-xlc-rte-lnk	      
   ################################################## 
[Stage 6]  Installing "XL C for OpenCL for Multicore Acceleration for Linux"
Version -0.1.0-0 ----- (PASSED) 
---------------------------------------------------------------------------- 

---------------------------------------------------------------------------- 
[Stage 7]  Configuring "XL C for OpenCL for Multicore Acceleration for Linux"
----- (PASSED) 
---------------------------------------------------------------------------- 

---------------------------------------------------------------------------- 
[Stage 8]  Creating symbolic links to "/usr/bin" 
   Do you want to create symbolic links for the "IBM XL C for OpenCL for
   Multicore Acceleration for Linux" compiler invocations in the "/usr/bin"
   location? 
   By accepting to create the symbolic links, the links below will be
   created.  Any existing "IBM XL C for OpenCL for Multicore Acceleration for
   Linux" compiler invocations in the "/usr/bin" will be removed before the
   links are created.
   Link 			    Source
   ===============		    ====================
   /usr/bin/xlcl		    /opt/ibmcmp/xlc/opencl/0.1/bin/xlcl
   /usr/bin/ppu-xlcl		    /opt/ibmcmp/xlc/opencl/0.1/bin/ppu-xlcl
   /usr/bin/spu-xlcl		    /opt/ibmcmp/xlc/opencl/0.1/bin/spu-xlcl
   ===============		    ====================
   Do you want to proceed with the symbolic links?    
   Please type "yes" or "no":  
   Symbolic links are created. 
[Stage 8]  Creating symbolic links to "/usr/bin" ----- (PASSED) 
---------------------------------------------------------------------------- 

---------------------------------------------------------------------------- 
"IBM XL C for OpenCL for Multicore Acceleration for Linux" Version -0.1.0-0
has been successfully installed. 
To learn about setting up your environment with "IBM XL C for OpenCL for
Multicore Acceleration for Linux", refer to the Installation Guide. 

Installation Completed. 
KaL
Posts: 41
Joined: Sun Apr 03, 2005 9:59 pm

Post by KaL »

Thanks a lot for the wrokaround !
It works now :)
kengreen
Posts: 13
Joined: Thu Jul 31, 2008 9:34 am

OpenCL

Post by kengreen »

Applied edits to xlc_install file, which must be named xlc_install, and all the OpenCL examples worked. The julia_ocl --ps3 must have more than 4M of frame buffer memory.
BlackScholes and Perin-noise also worked using the default settings.
rapso
Posts: 140
Joined: Mon Mar 28, 2005 6:35 am

Post by rapso »

allow me one stupid fanboy question, how is the performance?
anyone compared to pc builds?
carlosn
Posts: 38
Joined: Thu Mar 10, 2005 2:14 am
Location: Orlando, Florida, US
Contact:

Post by carlosn »

Well, the Julia set example provided in the samples is a good reference. It generates 50 frames in 1.92 sec. The frames are 512x512 in size. So we’re talking roughly at about 26 frames per seconds. I consider this real time.

I believe one of the samples in Mac OS produces Julia sets as well. I don’t have a Mac. Someone with a Mac OS could post the performance under that platform.

Couple of tips under the PS3:
julia_ocl –-ps3 --accel -i 500 // will give you about 25 secs of animation
Julia_ocl –b –-ps3 accel –i 500 // loads from binary source (faster)
carlosn
Posts: 38
Joined: Thu Mar 10, 2005 2:14 am
Location: Orlando, Florida, US
Contact:

Post by carlosn »

I wrote my first program in OpenCL. The program queries the OpenCL environment.

Here is a link to my website where you can download the program
http://home.earthlink.net/~carlos_neto/

Enjoy!

Carlos
rapso
Posts: 140
Joined: Mon Mar 28, 2005 6:35 am

Post by rapso »

can you mail me the julia code ( I guess it's part of the opencl sdk from ibm?) I will try to get it running on the gtx260 here.

rapsoo@hotmail.com

thx in advance
rapso
Posts: 140
Joined: Mon Mar 28, 2005 6:35 am

Post by rapso »

ok, i got the apple juliaset demo source and ported it to win32, i had to outcomment most of the opengl part, so i've no prove yet that everything works fine, but it was just a 20min lunch-time hack-port (and stepping through the loading, init and compute part does not show any obvious errors).

gfx card is gtx260:
framerate is between 250 and 280fps, most time around 260fps

edit:
could you tweak the kernel size and check if that affects the performance, please? from cuda I know this has usually quite a big impact. I've tested various "WorkGroupItems" and setting it to 64 gave ~330fps.
thx in advance!
vandungto
Posts: 1
Joined: Tue Nov 17, 2009 2:37 am

IBM OpenCL Forum

Post by vandungto »

If you have questions about the IBM OpenCL Development Kit, you can post your questions to the IBM OpenCL forum

http://www.alphaworks.ibm.com/tech/opencl/forum

You should get your questions answered quicker.
carlosn
Posts: 38
Joined: Thu Mar 10, 2005 2:14 am
Location: Orlando, Florida, US
Contact:

Post by carlosn »

I noticed the IBM website has updated the OpenCL developoment kit for the cell processor. The newer version installs just fine in my PS3.
For those of you who followed this tread from the beginning, there is a minor change to the above instructions. When you edit the xlc_install script, use the following parameters for lines 56 and 82:

56.local ($cmpFixVer) = "0.1.1-0";
82. local (%cmp_pkgs) = &get_package_names ($prod, "$cmpVer$cmpFixVer");

The rest of the instructions are identical.

I run my opencl_info program on this version and I can see IBM is starting to implement device extensions.

I posted a copy of the generated output in my website.
Post Reply