Sign inSign up

beehivelab/tornadovm-nvidia-cuda-jdk21

By beehivelab

•Updated about 18 hours ago

TornadoVM for NVIDIA GPUs: CUDA (PTX) backend on Eclipse Temurin JDK 21

Image
0

49

beehivelab/tornadovm-nvidia-cuda-jdk21 repository overview

⁠TornadoVM for NVIDIA GPUs: CUDA (PTX) backend, JDK 21

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⁠

⁠Tags

  • latest: the most recent TornadoVM release
  • X.Y.Z (e.g. 7.2.0): a specific TornadoVM release

⁠Prerequisites

  • An NVIDIA GPU of the Turing generation or newer (compute capability 7.5+), with a host driver that supports CUDA 13 (R580 or newer). CUDA 13 does not support Maxwell, Pascal or Volta GPUs: use the tornadovm-nvidia-opencl-* images on those.
  • The NVIDIA Container Toolkit⁠, registered with Docker:
sudo nvidia-ctk runtime configure --runtime=docker
sudo systemctl restart docker

⁠Quick start

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

⁠Run your application

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.
  • Useful TornadoVM flags: --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")'

⁠Try the example

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.

⁠Other images

⁠Troubleshooting

  • unknown or invalid runtime name: nvidia: the NVIDIA Container Toolkit is not installed or not registered with Docker (see Prerequisites).
  • No devices listed, or driver errors: check 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.

⁠License

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⁠.

Tag summary

Content type

Image

Digest

sha256:f038d2427…

Size

2.5 GB

Last updated

about 18 hours ago

docker pull beehivelab/tornadovm-nvidia-cuda-jdk21