Skip to content

jjfumero/fastr-gpu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FastR-GPU Compiler

This is a fork of FastR with GPU support. The GPU backend is an extension of GraalVM and Graal Compiler with OpenCL code generation and data management for GPU computing.

The goal of the FastR-GPU compiler is to automatically execute R expressions on the GPU. It extends Truffle, Graal and a GPU backend for Graal (Marawacc) for compiling an R program into OpenCL. It profiles and specialises R input programs to OpenCL using the Graal Partial Evaluator and compiles the resulting intermediate representation to OpenCL at runtime. This project is a research prototype.

Example

> marawacc.deviceInfo()
NAME             : Hawaii
VENDOR           : Advanced Micro Devices, Inc.
TYPE             : GPU
DRIVER           : 1598.5 (VM)
MAX COMPUTE UNITS: 44
MAX FREQUENCY    : 1030
GLOBAL MEMORY    : 3221225472
LOCAL  MEMORY    : 32768
ENDIANESS        : LITTLE_ENDIAN


> marawacc.init()
> size <- 100000
> # It is executed on the GPU when the R program is JIT by Graal
> mapply(function(x, y) x * y, runif(size), runif(size)) 

Installation

Get the mx tool:

$ mkdir ~/fastr-gpu/
$ cd fastr-gpu
$ git clone https://github.com/graalvm/mx
$ cd mx 
$ git checkout 900cc06  
$ cd -
$ export PATH=$PWD/mx:$PATH

Create source file:

export PATH=/path/to/mx/mx/:$PATH
export JAVA_HOME=/path/to/jdk1.8x/
export DEFAULT_VM="server"

Get the R & Marawacc (OpenCL) JIT compilers:

$ mkdir fastr-gpu
$ cd fastr-gpu
$ git clone [email protected]:jjfumero/jvmci-marawacc.git jvmci     ## Download JVMCI dependency
$ git clone [email protected]:jjfumero/truffle-marawacc.git truffle ## Download Truffle dependency
$ git clone https://github.com/jjfumero/graal-marawacc graal     ## Download Graal dependency
$ git clone [email protected]:jjfumero/marawacc.git marawacc
$ export JAVA_HOME=/home/juan/bin/jdk1.8.0_91
$ export DEFAULT_VM="server"
$ export PATH=/home/juan/bin/gcc/gcc-5.4.0/bin/:$PATH
$ export LD_LIBRARY_PATH=/home/juan/bin/gcc/gcc-5.4.0/lib64/:$LD_LIBRARY_PATH 
$ export PATH=$PWD/mx:$PATH
$ cd marawacc
$ make 

Build fastr-gpu:

$ cd ..
$ git clone [email protected]:jjfumero/fastr-gpu.git
$ cd fastr-gpu
$ make 
$ . source.sh 

Build done!!!

Eclipse

To generate the Eclipse files:

$ make eclipse 

Then import the projects into eclipse

Note

This compiler has been tested on Linux Fedora 21/22/23, CentOS 7.4 - CentOS 7.9 and OpenSuse 13 with OpenJDK >= 1.8_61.

Current implementation with JDK 8 u91.

Publications

License

GPL V2

Who do I talk to?

This project is a research prototype implemented at The University of Edinburgh. The project was partially funded by Oracle Labs.

Main Developer

Juan Fumero < juan.fumero @ manchester.ac.uk >

Advisors

Christophe Dubach < christophe.dubach @ ed.ac.uk >
Michel Steuwer < michel.steuwer @ ed.ac.uk >
Lukas Stadler < lukas.stadler @ oracle.com >

FastR

FastR is an implementation of the R Language in Java atop Truffle and Graal. Truffle is a framework for building self-optimizing AST interpreters. Graal is a dynamic compiler that is used to generate efficient machine code from partially evaluated Truffle ASTs.

FastR is an open-source effort of Purdue University, Johannes Kepler University Linz, and Oracle Labs.

For more details and instructions for downloading and building the system, please visit the FastR Wiki.