Tell me more ×
Computational Science Stack Exchange is a question and answer site for scientists using computers to solve scientific problems. It's 100% free, no registration required.

I have just installed a Nvidia GT660 graphic card on my desktop and, after some struggle, I manage to interface it with R.

I have been playing with several R packages that use GPUs, especially gputools, and I was comparing the time taken by my GPU and CPU to perform some basic operations:

  • inverting matrices (CPU faster)
  • qr decomposition (CPU faster)
  • big correlation matrices (CPU faster)
  • matrix multiplication (GPU much faster!)

Notice that I have experimented mainly with gputools so maybe other packages perform better.

In broad terms my question is: what some routine statistical operations that might be worth executing on a GPU rather than a CPU?

share|improve this question
Anything involving lots of matrix multiplication? :) GPUs are quite popular in the neural nets community. – larsmans Feb 24 at 23:26
you need to provide the size of the matrices involved. For example, last i checked (admittedly 2 years ago) inversion and decomposition were only faster on GPU starting from large matrices (2^9 times 2^9 and upwards) – user189035 Feb 24 at 23:29
1  
I used matrices of around $10^3 \times 10^3$ for inversion, qr and matrix multiplication, while for correlations I have used around 10^4 observations of vectors of size 100. For matrix inversion the GPU was much slower, while for qr decomposition it was slower but comparable to the CPU. – Jugurtha Feb 24 at 23:38
2  
this is a very good question but i think you'll get better answers by having it migrated to stackoverflow (through i think similar questions have been asked there before) – user189035 Feb 25 at 0:06
1  
GPU's advantage of regular CPU's is the fact that they can be "massively" parallel, not that they are faster per core. As such, for jobs that require a lot of "housekeeping" like Cholesky factorization etc. you need to use block algorithms and so forth to get significant speed-up; this is not trivial and I assume it will take a while before GPU's take over such operations. What is definitely going the GPU way is MCMC-ing (and Random Number generation). Sampling from a posterior has "parallelization" written all over it... And sparse matrices computations; they are already "blocked" anyway... – user11852 Feb 25 at 7:13
show 1 more comment

migrated from stats.stackexchange.com Feb 25 at 17:22

2 Answers

For all of the applications you mentioned, GPUs should be more capable (from a hardware perspective) than CPUs for sufficiently large matrices. I don't know anything about R's implementation, but I've used cuBLAS and Magma with great success for inversions around $n = 2^{10}$ and multiplication/correlation for rectangular matrices with $n,m \approx 2^{10}, k \approx 2^{14}$. It is an especially big surprise to me that large correlation matrices would be faster on the CPU using R.

More broadly, I suspect most statistical operations that spend most of their time in dense linear algebra (BLAS, Lapack functionality) can be efficiently implemented on the GPU.

share|improve this answer

Multiple Imputation methods for Missing Data? Like those in Alice-II (R).

I think those tend to be often embarrassingly parallel and hence suitable to a GPU architecture. Never tried it myself though.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.