Coder Social home page Coder Social logo

5gapp / tornadovm Goto Github PK

View Code? Open in Web Editor NEW

This project forked from beehive-lab/tornadovm

1.0 3.0 0.0 50.38 MB

🌪️ TornadoVM: A practical and efficient heterogeneous programming framework for managed languages

License: Apache License 2.0

Makefile 0.04% Shell 1.29% Python 1.19% Java 88.90% C 8.57% CMake 0.02%

tornadovm's Introduction

1. TornadoVM

🌪️ TornadoVM is a plug-in to OpenJDK and GraalVM that allows programmers to automatically run Java programs on heterogeneous hardware. TornadoVM currently targets OpenCL-compatible devices and it runs on multi-core CPUs, dedicated GPUs (NVIDIA, AMD), integrated GPUs (Intel HD Graphics and ARM Mali), and FPGAs (Intel and Xilinx).

For a quick introduction please read the following FAQ.

Current Release: TornadoVM 0.7 - 22/06/2020 : See CHANGELOG

Previous Releases can be found here

2. Installation

TornadoVM can be installed either from scratch or by using Docker.

You can also run TornadoVM on Amazon AWS CPUs, GPUs, and FPGAs following the instructions here.

3. Usage Instructions

TornadoVM is currently being used to accelerate machine learning and deep learning applications, computer vision, physics simulations, financial applications, computational photography, and signal processing.

We have a use-case, kfusion-tornadovm, for accelerating a computer-vision application implemented in Java using the Tornado-API to run on GPUs.

We also have a set of examples that includes NBody, DFT, KMeans computation and matrix computations.

Additional Information

Benchmarks

Reductions

Execution Flags

FPGA execution

Profiler Usage

4. Programming Model

TornadoVM exposes to the programmer task-level, data-level and pipeline-level parallelism via a light Application Programming Interface (API). TornadoVM uses single-source property, in which the code to be accelerated and the host code live in the same Java program.

The following code snippet shows a full example to accelerate Matrix-Multiplication using TornadoVM.

public class Compute {
    private static void mxm(Matrix2DFloat A, Matrix2DFloat B, Matrix2DFloat C, final int size) {
        for (@Parallel int i = 0; i < size; i++) {
            for (@Parallel int j = 0; j < size; j++) {
                float sum = 0.0f;
                for (int k = 0; k < size; k++) {
                    sum += A.get(i, k) * B.get(k, j);
                }
                C.set(i, j, sum);
            }
        }
    }

    public void run(Matrix2DFloat A, Matrix2DFloat B, Matrix2DFloat C, final int size) {
        TaskSchedule ts = new TaskSchedule("s0")
                .streamIn(A, B)                            // Stream data from host to device
                .task("t0", Compute::mxm, A, B,  C, size)  // Each task points to an existing Java method
                .streamOut(C);                             // sync arrays with the host side
        ts.execute();   // It will execute the code on the default device (e.g. a GPU)
    }
}

5. Dynamic Reconfiguration

Dynamic reconfiguration is the ability of TornadoVM to perform live task migration between devices, which means that TornadoVM decides where to execute the code to increase performance (if possible). In other words, TornadoVM switches devices if it knows the new device offers better performance. With the task-migration, the TornadoVM's approach is to only switch device if it detects an application can be executed faster than the CPU execution using the code compiled by C2 or Graal-JIT, otherwise it will stay on the CPU. So TornadoVM can be seen as a complement to C2 and Graal. This is because there is no single hardware to best execute all workloads efficiently. GPUs are very good at exploiting SIMD applications, and FPGAs are very good at exploiting pipeline applications. If your applications follow those models, TornadoVM will likely select heterogeneous hardware. Otherwise, it will stay on the CPU using the default compilers (C2 or Graal).

To use the dynamic reconfiguration, you can execute using TornadoVM policies. For example:

// TornadoVM will execute the code in the best accelerator.
ts.execute(Policy.PERFORMANCE);

Further details and instructions on how to enable this feature can be found here.

6. How to Use it in your Projects?

You can import the API and start using TornadoVM. Set this in the pom.xml file.

   <repositories>
     <repository>
       <id>universityOfManchester-graal</id>
       <url>https://raw.githubusercontent.com/beehive-lab/tornado/maven-tornadovm</url>
     </repository>
   </repositories>
  
   <dependencies>   
      <dependency>
         <groupId>tornado</groupId>
         <artifactId>tornado-api</artifactId>
         <version>0.7</version>
      </dependency>
      <dependency>
         <groupId>tornado</groupId>
         <artifactId>tornado-matrices</artifactId>
         <version>0.7</version>
      </dependency>
   </dependencies>

To run TornadoVM, you need to either install the TornadoVM extension for GraalVM/OpenJDK, or run with our docker images.

7. Additional Resources

Here you can find videos, presentations, and articles and artefacts describing TornadoVM and how to use it.

8. Academic Publications

Selected publications and citations can be found here.

9. Acknowledgments

This work was initially supported by the EPSRC grants PAMELA EP/K008730/1 and AnyScale Apps EP/L000725/1, and now it is funded by the EU Horizon 2020 E2Data 780245 and the EU Horizon 2020 ACTiCLOUD 732366 grants.

10. Contributions and Collaborations

We welcome collaborations! Please see how to contribute in the CONTRIBUTIONS.

A mailing list is also available to discuss TornadoVM related issues:

[email protected]

For collaborations please contact Christos Kotselidis.

11. TornadoVM Team

This work was originated by James Clarkson under the joint supervision of Mikel Luján and Christos Kotselidis. Currently, this project is maintained and updated by the following contributors:

12. Licenses

To use TornadoVM, you can link the TornadoVM API to your application which is under the CLASSPATH Exception of GPLv2.0.

Each TornadoVM module is licensed as follows:

Module License
Tornado-Runtime License: GPL v2 + CLASSPATH Exception
Tornado-Assembly License: GPL v2 + CLASSPATH Exception
Tornado-Drivers License: GPL v2 + CLASSPATH Exception
Tornado-API License: GPL v2 + CLASSPATH Exception
Tornado-Drivers-OpenCL-Headers License: MIT
Tornado-scripts License: GPL v2
Tornado-Annotation License
Tornado-Unittests License
Tornado-Benchmarks License
Tornado-Examples License
Tornado-Matrices License

tornadovm's People

Contributors

jjfumero avatar mikepapadim avatar stratika avatar gigiblender avatar kotselidis avatar foutrisn avatar dalexandrov avatar zakkak avatar jclarkson avatar gaur4vgaur avatar mjw99 avatar mairooni avatar dependabot[bot] avatar

Stargazers

tom zhou avatar

Watchers

tom zhou avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.