项目作者: jjfumero

项目描述 :
Demos used for the TornadoVM talk at the NYJavaSIG Group 2021
高级语言: Java
项目地址: git://github.com/jjfumero/nyjavasig-tornadovm-2021.git
创建时间: 2021-02-06T08:42:47Z
项目社区:https://github.com/jjfumero/nyjavasig-tornadovm-2021

开源协议:Apache License 2.0

下载


NYJavaSIG 2021 Demos

This repository contains examples and tests shown at the NYJavaSIG TornadoVM talk in Feb 2021

Link to the event: Video Recording

Pre-requisites and Setup

  • Install TornadoVM. Full guideline here
  • OpenCL or PTX device:
    • If OpenCL is selected, installation with OpenCL >= 1.2 installed
    • If the PTX backend is selected, CUDA >= 10
  • Maven 3.6

Once TornadoVM is installed, please configure the sources.sh file with your paths to the JAVA_HOME and TORNADO_ROOT.

All these examples and scripts uses Java 8. For JDK >= 11, please file an issue, and we can work through it together.

  1. ## Provide the paths to your path to the OpenJDK+JVMCI bin
  2. export JAVA_HOME=<path-to-OpenJDK>
  3. # Provide your path to the TornadoVM root folder
  4. export TORNADO_ROOT=<path-to-TornadoVM>
  5. ## Keep these env-variables are they are
  6. export PATH="${PATH}:${TORNADO_ROOT}/bin/bin/"
  7. export TORNADO_SDK=${TORNADO_ROOT}/bin/sdk
  8. export CLASSPATH=target/tornado-1.0-SNAPSHOT.jar

Run:

  1. . sources.sh

Compile this tutorial:

  1. mvn clean package

1) Running DFT

This example is taken from the example-suite of TornadoVM:

How to run it?

  1. tornado nyjavasig.DFT <inputSize> <version:sequential|tornadoVM> <numIterations>

Example:

  1. # Running Sequential
  2. tornado nyjavasig.DFT 8192 sequential 10
  3. # Running Parallel Version with TornadoVM
  4. tornado nyjavasig.DFT 8192 tornado 10

Changing device?

  1. # Running Parallel Version with TornadoVM
  2. tornado --debug -Ds0.t0.device=0:1 nyjavasig.DFT 8192 tornado 10

Print Kernel:

  1. # Running Parallel Version with TornadoVM
  2. tornado --printKernel --debug -Ds0.t0.device=0:1 nyjavasig.DFT 8192 tornado 10

2) Running on FPGAs

Note, you need an FPGA to run these demos.

Run DFT on the FPGA
  1. tornado --debug --printKernel -Ds0.t0.device=0:2 -Dtornado.fpga.conf.file=dftFPGA.conf nyjavasig.DFT 8192 tornado 5

Running with Emulation mode:

  1. export CL_CONTEXT_EMULATOR_DEVICE_INTELFPGA=1
  2. tornado --debug --printKernel -Ds0.t0.device=0:2 -Dtornado.fpga.conf.file=dftFPGA.conf nyjavasig.DFT 8192 tornado 5
Running BlackScholes
  1. tornado --debug -Ds0.t0.device=0:2 -Dtornado.fpga.conf.file=blackScholes.conf nyjavasig.BlackScholes 33554432 5

3) Running Live Task Migration

Demo using the Client-Server application to change the devices through the client:

How to run it?:

  1. ## Run Server in one terminal
  2. ./runServer.sh
  3. ## Client in another terminal
  4. ./runClient.sh

4) Python

  1. cd python
  2. ## Run TornadoVM accelerated (512 x 512 Doubles)
  3. ./runPython.sh mxmWithTornadoVM.py

5) Running TornadoVM with Ideal Graph Visualizer (IGV)

IGV can be downloaded from Oracle OTN

Run IGV 20.2.0

  1. ~/Downloads/20.2.0/idealgraphvisualizer/bin/idealgraphvisualizer &

Run an example (vector add)

  1. tornado --igv nyjavasig.TestTornado