Friday, April 17, 2009

Installing SDK3.1 on YDL6.1

While installing the SDK, I ran into a couple problems, after running the command:
/opt/cell/cellsdk --iso ./ install
I accepted the first agreement, went ok for a bit, and got the error:

cellsdk INFO-2033: cellsdk is unable to find any SDK files in the yum repositories.
cellsdk INFO-2033: Be sure the --iso flag was used and that network connections are working.

Taking a look at the install script using:
nano /opt/cell/cellsdk

and scrolling down to find:
let redhat=0
for file in `ls /etc/*-release 2>/dev/null`; do
((redhat += `grep -ic "red hat" $file`))
done
if ((redhat > 0)); then
distro="RHEL"
else
distro="Fedora"


it looks like our distro doesn't have an option here.

To fix this, change the ((redhat += 'grep -ic "red hat" $file'))
to: ((redhat += 'grep -ic "yellow dog" $file'))

Save the changes, and re-run the install script. Should work fine!

If you have any other errors, first try mounting the iso
/opt/cell/cellsdk --iso ./ mount

YDL 6.1 for PS3 - A dream come true

If you are using Fedora 9, i strongly suggest switching. This linux distro is great on the ps3.

The link is right here:

http://ydl.oregonstate.edu/iso/

just grab the ps3 iso.

Saturday, April 11, 2009

Now that the SDK is installed.. Lets say "Hello Cell!"

IBM included some code for us when we installed the SDK, so lets check out the simple Hello Cell program. First we need to locate, untar, and make all the executable files in the tutorials.

  1. cd /opt/cell/sdk/src Is the directory with example code
  2. for i in ./*.tar; do tar -xf $i; done To untar every .tar in the folder
  3. make makes all the files in the directories.
  4. I got a few errors, but we'll solve those at some other time.
  5. First of all, lets test the Hello Cell program:
  6. cd /tutorial/simple/
  7. Run the 'simple' program
  8. ./simple
The output should look like:

Hello Cell (0x1818008)
Hello Cell (0x1818280)
Hello Cell (0x1818518)
Hello Cell (0x1818790)
Hello Cell (0x1818a08)
Hello Cell (0x1818c80)

Installing SDK 3.1 on Fedora 9

  1. Download the .rpm and the .iso file from the IBM website, the link is provided on another blog post (Just search the blog for it)
  2. You may need to download some files to get it started, so run:
  3. yum install tcl
  4. Run the RPM file with the following command:
  5. rpm -ivh cell-install-3.1.0-0.0.noarch.rpm *I got the error: error: Failed dependencies:
    /usr/bin/tclsh is needed by cell- ..... install the above to clear this type error
  6. After the rpm installs, you should have some more commands available, now lets install the SDK!
  7. If you are installing from the .iso (which you should if you are reading this!):
  8. /opt/cell/cellsdk --iso ./install
  9. The ./ represents current directory, replace this with whatever dir your ISO file is in.
  10. Say yes to all the agreements.

Download Link for Cell SDK

http://www.ibm.com/developerworks/power/cell/downloads.html

Differences between SDK 2 and SDK 3

Ok after doing some reading, the big difference between SDK 2 and 3 is that rather than use their standard functions in the libspe.h to create threads, they give you more flexibility by simply using whatever thread library you want. In Linux I guess most people use pthreads, and then you use their functions to manage your pthreads. It's a little more overhead, but gives more flexibility for you to choose your threading library..

PThread information:
https://computing.llnl.gov/tutorials/pthreads/

Friday, April 10, 2009

Compiling code on SDK 3.1

spu-gcc spe_example.c -o spe_example
ppu-embedspu test_handle spe_example spe_example_csf.o
ppu-gcc ppe_example.c spe_example_csf.o -lspe2 -o ppe_example

the first command compiles the spe code,
the second command embeds the spe code into the ppe program (gives it the handles)
the third command compiles the code and links to executable

MIT Course on the Cell (SDK2.0)

http://cag.csail.mit.edu/ps3/cellminiref.shtml

Changes in Libspe2

http://www.ibm.com/developerworks/library/pa-libspe2/?S_TACT=105AGX59&S_CMP=GR&ca=dgr-lnxw961libspe2

Example Links for SDK 3.1

http://www-cse.ucsd.edu/classes/fa08/cse260/Cell.html

SPE Multithread Creation SDK3.0

http://www.ibm.com/developerworks/forums/thread.jspa?threadID=195262&tstart=0

Starter Link for PS3 Development / Linux Install

http://www.ibm.com/developerworks/power/library/pa-linuxps3-1/index.html?S_TACT=105AGX01&S_CMP=LP

IBM Code Sample Page

http://www.ibm.com/developerworks/library/pa-sdkexamples/index.html

Link to IBM Developer Blog for PS3

http://www.ibm.com/developerworks/blogs/page/powerarchitecture?tag=infobombs

Getting rid of your GUI to save memory

Check out your PS3 memory usage by using the command 'top' while in the command line.
You'll see that your memory usage is damn near 90% or above.

The GUI running takes up a huge chunk of memory, so lets kill it! (it doesnt work anyway..)
  1. Change the runmode to multi-user network mode, using the command /sbin/init 3
  2. If you want to take a look at other run modes, check the file in /etc/inittab
  3. Reboot your machine to apply the settings, you should now only have a command prompt, but have more memory available.
  4. Run xterm if you need to do anything graphical (look at previous blog post)
  5. To switch back to the previous runmode, /sbin/init 5 should do the trick.
Running Xterm on your PS3:
One suggestion I have is to rather than use the GUI on the PS3 (Because it's God awful slow), is to log into your PS3 remotely through SSH, and run xterm to forward the rendering to your remote machine.

To do this:
  1. Log into the PS3 using the command ssh -X (PS3 IP), ex. ssh -X 255.255.255.255
  2. Once logged in, simply run xterm.
* This is running Fedora 9, SDK 3.1