Examples#

The canonical, runnable examples for cuda.core live under samples/cuda_core/ in the cuda-python repository. Each sample is a self-contained directory with its own README.md, requirements.txt, and PEP 723 dependency block, and every sample is exercised as part of the cuda.core test suite.

Getting started#

  • vectorAdd compiles and launches a templated vector-add kernel and demonstrates Device.allocate() and name_expressions.

  • deviceQuery enumerates every CUDA device with an nvidia-smi-style summary and an optional --verbose mode for the long-tail property list.

  • systemInfo reports system-wide CUDA information (driver / runtime / NVML).

Kernels and launch configuration#

  • launchConfigTuning explores how launch-configuration choices affect kernel performance.

  • threadBlockCluster demonstrates LaunchConfig(cluster=...) on Hopper-class GPUs.

  • tmaTensorMap uses Tensor Memory Accelerator descriptors for bulk data movement.

  • greenContext partitions SMs across kernels with green contexts.

  • kernelNsysProfile annotates kernel launches with NVTX markers for Nsight Systems.

Memory management and interop#

CUDA graphs and linking#

  • cudaGraphs captures and replays a multi-kernel graph, then reuses it via Graph.update().

  • jitLtoLinking links two device modules with PTX vs LTO and swaps in a runtime plug-in.

Framework interop and compute algorithms#

Multi-GPU and streams#

Graphics interop#

  • glInteropPlasma writes CUDA-generated pixels into an OpenGL PBO with zero CPU round-trip.

Simple utilities#

  • simplePrint minimal kernel that prints from the device.