### Run TornadoVM Examples and Benchmarks Source: https://tornadovm.readthedocs.io/en/latest/_sources/installation.rst.txt Commands to execute example applications and benchmarks. ```bash $ tornado -m tornado.examples/uk.ac.manchester.tornado.examples.compute.MatrixMultiplication2D 1024 ``` ```bash $ tornado -m tornado.benchmarks/uk.ac.manchester.tornado.benchmarks.BenchmarkRunner dft ``` -------------------------------- ### Verify TornadoVM Installation Source: https://tornadovm.readthedocs.io/en/latest/_sources/installation.rst.txt Check available devices, run unit tests, or execute specific examples to confirm the installation. ```bash # list the accelerator devices that are reachable from TornadoVM tornado --devices # run unit tests tornado-test -V ## run specific examples (e.g., NBody) tornado -m tornado.examples/uk.ac.manchester.tornado.examples.compute.NBody ``` -------------------------------- ### Example Windows Path Directories Source: https://tornadovm.readthedocs.io/en/latest/_sources/ide-integration.rst.txt Example paths for CMake and the Python virtual environment on Windows. ```bash C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\ ``` ```bash \.venv\Scripts ``` -------------------------------- ### Install Documentation Dependencies Source: https://tornadovm.readthedocs.io/en/latest/_sources/build-documentation.rst.txt Install required Sphinx themes and extensions. ```bash pip3 install sphinx_rtd_theme pip3 install sphinxcontrib-jquery ``` -------------------------------- ### Display TornadoVM Installer Help Source: https://tornadovm.readthedocs.io/en/latest/installation.html View available command-line options for the installer script. ```bash $ ./bin/tornadovm-installer --help usage: tornadovm-installer [-h] [--jdk JDK] [--backend BACKEND] [--version] [--listJDKs] [--polyglot] [--mvn_single_threaded] [--auto-deps] TornadoVM Installer Tool. It will install all software dependencies except the GPU/FPGA drivers options: -h, --help show this help message and exit --jdk JDK Specify a JDK to install by its keyword (e.g., 'jdk21', 'graal-jdk-21'). Run with --listJDKs to view all available JDK keywords. --backend BACKEND Select the backend to install: { opencl, ptx, spirv } --version Print version --listJDKs List supported JDKs --polyglot Enable Truffle Interoperability with GraalVM --mvn_single_threaded Run Maven in single-threaded mode --auto-deps Automatic download and use any missing dependencies ``` -------------------------------- ### Run TornadoVM Examples Source: https://tornadovm.readthedocs.io/en/latest/installation.html Command to run a specific TornadoVM example. ```bash $ tornado -m tornado.examples/uk.ac.manchester.tornado.examples.compute.MatrixMultiplication2D 1024 ``` -------------------------------- ### Verify TornadoVM Installation Source: https://tornadovm.readthedocs.io/en/latest/_sources/installation.rst.txt Initialize the environment and list available devices to confirm successful installation. ```bash source setvars.sh tornado --devices ``` -------------------------------- ### Install and Initialize Pre-commit Hooks Source: https://tornadovm.readthedocs.io/en/latest/_sources/developer-guidelines.rst.txt Install the pre-commit framework and initialize the hooks in the repository to automate style checks. ```bash pip install pre-commit pre-commit install ``` -------------------------------- ### Display TornadoVM installer help Source: https://tornadovm.readthedocs.io/en/latest/_sources/installation.rst.txt Run this command to view available options and flags for the automated installation script. ```bash $ ./bin/tornadovm-installer --help usage: tornadovm-installer [-h] [--jdk JDK] [--backend BACKEND] [--version] [--listJDKs] [--polyglot] [--mvn_single_threaded] [--auto-deps] TornadoVM Installer Tool. It will install all software dependencies except the GPU/FPGA drivers ``` -------------------------------- ### Install Intel Compute Runtime Packages Source: https://tornadovm.readthedocs.io/en/latest/installation.html Command to install the downloaded .deb packages. ```bash sudo dpkg -i *.deb ``` -------------------------------- ### Install Sphinx Source: https://tornadovm.readthedocs.io/en/latest/_sources/build-documentation.rst.txt Install the Sphinx documentation generator using pip. ```bash pip3 install -U sphinx ``` -------------------------------- ### Install WSL Source: https://tornadovm.readthedocs.io/en/latest/_sources/installation.rst.txt Install the Windows Subsystem for Linux using PowerShell. ```bash ## By default, Windows 11 installs Ubuntu 24.04 LTS, as in Jan 2025 wsl --install ``` -------------------------------- ### Install Intel Compute Runtime Source: https://tornadovm.readthedocs.io/en/latest/_sources/installation.rst.txt Download and install Intel OpenCL and Level Zero drivers for WSL. ```bash mkdir -p ~/bin/neo cd ~/bin/neo wget https://github.com/intel/intel-graphics-compiler/releases/download/v2.2.3/intel-igc-core-2_2.2.3+18220_amd64.deb wget https://github.com/intel/intel-graphics-compiler/releases/download/v2.2.3/intel-igc-opencl-2_2.2.3+18220_amd64.deb wget https://github.com/intel/compute-runtime/releases/download/24.48.31907.7/intel-level-zero-gpu-dbgsym_1.6.31907.7_amd64.ddeb wget https://github.com/intel/compute-runtime/releases/download/24.48.31907.7/intel-level-zero-gpu_1.6.31907.7_amd64.deb wget https://github.com/intel/compute-runtime/releases/download/24.48.31907.7/intel-opencl-icd-dbgsym_24.48.31907.7_amd64.ddeb wget https://github.com/intel/compute-runtime/releases/download/24.48.31907.7/intel-opencl-icd_24.48.31907.7_amd64.deb wget https://github.com/intel/compute-runtime/releases/download/24.48.31907.7/libigdgmm12_22.5.4_amd64.deb ``` -------------------------------- ### Run Matrix Multiplication Example Source: https://tornadovm.readthedocs.io/en/latest/_sources/simple-start.rst.txt Executes the MatrixMultiplication1D example on a specific device using the tornado command. ```bash $ tornado --jvm="-Ds0.t0.device=1:1" -m tornado.examples/uk.ac.manchester.tornado.examples.compute.MatrixMultiplication1D ``` -------------------------------- ### FPGA Configuration File Example Source: https://tornadovm.readthedocs.io/en/latest/_sources/cloud.rst.txt Example content for an AWS FPGA configuration file defining device paths, compiler flags, and S3 storage settings. ```ini [device] DEVICE_NAME = /home/centos/src/project_data/aws-fpga/Vitis/aws_platform/xilinx_aws-vu9p-f1_shell-v04261818_201920_3/xilinx_aws-vu9p-f1_shell-v04261818_201920_3.xpfm [options] COMPILER=v++ FLAGS = -O3 -j12 # Configure the compilation flags. You can also pass the HLS configuration file (e.g. --config conf.cfg). DIRECTORY_BITSTREAM = fpga-source-comp/ # If the FPGA is in AWS EC2 F1 Instance AWS_ENV = yes [AWS S3 configuration] AWS_S3_BUCKET = tornadovm-fpga-bucket AWS_S3_DCP_KEY = outputfolder AWS_S3_LOGS_KEY = logfolder ``` -------------------------------- ### Execute Polyglot Examples Source: https://tornadovm.readthedocs.io/en/latest/_sources/truffle-languages.rst.txt Run the provided TornadoVM examples to demonstrate interoperability with Python, JavaScript, and Ruby. ```bash $ tornado --debug -m tornado.examples/uk.ac.manchester.tornado.examples.polyglot.HelloPython $ tornado --debug -m tornado.examples/uk.ac.manchester.tornado.examples.polyglot.HelloJS $ tornado --debug -m tornado.examples/uk.ac.manchester.tornado.examples.polyglot.HelloRuby ``` -------------------------------- ### Install TornadoVM Source: https://tornadovm.readthedocs.io/en/latest/_sources/cloud.rst.txt Clone the TornadoVM repository and run the installer as a CentOS user. ```bash $ git clone https://github.com/beehive-lab/TornadoVM.git $ cd TornadoVM $ ./bin/tornadovm-installer $ source setvars.env ``` -------------------------------- ### Setup CUDA in WSL Source: https://tornadovm.readthedocs.io/en/latest/_sources/installation.rst.txt Update the WSL system and remove old CUDA keys before installing the CUDA SDK. ```bash ## Update the system sudo apt-get update sudo apt-get dist-upgrade ``` ```bash sudo apt-key del 7fa2af80 ``` -------------------------------- ### Example Device Discovery Output Source: https://tornadovm.readthedocs.io/en/latest/_sources/simple-start.rst.txt Sample output showing detected PTX and OpenCL devices with their respective configurations. ```bash Number of Tornado drivers: 2 Total number of PTX devices : 1 Tornado device=0:0 PTX -- GeForce GTX 1650 Global Memory Size: 3.8 GB Local Memory Size: 48.0 KB Workgroup Dimensions: 3 Max WorkGroup Configuration: [1024, 1024, 64] Device OpenCL C version: N/A Total number of OpenCL devices : 4 Tornado device=1:0 NVIDIA CUDA -- GeForce GTX 1650 Global Memory Size: 3.8 GB Local Memory Size: 48.0 KB Workgroup Dimensions: 3 Max WorkGroup Configuration: [1024, 1024, 64] Device OpenCL C version: OpenCL C 1.2 Tornado device=1:1 Intel(R) OpenCL HD Graphics -- Intel(R) Gen9 HD Graphics NEO Global Memory Size: 24.8 GB Local Memory Size: 64.0 KB Workgroup Dimensions: 3 Max WorkGroup Configuration: [256, 256, 256] Device OpenCL C version: OpenCL C 2.0 Tornado device=1:2 Intel(R) OpenCL -- Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz Global Memory Size: 31.0 GB Local Memory Size: 32.0 KB Workgroup Dimensions: 3 Max WorkGroup Configuration: [8192, 8192, 8192] Device OpenCL C version: OpenCL C 1.2 Tornado device=1:3 AMD Accelerated Parallel Processing -- Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz Global Memory Size: 31.0 GB Local Memory Size: 32.0 KB Workgroup Dimensions: 3 Max WorkGroup Configuration: [1024, 1024, 1024] Device OpenCL C version: OpenCL C 1.2 ``` -------------------------------- ### Install TornadoVM on Windows Source: https://tornadovm.readthedocs.io/en/latest/_sources/installation.rst.txt Use a virtual environment to manage dependencies and invoke the installer on Windows. ```bash rem invoke the Microsoft Visual Studio Tool Terminal .\bin\windowsMicrosoftStudioTools2022.cmd rem create and activate a virtual environment python -m venv .venv .venv\Scripts\activate.bat python bin\tornadovm-installer ``` -------------------------------- ### Run Polyglot Example Scripts Source: https://tornadovm.readthedocs.io/en/latest/_sources/truffle-languages.rst.txt Execute provided polyglot examples using the test script or direct CLI commands. ```bash $ ./scripts/polyglotTests.sh ``` ```bash $ tornado --printKernel --truffle python $TORNADOVM_HOME/examples/polyglotTruffle/mxmWithTornadoVM.py ``` ```bash $ tornado --printKernel --truffle js $TORNADOVM_HOME/examples/polyglotTruffle/mxmWithTornadoVM.js ``` ```bash $ tornado --printKernel --truffle ruby $TORNADOVM_HOME/examples/polyglotTruffle/mxmWithTornadoVM.rb ``` -------------------------------- ### Run TornadoVM example with Intel Docker image Source: https://tornadovm.readthedocs.io/en/latest/_sources/fpga-programming.rst.txt Executes a DFTMT example using the TornadoVM Docker image with specific JVM device flags. ```bash ./run_intel_openjdk.sh tornado \ --jvm="-Ds0.t0.device=1:0 " -m tornado.examples/uk.ac.manchester.tornado.examples.dynamic.DFTMT --params="1024 default 10" ``` -------------------------------- ### Clone and Build TornadoVM Source: https://tornadovm.readthedocs.io/en/latest/_sources/installation.rst.txt Download the source code and run the installer. ```bash cd ~/ git clone https://github.com/beehive-lab/TornadoVM.git tornado cd tornado ./bin/tornadovm-installer ``` -------------------------------- ### Build the SPIR-V Backend Source: https://tornadovm.readthedocs.io/en/latest/_sources/spirv-backend.rst.txt Use the TornadoVM installer to enable the SPIR-V backend during the build process. ```bash $ cd $ ./bin/tornadovm-installer $ Select the backend(s) to install: $ 1. opencl $ 2. spirv $ 3. ptx $ You can select more than one by typing the numbers separated by commas (e.g., 1, 2, 3). $ Your selection: 2 $ . setvars.sh ``` -------------------------------- ### Install macOS Dependencies Source: https://tornadovm.readthedocs.io/en/latest/installation.html Install required build tools via Homebrew. ```bash brew install wget brew install maven ``` -------------------------------- ### Install Linux Dependencies Source: https://tornadovm.readthedocs.io/en/latest/_sources/installation.rst.txt Install required build tools on Red Hat or Ubuntu-based systems. ```bash sudo dnf install gcc g++ git cmake python3 ``` ```bash sudo apt-get install gcc g++ git cmake python3 ``` -------------------------------- ### Verify and Install Intel Drivers Source: https://tornadovm.readthedocs.io/en/latest/_sources/installation.rst.txt Verify checksums and install the downloaded Debian packages. ```bash wget https://github.com/intel/compute-runtime/releases/download/24.48.31907.7/ww48.sum sha256sum -c ww48.sum ``` ```bash sudo dpkg -i *.deb ``` -------------------------------- ### Configure and run Intel FPGA emulator Source: https://tornadovm.readthedocs.io/en/latest/_sources/fpga-programming.rst.txt Sets the required environment variable to enable Intel FPGA emulation and executes the example. ```bash $ export CL_CONTEXT_EMULATOR_DEVICE_INTELFPGA=1 ``` ```bash env CL_CONTEXT_EMULATOR_DEVICE_INTELFPGA=1 tornado \ --jvm="-Ds0.t0.device=0:1" -m tornado.examples/uk.ac.manchester.tornado.examples.dynamic.DFTMT \ --params="1024 normal 10" ``` -------------------------------- ### Compile TornadoVM Source: https://tornadovm.readthedocs.io/en/latest/installation.html Initializes the virtual environment and runs the installer to compile the project. ```batch python -m venv .venv .venv\Scripts\activate.bat .\bin\windowsMicrosoftStudioTools2022.cmd python bin\tornadovm-installer setvars.cmd ``` -------------------------------- ### Configure and Compile TornadoVM Source: https://tornadovm.readthedocs.io/en/latest/_sources/installation.rst.txt Initialize the environment and run the installer or recompile with specific backends. ```bash python -m venv .venv .venv\Scripts\activate.bat .\bin\windowsMicrosoftStudioTools2022.cmd python bin\tornadovm-installer setvars.cmd ``` ```bash python -m venv .venv .venv\Scripts\activate.bat .\bin\windowsMicrosoftStudioTools2022.cmd nmake /f Makefile.mak jdk21 BACKEND=opencl,ptx setvars.cmd ``` -------------------------------- ### Install Dependencies for RISC-V Source: https://tornadovm.readthedocs.io/en/latest/_sources/installation.rst.txt Install required system packages and create a symbolic link for the OpenCL library. ```bash sudo apt-get install clinfo gcc g++ sudo ln -s libOpenCL.so.1 libOpenCL.so ``` -------------------------------- ### Run Polyglot Language Examples Source: https://tornadovm.readthedocs.io/en/latest/truffle-languages.html Executes matrix multiplication examples for specific languages using the TornadoVM Truffle integration. ```bash $ tornado --printKernel --truffle python $TORNADOVM_HOME/examples/polyglotTruffle/mxmWithTornadoVM.py ``` ```bash $ tornado --printKernel --truffle js $TORNADOVM_HOME/examples/polyglotTruffle/mxmWithTornadoVM.js ``` ```bash $ tornado --printKernel --truffle ruby $TORNADOVM_HOME/examples/polyglotTruffle/mxmWithTornadoVM.rb ``` -------------------------------- ### Install TornadoVM on macOS Source: https://tornadovm.readthedocs.io/en/latest/_sources/installation.rst.txt Install dependencies and TornadoVM on Apple Silicon hardware. ```bash brew install wget brew install maven ``` ```bash git clone https://github.com/beehive-lab/TornadoVM.git cd TornadoVM bin/tornadovm-installer Select the backend(s) to install: 1. opencl 2. spirv 3. ptx You can select more than one by typing the numbers separated by commas (e.g., 1, 2, 3). Your selection: 1 source setvars.sh ``` ```bash # list the accelerator devices that are reachable from TornadoVM tornado --devices # run unit tests tornado-test -V ## run specific examples (e.g., NBody) tornado -m tornado.examples/uk.ac.manchester.tornado.examples.compute.NBody ``` ```bash source setvars.sh make ``` -------------------------------- ### Set Environment Variables Source: https://tornadovm.readthedocs.io/en/latest/_sources/installation.rst.txt Initialize environment variables after installation. ```bash source setvars.sh ``` ```bash C:> setvars.cmd ``` -------------------------------- ### Install SPIR-V Tools Source: https://tornadovm.readthedocs.io/en/latest/_sources/spirv-backend.rst.txt Install the spirv-tools package to enable binary disassembly on common Linux distributions. ```bash ## Fedora OS sudo dnf install spirv-tools ## Ubuntu OS: sudo apt-get install spirv-tools ``` -------------------------------- ### Run TornadoVM example with Intel oneAPI emulator Source: https://tornadovm.readthedocs.io/en/latest/_sources/fpga-programming.rst.txt Executes the DFTMT example using the aocl-ioc64 emulator compiler provided by Intel oneAPI. ```bash tornado \ --jvm="-Ds0.t0.device=1:0 " -m tornado.examples/uk.ac.manchester.tornado.examples.dynamic.DFTMT --params="1024 default 10" ``` -------------------------------- ### Install CUDA Toolkit on WSL Source: https://tornadovm.readthedocs.io/en/latest/_sources/installation.rst.txt Commands to download and install the NVIDIA CUDA toolkit for WSL environments. ```bash wget https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-wsl-ubuntu.pin sudo mv cuda-wsl-ubuntu.pin /etc/apt/preferences.d/cuda-repository-pin-600 wget https://developer.download.nvidia.com/compute/cuda/12.6.3/local_installers/cuda-repo-wsl-ubuntu-12-6-local_12.6.3-1_amd64.deb sudo dpkg -i cuda-repo-wsl-ubuntu-12-6-local_12.6.3-1_amd64.deb sudo cp /var/cuda-repo-wsl-ubuntu-12-6-local/cuda-*-keyring.gpg /usr/share/keyrings/ sudo apt-get update sudo apt-get -y install cuda-toolkit-12-6 ``` -------------------------------- ### Setup Python Environment for TornadoVM Source: https://tornadovm.readthedocs.io/en/latest/_sources/installation.rst.txt Create and activate a virtual environment for TornadoVM dependencies. ```bash sudo apt install python3-venv ## Setup a new environment for Python modules python3 -m venv ~/bin/venv source ~/bin/venv/bin/activate ``` -------------------------------- ### Execute Intel FPGA emulation with environment variable Source: https://tornadovm.readthedocs.io/en/latest/fpga-programming.html Run a TornadoVM example with the Intel emulation environment variable explicitly set. ```bash env CL_CONTEXT_EMULATOR_DEVICE_INTELFPGA=1 tornado \ --jvm="-Ds0.t0.device=0:1" -m tornado.examples/uk.ac.manchester.tornado.examples.dynamic.DFTMT \ --params="1024 normal 10" ``` -------------------------------- ### Recompile TornadoVM Backend Source: https://tornadovm.readthedocs.io/en/latest/installation.html Switch or update the backend configuration after initial installation. ```bash source setvars.sh make BACKEND=opencl ``` -------------------------------- ### Execute Xilinx FPGA emulation Source: https://tornadovm.readthedocs.io/en/latest/fpga-programming.html Run a TornadoVM example on a Xilinx platform configured for emulation. ```bash tornado \ --jvm="-Ds0.t0.device=0:1" -m tornado.examples/uk.ac.manchester.tornado.examples.dynamic.DFTMT \ --params="1024 normal 10" ``` -------------------------------- ### Build and Verify TornadoVM on Linux Source: https://tornadovm.readthedocs.io/en/latest/_sources/installation.rst.txt Clone, install, and verify TornadoVM on Linux systems. ```bash git clone https://github.com/beehive-lab/TornadoVM.git cd TornadoVM bin/tornadovm-installer Select the backend(s) to install: 1. opencl 2. spirv 3. ptx You can select more than one by typing the numbers separated by commas (e.g., 1, 2, 3). Your selection: 1, 2, 3 source setvars.sh ``` ```bash # list the accelerator devices that are reachable from TornadoVM tornado --devices # run unit tests tornado-test -V ## run specific examples (e.g., NBody) tornado -m tornado.examples/uk.ac.manchester.tornado.examples.compute.NBody ``` ```bash source setvars.sh make BACKEND=opencl ``` -------------------------------- ### Bytecode execution output Source: https://tornadovm.readthedocs.io/en/latest/multi-device.html Example output showing bytecode operations like ALLOC, TRANSFER, and LAUNCH across different devices. ```text Interpreter instance running bytecodes for: [NVIDIA CUDA] -- NVIDIA GeForce RTX 3070 Running in thread: pool-1-thread-1 bc: ALLOC [I@2ffe106e on [NVIDIA CUDA] -- NVIDIA GeForce RTX 3070 , size=0 bc: ALLOC [I@705e1b5b on [NVIDIA CUDA] -- NVIDIA GeForce RTX 3070 , size=0 bc: ALLOC [F@63f945a3 on [NVIDIA CUDA] -- NVIDIA GeForce RTX 3070 , size=0 bc: TRANSFER_HOST_TO_DEVICE_ONCE [Object Hash Code=0x2ffe106e] [I@2ffe106e on [NVIDIA CUDA] -- NVIDIA GeForce RTX 3070 , size=0, offset=0 [event list=-1] bc: TRANSFER_HOST_TO_DEVICE_ONCE [Object Hash Code=0x63f945a3] [F@63f945a3 on [NVIDIA CUDA] -- NVIDIA GeForce RTX 3070 , size=0, offset=0 [event list=-1] bc: LAUNCH task blur.red - compute on [NVIDIA CUDA] -- NVIDIA GeForce RTX 3070, size=0, offset=0 [event list=0] bc: ALLOC [I@738395e4 on [NVIDIA CUDA] -- NVIDIA GeForce RTX 3070 , size=0 bc: ALLOC [I@1d78beeb on [NVIDIA CUDA] -- NVIDIA GeForce RTX 3070 , size=0 bc: TRANSFER_HOST_TO_DEVICE_ONCE [Object Hash Code=0x738395e4] [I@738395e4 on [NVIDIA CUDA] -- NVIDIA GeForce RTX 3070 , size=0, offset=0 [event list=-1] bc: LAUNCH task blur.blue - compute on [NVIDIA CUDA] -- NVIDIA GeForce RTX 3070, size=0, offset=0 [event list=2] bc: TRANSFER_DEVICE_TO_HOST_ALWAYS [0x705e1b5b] [I@705e1b5b on [NVIDIA CUDA] -- NVIDIA GeForce RTX 3070 , size=0, offset=0 [event list=3] bc: TRANSFER_DEVICE_TO_HOST_ALWAYS [0x1d78beeb] [I@1d78beeb on [NVIDIA CUDA] -- NVIDIA GeForce RTX 3070 , size=0, offset=0 [event list=5] bc: DEALLOC [0x2ffe106e] [I@2ffe106e on [NVIDIA CUDA] -- NVIDIA GeForce RTX 3070 bc: DEALLOC [0x705e1b5b] [I@705e1b5b on [NVIDIA CUDA] -- NVIDIA GeForce RTX 3070 bc: DEALLOC [0x63f945a3] [F@63f945a3 on [NVIDIA CUDA] -- NVIDIA GeForce RTX 3070 bc: DEALLOC [0x738395e4] [I@738395e4 on [NVIDIA CUDA] -- NVIDIA GeForce RTX 3070 bc: DEALLOC [0x1d78beeb] [I@1d78beeb on [NVIDIA CUDA] -- NVIDIA GeForce RTX 3070 bc: BARRIER event-list 17 bc: END Interpreter instance running bytecodes for: [Intel(R) OpenCL] -- 13th Gen Intel(R) Core(TM) i7-13700 Running in thread: pool-1-thread-2 bc: ALLOC [I@41ac3343 on [Intel(R) OpenCL] -- 13th Gen Intel(R) Core(TM) i7-13700 , size=0 bc: ALLOC [I@16c36388 on [Intel(R) OpenCL] -- 13th Gen Intel(R) Core(TM) i7-13700 , size=0 bc: ALLOC [F@63f945a3 on [Intel(R) OpenCL] -- 13th Gen Intel(R) Core(TM) i7-13700 , size=0 bc: TRANSFER_HOST_TO_DEVICE_ONCE [Object Hash Code=0x41ac3343] [I@41ac3343 on [Intel(R) OpenCL] -- 13th Gen Intel(R) Core(TM) i7-13700 , size=0, offset=0 [event list=-1] bc: TRANSFER_HOST_TO_DEVICE_ONCE [Object Hash Code=0x63f945a3] [F@63f945a3 on [Intel(R) OpenCL] -- 13th Gen Intel(R) Core(TM) i7-13700 , size=0, offset=0 [event list=-1] bc: LAUNCH task blur.green - compute on [Intel(R) OpenCL] -- 13th Gen Intel(R) Core(TM) i7-13700, size=0, offset=0 [event list=1] bc: TRANSFER_DEVICE_TO_HOST_ALWAYS [0x16c36388] [I@16c36388 on [Intel(R) OpenCL] -- 13th Gen Intel(R) Core(TM) i7-13700 , size=0, offset=0 [event list=4] bc: DEALLOC [0x41ac3343] [I@41ac3343 on [Intel(R) OpenCL] -- 13th Gen Intel(R) Core(TM) i7-13700 bc: DEALLOC [0x16c36388] [I@16c36388 on [Intel(R) OpenCL] -- 13th Gen Intel(R) Core(TM) i7-13700 bc: DEALLOC [0x63f945a3] [F@63f945a3 on [Intel(R) OpenCL] -- 13th Gen Intel(R) Core(TM) i7-13700 bc: BARRIER event-list 17 bc: END ``` -------------------------------- ### Execute BlurFilter on Multiple Devices Source: https://tornadovm.readthedocs.io/en/latest/_sources/multi-device.rst.txt Run the BlurFilter example by explicitly assigning specific tasks to different devices using JVM properties. ```bash $ tornado --threadInfo \ --jvm=" -Dblur.red.device=0:0 -Dblur.green.device=0:1 -Dblur.blue.device=0:0" \ -m tornado.examples/uk.ac.manchester.tornado.examples.compute.BlurFilter ``` -------------------------------- ### Extract and Display Features Source: https://tornadovm.readthedocs.io/en/latest/_sources/profiler.rst.txt Example command to run an NBody example with feature extraction enabled, followed by the resulting JSON output. ```bash $ tornado --jvm="-Dtornado.feature.extraction=True" -m tornado.examples/uk.ac.manchester.tornado.examples.compute.NBody --params "1024 1" ``` ```json { "nBody": { "BACKEND" : "PTX", "DEVICE_ID": "0:2", "DEVICE": "GeForce GTX 1650", "Global Memory Loads": "15", "Global Memory Stores": "6", "Constant Memory Loads": "0", "Constant Memory Stores": "0", "Local Memory Loads": "0", "Local Memory Stores": "0", "Private Memory Loads": "20", "Private Memory Stores": "20", "Total Loops": "2", "Parallel Loops": "1", "If Statements": "2", "Integer Comparison": "2", "Float Comparison": "0", "Switch Statements": "0", "Switch Cases": "0", "Vector Operations": "0", "Integer & Float Operations": "57", "Boolean Operations": "9", "Cast Operations": "2", "Float Math Functions": "1", "Integer Math Functions": "0" } } ``` -------------------------------- ### Verify OpenCL installation Source: https://tornadovm.readthedocs.io/en/latest/_sources/fpga-programming.rst.txt Use clinfo to check for available OpenCL platforms and devices. ```bash $ clinfo Number of platforms 1 Platform Name Intel(R) FPGA SDK for OpenCL(TM) Platform Vendor Intel(R) Corporation Platform Version OpenCL 1.0 Intel(R) FPGA SDK for OpenCL(TM), Version 17.1 Platform Profile EMBEDDED_PROFILE Platform Extensions cl_khr_byte_addressable_store cles_khr_int64 cl_intelfpga_live_object_tracking cl_intelfpga_compiler_mode cl_khr_icd cl_khr_3d_image_writes Platform Extensions function suffix IntelFPGA Platform Name Intel(R) FPGA SDK for OpenCL(TM) Number of devices 1 Device Name p385a_sch_ax115 : nalla_pcie (aclnalla_pcie0) Device Vendor Nallatech ltd Device Vendor ID 0x1172 Device Version OpenCL 1.0 Intel(R) FPGA SDK for OpenCL(TM), Version 17.1 Driver Version 17.1 Device OpenCL C Version OpenCL C 1.0 Device Type Accelerator ``` -------------------------------- ### Run TornadoVM NVIDIA Experiment Source: https://tornadovm.readthedocs.io/en/latest/docker.html Example of cloning the repository and executing a matrix multiplication experiment using the provided runner script. ```bash $ git clone https://github.com/beehive-lab/docker-tornado $ cd docker-tornado ## Run Matrix Multiplication - provided in the docker-tornado repository $ ./run_nvidia_openjdk.sh tornado -cp example/target/example-1.0-SNAPSHOT.jar example.MatrixMultiplication Computing MxM of 2048x2048 CPU Execution: 0.36 GFlops, Total time = 48254 ms GPU Execution: 277.09 GFlops, Total Time = 62 ms Speedup: 778x ``` -------------------------------- ### Run Intel Matrix Multiplication Experiment Source: https://tornadovm.readthedocs.io/en/latest/_sources/docker.rst.txt Execute a matrix multiplication example on Intel hardware using the provided runner script. ```bash $ git clone https://github.com/beehive-lab/docker-tornado $ cd docker-tornado ## Run Matrix Multiplication - provided in the docker-tornado repository $ ./run_intel_openjdk.sh tornado -cp example/target/example-1.0-SNAPSHOT.jar example.MatrixMultiplication --parms="256" ``` -------------------------------- ### Build and Visualize Documentation Source: https://tornadovm.readthedocs.io/en/latest/_sources/build-documentation.rst.txt Execute the build process and open the generated HTML files in a browser. ```bash make docs ## visualize the documentation (E.g., with Firefox) firefox docs/build/html/index.html ``` -------------------------------- ### Concurrent Execution Output Source: https://tornadovm.readthedocs.io/en/latest/multi-device.html Example output showing task information and device assignment when concurrent execution is enabled. ```text Task info: blur.red Backend : OPENCL Device : NVIDIA GeForce RTX 3070 CL_DEVICE_TYPE_GPU (available) Dims : 2 Global work offset: [0, 0] Global work size : [4000, 6000] Local work size : [32, 30, 1] Number of workgroups : [125, 200] Task info: blur.green Backend : OPENCL Device : 13th Gen Intel(R) Core(TM) i7-13700 CL_DEVICE_TYPE_CPU (available) Dims : 2 Global work offset: [0, 0] Global work size : [24, 1] Local work size : null Number of workgroups : [0, 0] Task info: blur.blue Backend : OPENCL Device : NVIDIA GeForce RTX 3070 CL_DEVICE_TYPE_GPU (available) Dims : 2 Global work offset: [0, 0] Global work size : [4000, 6000] Local work size : [32, 30, 1] Number of workgroups : [125, 200] ``` -------------------------------- ### Run TornadoVM Intel Experiment Source: https://tornadovm.readthedocs.io/en/latest/docker.html Example of executing a matrix multiplication experiment on Intel hardware using the provided runner script. ```bash $ git clone https://github.com/beehive-lab/docker-tornado $ cd docker-tornado ## Run Matrix Multiplication - provided in the docker-tornado repository $ ./run_intel_openjdk.sh tornado -cp example/target/example-1.0-SNAPSHOT.jar example.MatrixMultiplication --parms="256" Computing MxM of 256x256 CPU Execution: 1.53 GFlops, Total time = 22 ms GPU Execution: 8.39 GFlops, Total Time = 4 ms Speedup: 5x ``` -------------------------------- ### Run the DFT benchmark Source: https://tornadovm.readthedocs.io/en/latest/_sources/benchmarking.rst.txt Example execution of the Discrete Fourier Transform benchmark showing typical JMH output format. ```bash $ tornado -m tornado.benchmarks/uk.ac.manchester.tornado.benchmarks.dft.JMHDFT # JMH version: 1.23 ... Benchmark Mode Cnt Score Error Units JMHDFT.dftJava avgt 5 19.736 ± 1.589 s/op JMHDFT.dftTornado avgt 5 0.155 ± 0.008 s/op ``` -------------------------------- ### View task execution info Source: https://tornadovm.readthedocs.io/en/latest/multi-device.html Expected output showing the device assignment and configuration for each task in the BlurFilter example. ```text Task info: blur.red Backend : OPENCL Device : NVIDIA GeForce RTX 3070 CL_DEVICE_TYPE_GPU (available) Dims : 2 Global work offset: [0, 0] Global work size : [4000, 6000] Local work size : [32, 30, 1] Number of workgroups : [125, 200] Task info: blur.blue Backend : OPENCL Device : NVIDIA GeForce RTX 3070 CL_DEVICE_TYPE_GPU (available) Dims : 2 Global work offset: [0, 0] Global work size : [4000, 6000] Local work size : [32, 30, 1] Number of workgroups : [125, 200] Task info: blur.green Backend : OPENCL Device : 13th Gen Intel(R) Core(TM) i7-13700 CL_DEVICE_TYPE_CPU (available) Dims : 2 Global work offset: [0, 0] Global work size : [24, 1] Local work size : null Number of workgroups : [0, 0] ``` -------------------------------- ### Run NVIDIA Matrix Multiplication Experiment Source: https://tornadovm.readthedocs.io/en/latest/_sources/docker.rst.txt Execute a matrix multiplication example using the provided runner script within the cloned repository. ```bash $ git clone https://github.com/beehive-lab/docker-tornado $ cd docker-tornado ## Run Matrix Multiplication - provided in the docker-tornado repository $ ./run_nvidia_openjdk.sh tornado -cp example/target/example-1.0-SNAPSHOT.jar example.MatrixMultiplication ``` -------------------------------- ### Execute Task on AWS F1 FPGA Source: https://tornadovm.readthedocs.io/en/latest/_sources/cloud.rst.txt Run a TornadoVM example using a custom configuration file and background the process to prevent connection timeout issues. ```bash $ tornado --jvm "-Ds0.t0.device=0:0 -Dtornado.fpga.conf.file=/home/centos/TornadoVM/bin/sdk/etc/aws-fpga.conf -Xmx20g -Xms20g" --printKernel --threadInfo -m tornado.examples/uk.ac.manchester.tornado.examples.dynamic.DFTMT --params="256 default 1" >> output.log $ Ctrl-Z (^Z) $ bg $ disown ``` -------------------------------- ### Example TornadoVM Java Flags Output Source: https://tornadovm.readthedocs.io/en/latest/_sources/ide-integration.rst.txt Sample output of the Java flags required for configuring applications in IntelliJ. ```bash /etc/dependencies/TornadoVM-graal-jdk-21/graalvm-community-openjdk-21.0.1+12.1/bin/java -server -XX:-UseCompressedOops -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:-UseCompressedClassPointers --enable-preview -Djava.library.path=/bin/sdk/lib --module-path .:/bin/sdk/share/java/tornado -Dtornado.load.api.implementation=uk.ac.manchester.tornado.runtime.tasks.TornadoTaskGraph -Dtornado.load.runtime.implementation=uk.ac.manchester.tornado.runtime.TornadoCoreRuntime -Dtornado.load.tornado.implementation=uk.ac.manchester.tornado.runtime.common.Tornado -Dtornado.load.annotation.implementation=uk.ac.manchester.tornado.annotation.ASMClassVisitor -Dtornado.load.annotation.parallel=uk.ac.manchester.tornado.api.annotations.Parallel -XX:+UseParallelGC @/bin/sdk/etc/exportLists/common-exports @/bin/sdk/etc/exportLists/opencl-exports @/bin/sdk/etc/exportLists/spirv-exports @/bin/sdk/etc/exportLists/ptx-exports --add-modules ALL-SYSTEM,tornado.runtime,tornado.annotation,tornado.drivers.common,tornado.drivers.opencl,tornado.drivers.opencl,tornado.drivers.ptx ``` -------------------------------- ### Verify NVIDIA driver installation Source: https://tornadovm.readthedocs.io/en/latest/_sources/cuda-backend.rst.txt Run nvidia-smi to check the status of the NVIDIA driver and GPU memory usage. ```bash +-----------------------------------------------------------------------------+ | NVIDIA-SMI 440.100 Driver Version: 440.100 CUDA Version: 10.2 | |-------------------------------+----------------------+----------------------| | GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | |===============================+======================+======================| | 0 GeForce GTX 1650 Off | 00000000:01:00.0 Off | N/A | | N/A 51C P8 1W / N/A | 73MiB / 3914MiB | 0% Default | +-------------------------------+----------------------+----------------------+ +-----------------------------------------------------------------------------+ | Processes: GPU Memory | | GPU PID Type Process name Usage | |=============================================================================| | 0 1095 G /usr/lib/xorg/Xorg 36MiB | | 0 1707 G /usr/lib/xorg/Xorg 36MiB | +-----------------------------------------------------------------------------+ ``` -------------------------------- ### Initialize IntelliJ Project Files Source: https://tornadovm.readthedocs.io/en/latest/_sources/ide-integration.rst.txt Commands to build TornadoVM, set environment variables, and generate IntelliJ run configurations. ```bash # Build TornadoVM first (with your desired backend) $ make BACKEND=opencl # or ptx, spirv, opencl,ptx, etc. # Load the environment variables $ source setvars.sh # Linux/macOS $ setvars.cmd # Windows # Generate IntelliJ project files $ make intellijinit ``` -------------------------------- ### Configure NVIDIA Execution Options Source: https://tornadovm.readthedocs.io/en/latest/_sources/docker.rst.txt Examples of passing flags to the runner script to inspect kernels, debug execution, or configure JVM memory settings. ```bash # To see the generated OpenCL kernel $ ./run_nvidia.sh tornado --printKernel example/MatrixMultiplication # To check some runtime info about the kernel execution and device $ ./run_nvidia.sh tornado --debug example/MatrixMultiplication $ ./run_nvidia.sh tornado --jvm="-Xmx16g -Xms16g" example/MatrixMultiplication ``` -------------------------------- ### Install OpenCL Development Package Source: https://tornadovm.readthedocs.io/en/latest/_sources/installation.rst.txt Install the ocl-icd-opencl-dev package required for Ubuntu 16.04 and newer. ```bash $ apt-get install ocl-icd-opencl-dev ``` -------------------------------- ### Enable Environment and Run Tests Source: https://tornadovm.readthedocs.io/en/latest/_sources/installation.rst.txt Activate the environment and execute the test suite. ```bash source ~/bin/venv/bin/activate source setvars.sh ``` ```bash make tests ``` -------------------------------- ### Initialize TornadoVM for Root Source: https://tornadovm.readthedocs.io/en/latest/cloud.html Set up TornadoVM environment variables for the root user and verify device detection. ```bash $ cd /home/centos/TornadoVM $ source setvars.env $ tornado --devices ``` -------------------------------- ### Generate IntelliJ Project Files Source: https://tornadovm.readthedocs.io/en/latest/ide-integration.html Initializes the project by generating run configurations in the .build/ directory. ```bash $ make intellijinit ``` -------------------------------- ### Display TornadoVM Help Source: https://tornadovm.readthedocs.io/en/latest/_sources/simple-start.rst.txt View the command-line interface options and usage instructions. ```bash $ tornado --help usage: tornado [-h] [--version] [-version] [--debug] [--threadInfo] [--igv] [--igvLowTier] [--printKernel] [--printBytecodes] [--enableProfiler ENABLE_PROFILER] [--dumpProfiler DUMP_PROFILER] [--printJavaFlags] [--devices] [--ea] [--module-path MODULE_PATH] [--classpath CLASSPATH] [--jvm JVM_OPTIONS] [-m MODULE_APPLICATION] [-jar JAR_FILE] [--params APPLICATION_PARAMETERS] [application] Tool for running TornadoVM Applications. This tool sets all Java options for enabling TornadoVM. positional arguments: application optional arguments: -h, --help show this help message and exit --version Print version of TornadoVM -version Print JVM Version --debug Enable debug mode --threadInfo Print thread deploy information per task on the accelerator --igv Debug Compilation Graphs using Ideal Graph Visualizer (IGV) --igvLowTier Debug Low Tier Compilation Graphs using Ideal Graph Visualizer (IGV) --printKernel, -pk Print generated kernel (OpenCL, PTX or SPIR-V) --printBytecodes, -pc Print the generated TornadoVM bytecodes --enableProfiler ENABLE_PROFILER Enable the profiler {silent|console} --dumpProfiler DUMP_PROFILER Dump the profiler to a file --printJavaFlags Print all the Java flags to enable the execution with TornadoVM --devices Print information about the accelerators available --ea, -ea Enable assertions --module-path MODULE_PATH Module path option for the JVM --classpath CLASSPATH, -cp CLASSPATH, --cp CLASSPATH Set class-path --jvm JVM_OPTIONS, -J JVM_OPTIONS Pass Java options to the JVM. Use without spaces: e.g., --jvm="-Xms10g" or -J"-Xms10g" -m MODULE_APPLICATION Application using Java modules -jar JAR_FILE Main Java application in a JAR File --params APPLICATION_PARAMETERS Command-line parameters for the host-application. Example: --params="param1 param2..." ``` -------------------------------- ### Build GraalPy from Source Source: https://tornadovm.readthedocs.io/en/latest/_sources/truffle-languages.rst.txt Clone and build the GraalPy standalone distribution from source. ```bash $ git clone https://github.com/oracle/graalpython.git && cd graalpython && git checkout graal-23.1.0 $ git clone https://github.com/graalvm/mx.git mx $ export PATH=$PWD/mx:$PATH $ mx fetch-jdk $ export JAVA_HOME=~/.mx/jdks/labsjdk-ce-21.0.1-jvmci-23.1-b22 $ mx --dy /compiler python-gvm ``` -------------------------------- ### Configure Maven on Windows Source: https://tornadovm.readthedocs.io/en/latest/_sources/installation.rst.txt Add the Maven bin directory to the system PATH. ```bash rem Maven unpacked to %ProgramFiles%\apache-maven-3.9.1 set PATH=%ProgramFiles%\apache-maven-3.9.1\set;%PATH% ``` -------------------------------- ### float get(int index) Source: https://tornadovm.readthedocs.io/en/latest/_sources/programming.rst.txt Returns the value at a specific index. ```APIDOC ## float get(int index) ### Description Returns the value of a specific index. ### Parameters - **index** (int) - The position to retrieve the value from. ``` -------------------------------- ### Get value from FloatArray Source: https://tornadovm.readthedocs.io/en/latest/_sources/programming.rst.txt Retrieves the value at a specific index from a FloatArray. ```java FloatArray floatArray = FloatArray.fromArray(new float[] {2.0f, 1.0f, 2.0f, 5.0f}); float floatValue = floatArray.get(3); // returns 5.0f ``` -------------------------------- ### Initialize Windows Build Environment Source: https://tornadovm.readthedocs.io/en/latest/_sources/ide-integration.rst.txt Initialize the environment using the provided Windows batch script. ```bash $ cd $ .\bin\windowsMicrosoftStudioTools2022.cmd ``` -------------------------------- ### Set Environment Variables Source: https://tornadovm.readthedocs.io/en/latest/installation.html Initialize the TornadoVM SDK environment variables after installation. ```bash $ source setvars.sh ``` ```batch C:> setvars.cmd ``` -------------------------------- ### Configure Xilinx FPGA emulation Source: https://tornadovm.readthedocs.io/en/latest/fpga-programming.html Use the Makefile to configure Xilinx emulation parameters for specific platforms and device counts. ```bash make xilinx_emulation FPGA_PLATFORM=xilinx_u50_gen3x16_xdma_201920_3 NUM_OF_FPGA_DEVICES=1 ``` -------------------------------- ### Verify CMake Installation Source: https://tornadovm.readthedocs.io/en/latest/_sources/ide-integration.rst.txt Check if the cmake command is available in the system PATH. ```bash $ cmake --version ``` -------------------------------- ### Get FloatArray size Source: https://tornadovm.readthedocs.io/en/latest/_sources/programming.rst.txt Returns the total number of elements in the FloatArray segment. ```java FloatArray floatArray = new FloatArray(16); int size = floatArray.getSize(); // returns 16 ``` -------------------------------- ### Build the CUDA Backend Source: https://tornadovm.readthedocs.io/en/latest/_sources/cuda-backend.rst.txt Set the JAVA_HOME environment variable and execute the make command to build the CUDA backend and SDK. ```bash # JDK 21 is required export JAVA_HOME=/path/to/jdk21 # Build the CUDA backend (tornado-drivers/cuda + cuda-jni) and the SDK make BACKEND=cuda ``` -------------------------------- ### Initialize Xilinx SDAccel environment Source: https://tornadovm.readthedocs.io/en/latest/_sources/fpga-programming.rst.txt Set the required environment variables for the Xilinx toolchain. ```bash source /opt/Xilinx/SDx/2018.2/settings64.sh ``` -------------------------------- ### Enter Root Shell Source: https://tornadovm.readthedocs.io/en/latest/cloud.html Switch to a bash shell with root privileges. ```bash $ sudo -E /bin/bash ```