TornadoVM for NVIDIA GPUs: OpenCL backend on Eclipse Temurin JDK 27
166
TornadoVM runs Java programs on GPUs. This image ships the prebuilt TornadoVM release SDK with the OpenCL backend on Eclipse Temurin JDK 27.
Source and issues: beehive-lab/docker-tornadovm
latest: the most recent TornadoVM releaseX.Y.Z (e.g. 7.2.0): a specific TornadoVM releasesudo nvidia-ctk runtime configure --runtime=docker
sudo systemctl restart docker
docker pull beehivelab/tornadovm-nvidia-opencl-jdk27:latest
# List the devices TornadoVM can use
docker run --rm --runtime=nvidia beehivelab/tornadovm-nvidia-opencl-jdk27:latest tornado --devices
The container works in /data. Mount the directory that holds your jar there:
docker run --rm --runtime=nvidia \
--user "$(id -u):$(id -g)" \
-v "$PWD":/data \
beehivelab/tornadovm-nvidia-opencl-jdk27:latest \
tornado --threadInfo -cp my-app.jar com.example.Main
--runtime=nvidia exposes the GPU and the host driver to the container. --gpus all also works.--user makes files the program writes to /data belong to you instead of root.tornado is a wrapper around java that adds the TornadoVM options. Use --jvm="..." to pass JVM flags, e.g. tornado --jvm="-Xmx16g" -cp my-app.jar com.example.Main.--devices (list devices), --threadInfo (show where each task ran), --printKernel (print the generated OpenCL C kernel).Compile your application against the same TornadoVM release as the image. The API is on Maven Central:
<dependency>
<groupId>io.github.beehive-lab</groupId>
<artifactId>tornado-api</artifactId>
<version>7.2.0-jdk21</version>
</dependency>
An application built against another release fails with Kernel entry ... has no writeReplace().
You can also compile inside the image, which uses the TornadoVM API jars it ships:
docker run --rm --user "$(id -u):$(id -g)" -v "$PWD":/data beehivelab/tornadovm-nvidia-opencl-jdk27:latest \
bash -c 'javac -cp "$TORNADOVM_HOME/share/java/tornado/*" -d classes $(find src -name "*.java")'
The source repository has a matrix multiplication example and a runner script:
git clone https://github.com/beehive-lab/docker-tornadovm
cd docker-tornadovm
TORNADOVM_IMAGE=opencl-jdk27 ./run_nvidia.sh tornado --threadInfo \
-cp example/target/example-1.0-SNAPSHOT.jar example.MatrixMultiplication 512
The output should end with Verification true.
| Image | Backend | JDK |
|---|---|---|
beehivelab/tornadovm-nvidia-cuda-jdk21 | CUDA (PTX) | 21 |
beehivelab/tornadovm-nvidia-cuda-jdk25 | CUDA (PTX) | 25 (LTS) |
beehivelab/tornadovm-nvidia-cuda-jdk27 | CUDA (PTX) | 27 |
beehivelab/tornadovm-nvidia-opencl-jdk21 | OpenCL | 21 |
beehivelab/tornadovm-nvidia-opencl-jdk25 | OpenCL | 25 (LTS) |
beehivelab/tornadovm-nvidia-opencl-jdk27 | OpenCL | 27 |
unknown or invalid runtime name: nvidia: the NVIDIA Container Toolkit is not installed or not registered with Docker (see Prerequisites).nvidia-smi works on the host and that the driver is up to date.TornadoVM and these images are developed at The University of Manchester and released under the Apache 2.0 license. Images built on nvidia/cuda are also subject to the NVIDIA Deep Learning Container License.
Content type
Image
Digest
sha256:b1f4f82f6…
Size
204.4 MB
Last updated
about 12 hours ago
docker pull beehivelab/tornadovm-nvidia-opencl-jdk27