talos-extensions/nvidia-gpu/nvidia-container-toolkit
Dmitry Sharshakov 5cd226e3ea
chore: build with new toolchain
Move modules, firmware and libraries to accommodate usrmerged rootfs

Only use network where needed via new bldr, pre-download Go dependencies in prepare step, improve Go cache

Bump xen-guest-agent to make it build with current Alpine Rust

Signed-off-by: Dmitry Sharshakov <dmitry.sharshakov@siderolabs.com>
2025-02-10 16:00:19 +01:00
..
lts chore: build with new toolchain 2025-02-10 16:00:19 +01:00
nvidia-container-cli chore: build with new toolchain 2025-02-10 16:00:19 +01:00
nvidia-container-runtime feat: update dependencies 2025-01-21 17:49:18 +04:00
nvidia-container-runtime-wrapper chore: build with new toolchain 2025-02-10 16:00:19 +01:00
nvidia-persistenced-wrapper chore: build with new toolchain 2025-02-10 16:00:19 +01:00
nvidia-pkgs chore: build with new toolchain 2025-02-10 16:00:19 +01:00
production chore: build with new toolchain 2025-02-10 16:00:19 +01:00
DEVELOPMENT.md feat: use wolfi as base for nvidia 2023-08-02 21:36:00 +05:30
README.md docs: update documentation on installing extensions 2023-09-29 22:49:23 +04:00

NVIDIA Container toolkit extension

Installation

See Installing Extensions.

Usage

The following NVIDIA modules needs to be loaded, so add this to the talos config:

machine:
  kernel:
    modules:
      - name: nvidia
      - name: nvidia_uvm
      - name: nvidia_drm
      - name: nvidia_modeset

nvidia-container-cli loads BPF programs and requires relaxed KSPP setting for bpf_jit_harden, so Talos default setting should be overridden:

machine:
  sysctls:
    net.core.bpf_jit_harden: 1

Warning! This disables KSPP best practices setting.

Testing

Apply the following manifest to create a runtime class that uses the extension:

---
apiVersion: node.k8s.io/v1
kind: RuntimeClass
metadata:
  name: nvidia
handler: nvidia

Install the NVIDIA device plugin:

helm repo add nvdp https://nvidia.github.io/k8s-device-plugin
helm repo update
helm install nvidia-device-plugin nvdp/nvidia-device-plugin --version=0.14.1 --set=runtimeClassName=nvidia

Apply the following manifest to run CUDA pod via nvidia runtime:

---
apiVersion: v1
kind: Pod
metadata:
  name: gpu-operator-test
spec:
  restartPolicy: OnFailure
  runtimeClassName: nvidia
  containers:
  - name: cuda-vector-add
    image: "nvidia/samples:vectoradd-cuda11.6.0"
    resources:
      limits:
         nvidia.com/gpu: 1

The status can be viewed by running:

 kubectl get pods
NAME                READY   STATUS      RESTARTS   AGE
gpu-operator-test   0/1     Completed   0          13s
 kubectl logs gpu-operator-test
[Vector addition of 50000 elements]
Copy input data from the host memory to the CUDA device
CUDA kernel launch with 196 blocks of 256 threads
Copy output data from the CUDA device to the host memory
Test PASSED
Done