Initial prototype for GPU backend

A GPU backend implements two important abstract classes:

  1. org.apache.sysml.runtime.controlprogram.context.GPUContext
  2. org.apache.sysml.runtime.controlprogram.context.GPUObject

The GPUContext is responsible for GPU memory management and initialization/destruction of Cuda handles.

A GPUObject (like RDDObject and BroadcastObject) is stored in CacheableData object. It gets call-backs from SystemML's bufferpool on following methods

  1. void acquireDeviceRead()
  2. void acquireDenseDeviceModify(int numElemsToAllocate)
  3. void acquireHostRead()
  4. void acquireHostModify()
  5. void release(boolean isGPUCopyModified)


The current prototype supports Nvidia's CUDA libraries using JCuda wrapper. The implementation for the above classes can be found in:

  1. org.apache.sysml.runtime.controlprogram.context.JCudaContext
  2. org.apache.sysml.runtime.controlprogram.context.JCudaObject

Setup instructions for JCudaContext:

  1. Follow the instructions from and install CUDA 7.5.
  2. Follow the instructions from and install CuDNN v4.
  3. Download install JCuda binaries version 0.7.5b and JCudnn version 0.7.5. Easiest option would be to use mavenized jcuda:
git clone
mvn -Djcuda.version=0.7.5b -Djcudnn.version=0.7.5 clean package
for j in `ls $JCUDA_PATH/*.jar`

Note for Windows users:

  • CuDNN v4 is available to download:
  • If above steps doesn't work for JCuda, copy the DLLs into C:\lib (or /lib) directory.

To use SystemML's GPU backend,

  1. Add JCuda's jar into the classpath.
  2. Include CUDA, CuDNN and JCuda's libraries in LD_LIBRARY_PATH (or using -Djava.library.path).
  3. Use -gpu flag.

For example: to use GPU backend in standalone mode:

java -classpath $JAR_PATH:systemml-0.10.0-incubating-SNAPSHOT-standalone.jar org.apache.sysml.api.DMLScript -f MyDML.dml -gpu -exec singlenode ...