From mgd at santafe.edu  Fri Aug  3 20:57:09 2007
From: mgd at santafe.edu (Marcus G. Daniels)
Date: Fri, 03 Aug 2007 12:57:09 -0600
Subject: [Rd] Compiling R for the Sony Playstation 3?
In-Reply-To: <46B35E15.2050506@lancaster.ac.uk>
References: <40e66e0b0708010913o587880c9p7076462d4ea87359@mail.gmail.com>	<1185985821.3636.19.camel@Bellerophon.localdomain>	<40e66e0b0708030652i7f9e2923m326695818948e899@mail.gmail.com>	<Pine.LNX.4.64.0708030906330.30413@illuminati.stderr.org>
	<46B35E15.2050506@lancaster.ac.uk>
Message-ID: <46B37A85.3050200@santafe.edu>

Hi,
>> Beyond that, there may be a few more things that can be done to make R run 
>> "stupidly fast" on ps3 or IBM Cell blades.
>>
>>     
>
>   Wouldn't the right way to go here be to make it use the PS3 graphics 
> hardware, in a http://www.gpgpu.org/ kind of way? Or are the Cell 
> processors on the PS3 graphics processors too?
>   
The Cell can be thought as a mini cluster on a chip.  It uses messaging 
along the lines of the way one might program a distributed application 
using MPI, or organize a program for remote procedure calls.    However 
the latency is about 5 nanoseconds instead of 5 microseconds (as one 
might hope to get with typical high performance networking fabrics).  
Applications for the Cell are typically multithreaded on the PPU 
controlling synchronous, non-timeshared activity on the SPUs. 

The PS3 primary processor, the Celll PPU, is on the same silicon as the 
coprocessors, the SPUs.  The PPU is basically like what's in a Mac G5.  
The SPUs have less smarts in terms of out of order execution lookahead 
and they have only 256K local store.   Messaging is done using a DMA 
controller, and there are some C routines for that.   Newer versions of 
the GNU toolchain have an overlay manager so that the 256K localstore 
can be automatically managed for the most part. 
The SPUs instruction set is new, but GCC has a cross compiler that works 
fine for it.  

I think a lot of the work to make R take advantage of the Cell would be 
pretty general, e.g. localizing the scope of operations and making 
operations multithreaded...  It's desirable to keep computations on the 
local store as much as possible, but it doesn't seem to be crucial.   
The messaging is extremely fast.   It's almost like worrying about 
processor affinity on a SMP system.   Also, there's more need to profile 
and optimize the operations on the SPUs as they are dumb compared to a 
modern microprocessor (e.g. by explicit prefetching)

One nuisance with the PS3 itself (as opposed to IBM blades) is the 
limited RAM.   There's only 256MB.   It's pretty painful to bootstrap 
GCC, for example.
The RAM itself (Rambus XDR) is several times faster latency-wise than 
DDR2. 

Marcus



[Rd] Compiling R for the Sony Playstation 3?
Marcus G. Daniels