Re: [Rd] Cell or PS3 Port

From: Luke Tierney <>
Date: Fri, 2 Nov 2007 10:03:51 -0500 (CDT)

I have been experimenting with ways of parallelizing many of the functions in the math library. There are two experimental packages available in pnmath, based on OpenMP, and pnmath0, based on basic pthreads. I'm not sure to what degree the approach there would carry over to GPUs or Cell where the additional processors are different from the main processor and may not share memory (I forget how that works on Cell).

The first issue is that you need some modifications to the some functions to ensure they are thread-safe. For the most part these are minor; a few functions would require major changes and I have not tackled them for now (Bessel functions, wilcox, signrank I believe). RNG functions are also not suitable for parallelization given the dependence on the sequential underlying RNG.

It is not too hard to get parallel versions to use all available processor cores. The challenge is to make sure that the parallel versions don't run slower than the serial versions. They may if the amount of data is too small. What is too small for each function depends on the OS and the processor/memory architecture; if memory is not shared this gets more complicated still. For some very simple functions (floor, ceiling, sign) I could not see any reliable benefit of parallelization for reasonable data sizes on the systems I was using so I left those alone for now.


On Sat, 27 Oct 2007, Ed Knutson wrote:

> Hello,
> I am interested in optimizing some of R's vector math functions to
> utilize the SPE units of the Cell processor (commonly found in the
> Playstation 3) and I am wondering if anyone has already done any work in
> that area. I can't find anything using the search page or Google.
> (Admittedly it is difficult to search for information on a
> one-letter-named programming language whose contributed documentation
> intrinsically refers to "cells" frequently. :) I'm assuming it will be
> possible to compile R under a PS3 version of Linux, since it has a ppc64
> architecture and R already runs on OS X. Are there any known caveats to
> compiling R for a distro like Ubuntu with X11 support?
> I'm just going through the Cell SDK documentation at this point so it
> will be a few days before I really get into the guts of it. Any
> information would be greatly appreciated.
> -Ed
> ______________________________________________
> mailing list

Luke Tierney
Chair, Statistics and Actuarial Science
Ralph E. Wareham Professor of Mathematical Sciences
University of Iowa                  Phone:             319-335-3386
Department of Statistics and        Fax:               319-335-3017
    Actuarial Science
241 Schaeffer Hall                  email:
Iowa City, IA 52242                 WWW:

______________________________________________ mailing list
Received on Fri 02 Nov 2007 - 15:16:05 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 03 Nov 2007 - 21:30:14 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.