问题
I'm interested in developing software for Sony PlayStation 3 consoles which contains a multi-core Cell processor, targeting any PS3-compatible Linux distribution.
"A single PS3 performs better than the highest-end desktops available and compares to as many as 25 nodes of an IBM Blue Gene supercomputer." ~ PlayStation3 Gravity Grid
Most importantly:
- CPU - Any Linux OS has access to 6 of the 7 Synergistic Processing Elements
- GPU - Sony implements a hypervisor restricting access to the RSX
- Parallel - IBM provides an introduction to programming parallel applications on the PS3
So to get started:
- Install Linux on the PS3:
- For YDL Linux - installation guide here
- For Fedora 8 - installation guide here and here.
- For Ubuntu 8 - compiling and installation guide here.
- For OpenSUSE- any guides?
- For Debian - any guides?
- Get an IDE with a compiler suitable for that Linux. ..(help!)
- C++ IDE: KDevelop, Eclipse CDT, Code::Blocks
- GCC 4.3 with Binutils 4.1
- IBM XL for the Cell - available as part of IBM's Cell SDK
- OpenMPI for PowerPC Linux ..(what?)
回答1:
You may want to try Offload C++ from Codeplay Software. It provides an extended dialect of C++ easing development of software on multicore hardware like the Cell processor.
A cross compiler toolchain allows compilation of code for the PS3 on Windows, which can be useful given the resource constraints (e.g. system memory) on a PS3 console running Linux, which can impact compile times and make the use of a PS3 as a desktop awkward.
Versions of the Offload C++ compiler and tools are available targeting the PS3 GameOS and Linux on Cell with the Cell BE SDK. The Cell Linux version integrates with the Eclipse CDT for an IDE.
Disclaimer: I am a developer at Codeplay.
回答2:
You might also try Ubuntu 8.10 (Intrepid Ibex). Their PS3 support is pretty good, and instructions for installation and a rough primer on compilation can be found here. GCC 4.3 and binutils 4.18 include targets for the Cell PPU (a generic PowerPC target) and SPUs, and there are packages available in the Ubuntu repositories (e.g. spu-gcc, spu-g++, spu-binutils, ppu-gdb, spu-newlib, etc) which will compile binaries for you.
As far as a proper IDE, the above utilities should integrate fine with about any IDE (i.e. KDevelop, Eclipse CDT, Code::Blocks), so long as you can find syntax highlighting files (available for most popular IDEs). The Cell SDK is available as well, and could potentially provide better integration, and packages are available for RHEL 5.2 and Fedora 9 (should be able to use alien to pull these into Debian/Ubuntu, but not sure on that).
OpenMPI is a fine idea, they've been able to compile it for Cell-based blades (here) so I don't think it should be an issue. You could also roll your own message passing, as low overhead is key in extracting good performance on the Cell (though I don't know how well-suited OpenMPI is for this, it could be great).
回答3:
Matthew Scarpino's book, Programming the Cell Processor, is pretty up to date and has a lot of good information. Also, the website for the book has a lot of example code available for download.
There was also an MIT course on parallel programming via the Cell processor that has some good info, although some of it is out of date, namely, it uses the old cell mechanics where libspe provided its own threads. With the newest version of the library, you will need to get your threads from elsewhere (pthreads, boost, whatever) in order to run parallel programs.
As for OS and compiler, I've been using Yellow Dog Linux 6.1. YDL has worked out pretty well so far, much better than Fedora 9 anyway, although that is likely a result of the fact that YDL comes with a super-lightweight window manager and Fedora 9 doesn't. I had a few problems with networking, but those are most likely a product of the slightly bizarre network environment that I have the system set up in.
Once I had YDL up and running, I then installed the cell sdk fedora packages on top of (this takes a little bit of work, as the cellsdk install script falsely recognizes YDL as RHEL, not Fedora). YDL does have most of the SDK available in one of their package repos, but by default not much of it is installed, just the compilers (of course, I didn't figure this out until I had already hacked the IBM installer to do the right thing). I'm just using the basic IBM compilers (not the XL stuff).
There is also a ton of information scattered around the IBM site, but it can be a bit hard to make sense of.
回答4:
Be mindful when running code on the SPEs of their special design -- the default stack size varies widely from compiler to compiler, and can cause all sorts of issues when you overflow. It's usually a good practice to declare most data globally in SPE code, and avoid the stack except for very small variable allocations.
Since there's no cache (or... its all L2 cache, in a sense), there's no real performance penalty to doing this, and you'll never run into problems like trying to DMA data to or from a memory address that is no longer valid, etc.
The IBM SPE compiler is generally considered the best, afaik, although I have never used it, personally.
来源:https://stackoverflow.com/questions/467711/develop-for-playstation-3-linux