[R-sig-hpc] How to configure R to work with GPUs transparently

Dirk Eddelbuettel edd at debian.org
Fri Mar 19 19:12:53 CET 2010


On 19 March 2010 at 12:29, Spiers, Brad wrote:
| Ticket Name: R installation question
| Ticket ID: WATS-14
| Reply Submitted: Mar-18-2010 (02:49)
| Reply Submitted By: john
| Reply:  
| Hi Brad,<br />
| We're actually not in any way involved with the R project - they are an
| end user that has integrated our product.<br /> <br /> Notably, neither
| we nor CUBLAS provide a symbol "dgemm_" - that is a CPU call
| rather than a GPU call. The Nvidia CUBLAS provides cublasDgemm, which is
| the closest thing to that.  I don't know too much about the R-tools but
| you might want to also continue to link to a CPU BLAS with -lblas in the
| BLAS_LIBS.  The R package might still want to link both CPU and GPU
| versions in case a GPU is not present?<br /> <br /> Regards,<br /> John

That is a somewhat different story. 

Blas is indeed an external interface, and just how you can make your R
processing faster by installing an optimised Blas library like Goto, Atlas,
Intel MKL, ... you can conceivably also gain by letting the GPU handle Blas.
But as the answer stated, that still involves going 'inside' and replacing
dgemm class (to Blas) with cublasDgemm (to GPU).

Moreover, trouble is that back in real-life, we are rarely seeing our _total
processing_ constrained by the Blas / linear algebra portion.  Plus, some
Blas are already using multiple cores so the net gain is small.

|    I had thought that culatools provided a BLAS interface, but that is
| apparently wrong.  From the response above, I thought there might be
| some flag in R configuration that I could not find via
| googling--something like "--use-GPU" that would have R use some
| integrated version of culatools.  However, from the manuals and from
| what you're saying, that does not appear to be possible.

You are again asking for a magic wand. Someone would have had to add an
option --use-GPU.  But sadly, nobody has.

Dirk
 
PS  If you want to learn more about GPU programming and R, our upcoming
conference 'R / Finance' has both a GPU tutorial and a paper presentation,
both handled by J Buckner and M Seligman, authors of gputools.  Details in my
signature or at www.RinFinance.com


|    If anyone is aware of such a flag in R--one that will enable the GPU
| automatically, without changing code--please let me know.  Thanks.
| 
| --Brad
| 
| -----Original Message-----
| From: Dirk Eddelbuettel [mailto:edd at debian.org] 
| Sent: Friday, March 19, 2010 1:24 PM
| To: Spiers, Brad
| Cc: r-sig-hpc at r-project.org
| Subject: Re: [R-sig-hpc] How to configure R to work with GPUs
| transparently
| 
| 
| On 19 March 2010 at 11:55, Spiers, Brad wrote:
| |    I am trying to get R to work with an NVIDIA GPU transparently.  I
| | know about gputools, but they require changing R scripts to include
| | "gpu" before the relevant calls.  
| 
| Correct.
| 
| In order to execute code on the GPU instead of the CPU, you actually
| need to
| have code that the GPU understands and that is written in a way the such
| that
| the GPU features are taken advantage of.
| 
| And sadly, there is no magic wand that takes existing code and just
| makes it
| work there.  Just how you can't just execute your (x86) Windows binaries
| on
| your (old PPC) Mac etc pp.
| 
| |    According to the Cula Tools folks, R is actually a client of
| theirs,
| | so there should be some way to get R to work with GPUs natively.  I
| 
| Can you quote what they state, please?
| 
| | seriously doubt that I am the first person to try this.  If someone
| has
| | done this, could you please share how you have done so?  If you know
| | that this does not work, could you please confirm?  Thanks.
| 
| Dirk
| 
| -- 
|   Registration is open for the 2nd International conference R / Finance
| 2010
|   See http://www.RinFinance.com for details, and see you in Chicago in
| April!

-- 
  Registration is open for the 2nd International conference R / Finance 2010
  See http://www.RinFinance.com for details, and see you in Chicago in April!



More information about the R-sig-hpc mailing list