From luke at stat.uiowa.edu  Fri Nov  2 16:03:51 2007
From: luke at stat.uiowa.edu (Luke Tierney)
Date: Fri, 2 Nov 2007 10:03:51 -0500 (CDT)
Subject: [Rd] Cell or PS3 Port
In-Reply-To: <47235AC1.9040302@sixfoursystems.com>
References: <47235AC1.9040302@sixfoursystems.com>
Message-ID: <Pine.LNX.4.64.0711020947280.6214@nokomis.stat.uiowa.edu>

I have been experimenting with ways of parallelizing many of the
functions in the math library.  There are two experimental packages
available in http://www.stat.uiowa.edu/~luke/R/experimental: 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.

luke

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
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

-- 
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:      luke at stat.uiowa.edu
Iowa City, IA 52242                 WWW:  http://www.stat.uiowa.edu



[Rd] Cell or PS3 Port
Luke Tierney