TornadoVM for NVIDIA GPUs: CUDA (PTX) backend on Eclipse Temurin JDK 21
49
TornadoVM runs Java programs on GPUs. This image ships the prebuilt TornadoVM release SDK with the CUDA (PTX) backend on Eclipse Temurin JDK 21.
Source and issues: beehive-lab/docker-tornadovm
latest: the most recent TornadoVM releaseX.Y.Z (e.g. 7.2.0): a specific TornadoVM releasetornadovm-nvidia-opencl-* images on those.sudo nvidia-ctk runtime configure --runtime=docker
sudo systemctl restart docker
docker pull beehivelab/tornadovm-nvidia-cuda-jdk21:latest
# List the devices TornadoVM can use
docker run --rm --runtime=nvidia beehivelab/tornadovm-nvidia-cuda-jdk21: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-cuda-jdk21: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 PTX 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-cuda-jdk21: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=cuda-jdk21 ./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 --query-gpu=name,compute_cap,driver_version --format=csv on the host. The GPU must have compute capability 7.5 or higher and the driver must be R580 or newer. On older GPUs, use the OpenCL images.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:f038d2427…
Size
2.5 GB
Last updated
about 18 hours ago
docker pull beehivelab/tornadovm-nvidia-cuda-jdk21