Release v13.3 of the CUDA samples with CUDA 13.3 Toolkit (#435)

This is the release of the CUDA 13.3 samples, which include additions for CUDA Tile C++, and updated CCCL and Python samples.
This commit is contained in:
Dheemanth
2026-05-27 14:50:59 -07:00
committed by GitHub
parent aeab82ff30
commit b7c5481c55
150 changed files with 7977 additions and 246 deletions

View File

@@ -1,5 +1,25 @@
# Matrix Multiplication with Shared Memory (GEMM)
> **Known issue — version-pinned sample.** Unlike the other samples in this
> repository, this sample is pinned to `cuda-core==0.7.0` and
> `nvmath-python[cu13]==0.9.0`. The reason is that nvmath-python 0.9.0
> still uses `cuda-core`'s pre-1.0 API name `EventOptions(enable_timing=...)`
> in its own internals, which `cuda-core>=1.0` no longer accepts.
>
> If you install this sample's `requirements.txt` into the same environment
> as the other samples, pip will downgrade `cuda-core` and the other
> samples (which use the 1.0 API) will stop working. The recommended
> workflow is one of:
>
> - Install this sample's requirements in a **dedicated virtual
> environment**, or
> - Re-run the other samples' `pip install -r requirements.txt` afterwards
> to upgrade `cuda-core` back to 1.0.
>
> This sample will be re-aligned with the rest of the repository
> (`cuda-core>=1.0.0`) once nvmath-python ships a release that targets
> cuda-core's 1.0 naming audit.
Demonstrates efficient matrix multiplication using nvmath-python APIs and custom CUDA kernels with tiling, shared memory, and loop unrolling.
## Overview
@@ -78,7 +98,7 @@ Using nvmath and cuda.core APIs
Device: NVIDIA GeForce RTX 4090
Compute Capability: sm_89
Custom kernel compiled ✓
Custom kernel compiled [OK]
Matrix dimensions: A(1024x1024) × B(1024x1024) = C(1024x1024)
Custom kernel tile size: 16x16

View File

@@ -31,7 +31,7 @@ Demonstrates efficient matrix multiplication using:
- nvmath.linalg.advanced.Matmul for high-performance GEMM via cuBLASLt
- Custom CUDA kernel with tiling, shared memory, and loop unrolling
Uses cuda.core APIs with CuPy arrays via ExternalStream.
Uses cuda.core APIs with CuPy arrays via Stream.from_external.
"""
import sys
@@ -121,17 +121,22 @@ def run_matmul_benchmark(
print(f"Compute Capability: sm_{device.arch}")
# Make CuPy use our cuda.core stream
cp.cuda.ExternalStream(int(stream.handle)).use()
cp.cuda.Stream.from_external(stream).use()
# Compile custom kernel
arch = f"sm_{device.arch}"
program = Program(MATMUL_KERNEL, code_type="c++", options=ProgramOptions(arch=arch))
kernel = program.compile(target_type="cubin").get_kernel("matmul_shared")
print("Custom kernel compiled ✓")
print("Custom kernel compiled [OK]")
# Setup
print(f"\nMatrix: A({m}x{k}) × B({k}x{n}) = C({m}x{n})")
total_ops = 2 * m * n * k
# NOTE: this sample is pinned to cuda-core==0.7.0 (see requirements.txt)
# because nvmath-python 0.9.0 still uses cuda-core's pre-1.0 API name
# `enable_timing`. Once nvmath ships a release compatible with cuda-core
# 1.0, bump the pins in requirements.txt and rename this kwarg to
# `timing_enabled` to match the rest of the samples.
event_opts = EventOptions(enable_timing=True)
# Allocate matrices

View File

@@ -1,7 +1,20 @@
# Matrix Multiplication with Shared Memory (GEMM) Requirements
#
# IMPORTANT: this sample pins older versions of cuda-core and nvmath-python
# on purpose. nvmath-python 0.9.0 (the current CUDA-13 release at the time
# of CTK 13.3) calls cuda-core's pre-1.0 API name `EventOptions(enable_timing=...)`
# in its own internals. With cuda-core 1.0+ that kwarg was renamed to
# `timing_enabled` and the old name is rejected, so any cuda-core>=1.0 +
# nvmath-python 0.9.0 combination raises a TypeError at runtime.
#
# Until nvmath-python ships a release that targets the cuda-core 1.0 naming
# audit, this sample requires the older cuda-core 0.7 line. Installing this
# requirements.txt into the same environment as the other samples will
# downgrade cuda-core; use a dedicated venv for this sample, or reinstall
# the other samples' requirements afterwards to upgrade cuda-core back.
cuda-python>=13.0.0
cuda-core>=0.6.0
cupy-cuda13x>=13.0.0
cuda-core==0.7.0
cupy-cuda13x>=14.0.0
numpy>=2.3.2
nvmath-python[cu13]>=0.3.0
nvmath-python[cu13]==0.9.0