From Workstation to H200: Debugging a First CUDA Kernel on an OpenShift GPU Cluster

I’m diving into the basics of CUDA kernel programming, starting with the canonical first exercise: a vector addition kernel.

__global__ void vector_add(const float* A, const float* B, float* C, int N) {
    int i = blockIdx.x * blockDim.x + threadIdx.x;
    if (i < N) {
        C[i] = A[i] + B[i];
    }
}

The development environment is a Rocky Linux 9 toolbox with the CUDA 13.5 toolkit. The execution target is an OpenShift cluster whose GPU nodes carry eight NVIDIA H200 GPUs each, managed by the NVIDIA GPU Operator. The workstation itself has no NVIDIA GPU, so the cluster is the only place the kernel can actually run — which makes the deployment path part of the exercise.

This post documents the questions that came up, how each was answered, and the one runtime failure that turned out to mean something entirely different from what it said.

Establishing the target environment

Before writing any deployment assumptions, it pays to interrogate the cluster directly. Nothing below requires SSH access.

# Confirm which cluster the kubeconfig points to.
oc config current-context

# Identify GPU nodes and their hardware.
oc get nodes \
  -o custom-columns='NAME:.metadata.name,GPU:.metadata.labels.nvidia\.com/gpu\.product'

The GPU nodes label themselves as NVIDIA-H200. The node labels, maintained by GPU Feature Discovery (a GPU Operator component that publishes driver, CUDA, and hardware inventory as Kubernetes labels), carry the details that matter for compatibility:

nvidia.com/cuda.runtime-version.full = 13.0
nvidia.com/cuda.driver-version.full  = 580.126.20
nvidia.com/gpu.compute.major         = 9        # H200 is compute capability 9.0

So the cluster runs driver 580.126.20, which supports CUDA 13.0, while the local toolkit is CUDA 13.5.

Is a toolkit downgrade necessary?

No — this is precisely what CUDA’s minor version compatibility guarantee covers. Since CUDA 11.0, an application built with any minor release of a major CUDA version can run against any driver that supports the initial release of that major version. A binary produced by the 13.5 toolkit is supported on drivers from the CUDA 13.0 generation onward, which the cluster’s 580-series driver satisfies.

Two caveats are worth internalizing:

  1. The guarantee does not extend to driver APIs introduced in later minor releases. Code calling such APIs will fail at runtime on an older driver.
  2. As discussed below, it does not rescue a binary that contains no machine code for the target GPU.

With the version question settled, the next step was to inspect what the local build had actually produced.

What the compiler actually shipped: SASS, PTX, and fat binaries

Understanding the failure modes later in this story requires understanding what lives inside a compiled CUDA binary. nvcc produces code through a multi-stage pipeline:

CUDA C++  →  NVVM IR  →  PTX  →  SASS (per architecture)
  • PTX (Parallel Thread Execution) is an intermediate, virtual instruction set. It is designed to be forward-compatible: the GPU driver contains a JIT compiler that can translate PTX into native code at module load time. PTX is not tied to a specific GPU architecture.
  • SASS (Streaming Assembly) is the native machine code of NVIDIA GPUs — the lowest-level instruction set that actually executes on the streaming multiprocessors. The ptxas compiler translates PTX into a SASS cubin for one specific compute capability. SASS is architecture-specific: a cubin compiled for sm_75 (Turing) cannot execute on sm_90 (Hopper), and vice versa.

A CUDA executable is typically a fat binary: it embeds SASS cubins for each architecture requested at compile time, and optionally PTX as a fallback for architectures not covered by SASS.

The critical command for inspecting this is cuobjdump:

cuobjdump -lelf a.out    # list embedded SASS cubins
cuobjdump -lptx a.out    # list embedded PTX

My initial build — nvcc main.cu with no architecture flag — revealed the problem immediately:

ELF file    1: a.1.sm_75.cubin
ELF file    2: a.2.sm_75.cubin

The toolkit’s default target was sm_75. The cluster GPUs are sm_90. Since SASS does not carry across compute capabilities, this binary could never run there regardless of any CUDA version considerations — at best, the driver would attempt to JIT the embedded sm_75 PTX (more on how that ends shortly).

The fix is to target the deployment architecture explicitly:

nvcc -arch=sm_90 main.cu -o sum

For a binary that must run on both a workstation GPU and the cluster, a multi-architecture fat binary is appropriate:

nvcc -gencode arch=compute_75,code=sm_75 \
     -gencode arch=compute_90,code=sm_90 \
     main.cu -o sum

The failing run

The rebuilt binary was copied to /tmp on a GPU node and executed through the standard OpenShift node-debugging flow:

oc debug node/<gpu-node>
chroot /host
/tmp/sum

The result:

CUDA error: CUDA driver version is insufficient for CUDA runtime version

On its face, this suggests the original version-compatibility conclusion was wrong. It was not — but proving that required looking past the message.

Node forensics

The first step was to verify what driver the node was actually running, using the kernel module’s own report rather than any userspace tool:

oc debug node/<gpu-node> -- chroot /host bash -c 'cat /proc/driver/nvidia/version'
NVRM version: NVIDIA UNIX Open Kernel Module for x86_64  580.126.20  Release Build

The driver was loaded, healthy, and exactly the version the node labels advertised. The next step was to look for the driver’s userspace libraries:

ldconfig -p | grep libcuda          # no results
nvidia-smi                          # command not found

find / -maxdepth 8 \
  \( -path /proc -o -path /sys -o -path /var/lib/containers \) -prune \
  -o -name "libcuda.so*" -print
/run/nvidia/driver/usr/lib64/libcuda.so.580.126.20
/run/nvidia/driver/usr/lib64/libcuda.so.1
...

This is the crux of the failure, and it is a property of the platform rather than of the binary.

How GPUs reach containers on OpenShift: the GPU Operator and CDI

On Red Hat Enterprise Linux CoreOS, the node’s root filesystem is immutable. The GPU Operator therefore installs the driver unconventionally:

  • The driver daemonset builds the kernel module for the running kernel and installs the driver userspace (libcuda.so, libnvidia-ml.so, nvidia-smi, and the rest) into /run/nvidia/driver/ — a tmpfs that is repopulated on every boot. Nothing is ever placed in the host’s standard library paths, and ldconfig on the host knows nothing about it.
  • GPU workloads run as pods that request nvidia.com/gpu resources. When the container runtime (CRI-O, in OpenShift’s case) creates such a container, it consults a CDI spec — the Container Device Interface.

CDI is a standardized mechanism (originating in the container ecosystem, now a widely adopted specification) for describing how a host device should be injected into a container. Instead of relying on hooks or LD_PRELOAD tricks, a CDI spec is a declarative document that lists, for a named device class, exactly which edits a runtime must make to a container: which device nodes to add (/dev/nvidia*), which host paths to bind-mount (the driver libraries under /run/nvidia/driver, mapped to their conventional locations inside the container), and which environment variables to set. The nvidia-container-toolkit generates this spec on each node. The effect is that a GPU pod sees a completely ordinary CUDA userspace, assembled per-container, while the host filesystem stays untouched.

The consequence for debugging: a chroot /host shell in a node debug pod is not a GPU pod. No CDI injection has occurred. The chroot provides the host filesystem — which, as established, contains no libcuda.so.1 anywhere the dynamic loader would search.

Why the error message pointed at versions

The remaining puzzle was why a missing library produces a message about an insufficient one. The answer is in how the CUDA runtime is linked:

ldd /tmp/sum | grep cuda        # no output

By default, nvcc links the CUDA runtime statically (-cudart static). The resulting binary therefore has no DT_NEEDED entry for libcuda.so.1 — the runtime locates the driver library by calling dlopen("libcuda.so.1") during initialization. When that call fails to produce a usable driver library, the runtime surfaces cudaErrorInsufficientDriver (error 35): “CUDA driver version is insufficient for CUDA runtime version.”

So the process starts normally, the first CUDA call triggers driver initialization, the runtime cannot resolve libcuda.so.1 — and the failure is reported in terms that suggest a version downgrade. The message is technically reasonable but operationally misleading: an absent driver userspace and an outdated one are indistinguishable from the caller’s perspective.

Resolution

Pointing the loader at the driver userspace that does exist on the node:

export LD_LIBRARY_PATH=/run/nvidia/driver/usr/lib64
/tmp/sum
Success! C[0] = 3.0

The CUDA 13.5-built binary ran correctly on the cluster’s CUDA 13.0 driver on the first attempt — once it could find the driver at all. nvidia-smi lives in the same tree and works with the same adjustment:

LD_LIBRARY_PATH=/run/nvidia/driver/usr/lib64 \
  /run/nvidia/driver/usr/bin/nvidia-smi --query-gpu=name,driver_version,compute_cap --format=csv
name, driver_version, compute_cap
NVIDIA H200, 580.126.20, 9.0

A postscript on PTX JIT

The original sm_75 binary was still present on the node, and running it with the corrected library path produced a second, instructive failure:

CUDA error: the provided PTX was compiled with an unsupported toolchain.

This is the PTX fallback path in action: finding no sm_75 SASS executable on an sm_90 GPU, the driver attempted to JIT the embedded PTX — but the PTX had been generated by the CUDA 13.5 toolchain, whose PTX ISA revision is newer than what the 580 driver’s JIT compiler accepts. JIT compilation is only guaranteed in the other direction (newer drivers compiling older PTX). The practical rule follows directly: embed SASS for every architecture you intend to run on, and treat PTX as a compatibility mechanism for future hardware, not for older drivers.

Recommendations

For anything beyond interactive node inspection, the correct execution model is a pod requesting nvidia.com/gpu: 1 with any CUDA 13.x container image. The CDI machinery injects the driver libraries and device nodes automatically, the binary runs without any LD_LIBRARY_PATH management, and the workload is subject to normal scheduling, isolation, and audit. The oc debug flow above remains valuable precisely for the cases it served here: verifying kernel driver state, locating platform-managed components, and running quick binaries against a node’s actual environment.

Summary

  • Architecture before versions. The build’s default sm_75 target was a hard incompatibility with the cluster’s sm_90 GPUs; the 13.5-toolkit-versus-13.0-driver difference was not. Minor version compatibility within a major CUDA release is a supported configuration.
  • cuobjdump -lelf answers “will this binary run on that GPU?” in a single command, before anything is deployed.
  • cudaErrorInsufficientDriver frequently means the driver library could not be found, not that it is too old. Check what the process actually resolves before concluding a version conflict — especially with statically linked runtimes, which report both conditions identically.
  • On OpenShift, the host filesystem deliberately contains no driver userspace. The GPU Operator maintains it in /run/nvidia/driver and exposes it to pods through CDI injection. A debug chroot participates in none of that.
  • /proc/driver/nvidia/version is ground truth for the loaded driver. When an error message and the node disagree, trust the kernel module.