[ 
https://issues.apache.org/jira/browse/SPARK-3785?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14319777#comment-14319777
 ] 

Sam Halliday commented on SPARK-3785:
-------------------------------------

Hi all, just joining the thread :-)

I'm the author of netlib-java. I recommend watching my ScalaX talk 
http://fommil.github.io/scalax14/#/ for anybody who hasn't seen it yet. I talk 
about beyond-CPU acceleration in the last few slides (just after the Breeze 
examples).

In my decade of industrial experience with these things, the GPU is a *lot* 
faster than the CPU for large matrix operations, but slower for smaller ones 
(1000 elements or less). Typically, operations that are highly parallelisable, 
such as matrix multiplication, have a constant time cost rather than linear in 
number of elements.

However, the big problem with GPUs is memory management. If you have a problem 
that you're happy to solve entirely on the GPU, you're going to get great 
performance at the cost of less portability... a major consideration for a JVM 
based application. The trick is minimising how much data you need to transmit 
between the traditional CPU memory space and the GPU memory space. And further 
optimisations can be obtained by using the GPU profilers that come with the 
card.

It is for this reason that GPU-backed implementations of BLAS/LAPACK can only 
match, but not surpass, the performance of Intel MKL. There exist BLAS-LIKE and 
LAPACK-LIKE implementations for GPUs (e.g. cuBLAS, clBLAS) but they can only be 
used when you hold pointers to the GPU memory regions and are not good for use 
from Java/Scala (unless you are using macros/code generators to really generate 
native code).

I have links with FPGA companies and I'd love to see a full BLAS implementation 
using that custom hardware... but it's such a mammoth task the FPGA 
implementors (not me) would need to be funded to do it.

I am very hopeful about the cutting edge commodity tech coming from Intel/AMD 
(e.g. APUs) which allow CPU and GPU to share the memory region. I would love to 
buy one of these machines and write a minimal BLAS implementation to do some 
benchmarks and see if we can get GPU performance without the memory transfer 
overhead. My project https://github.com/fommil/multiblas (which was abandoned 
until the tech caught up) would be a perfect place to do this and would involve 
only runtime changes for Spark users to benefit. But, to be honest, I'd 
probably need funding to turn my attention to this because I've got a few other 
personal priorities at the moment.

I've heard the raspberry pi has such a shared region. It might be interesting 
to use it as a cheapo dev environment.

> Support off-loading computations to a GPU
> -----------------------------------------
>
>                 Key: SPARK-3785
>                 URL: https://issues.apache.org/jira/browse/SPARK-3785
>             Project: Spark
>          Issue Type: Brainstorming
>          Components: MLlib
>            Reporter: Thomas Darimont
>            Priority: Minor
>
> Are there any plans to adding support for off-loading computations to the 
> GPU, e.g. via an open-cl binding? 
> http://www.jocl.org/
> https://code.google.com/p/javacl/
> http://lwjgl.org/wiki/index.php?title=OpenCL_in_LWJGL



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to