Skip to content

Commit ecca280

Browse files
committed
docs: address example link review feedback (#1680)
Point the new example links at package-aware refs instead of always targeting main, and drop the overlapping pixi docs workflow changes so this PR stays scoped to the documentation coverage audit. Made-with: Cursor
1 parent 31acd8a commit ecca280

File tree

12 files changed

+175
-3961
lines changed

12 files changed

+175
-3961
lines changed

cuda_bindings/docs/build_docs.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ if [[ -z "${SPHINX_CUDA_BINDINGS_VER}" ]]; then
2525
| awk -F'+' '{print $1}')
2626
fi
2727

28+
if [[ "${LATEST_ONLY}" == "1" && -z "${BUILD_PREVIEW:-}" && -z "${BUILD_LATEST:-}" ]]; then
29+
export BUILD_LATEST=1
30+
fi
31+
2832
# build the docs (in parallel)
2933
SPHINXOPTS="-j 4 -d build/.doctrees" make html
3034

cuda_bindings/docs/source/conf.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@
2626
release = os.environ["SPHINX_CUDA_BINDINGS_VER"]
2727

2828

29+
def _github_examples_ref():
30+
if int(os.environ.get("BUILD_PREVIEW", 0)) or int(os.environ.get("BUILD_LATEST", 0)):
31+
return "main"
32+
return f"v{release}"
33+
34+
35+
GITHUB_EXAMPLES_REF = _github_examples_ref()
36+
37+
2938
# -- General configuration ---------------------------------------------------
3039

3140
# Add any Sphinx extension module names here, as strings. They can be
@@ -99,6 +108,10 @@
99108
# skip cmdline prompts
100109
copybutton_exclude = ".linenos, .gp"
101110

111+
rst_epilog = f"""
112+
.. |cuda_bindings_github_ref| replace:: {GITHUB_EXAMPLES_REF}
113+
"""
114+
102115
intersphinx_mapping = {
103116
"python": ("https://docs.python.org/3/", None),
104117
"numpy": ("https://numpy.org/doc/stable/", None),

cuda_bindings/docs/source/examples.rst

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,64 +5,64 @@ Examples
55
========
66

77
This page links to the ``cuda.bindings`` examples shipped in the
8-
`cuda-python repository <https://github.com/NVIDIA/cuda-python/tree/main/cuda_bindings/examples>`_.
8+
`cuda-python repository <https://github.com/NVIDIA/cuda-python/tree/|cuda_bindings_github_ref|/cuda_bindings/examples>`_.
99
Use it as a quick index when you want a runnable sample for a specific API area
1010
or CUDA feature.
1111

1212
Introduction
1313
------------
1414

15-
- `clock_nvrtc_test.py <https://github.com/NVIDIA/cuda-python/blob/main/cuda_bindings/examples/0_Introduction/clock_nvrtc_test.py>`_
15+
- `clock_nvrtc.py <https://github.com/NVIDIA/cuda-python/blob/|cuda_bindings_github_ref|/cuda_bindings/examples/0_Introduction/clock_nvrtc.py>`_
1616
uses NVRTC-compiled CUDA code and the device clock to time a reduction
1717
kernel.
18-
- `simpleCubemapTexture_test.py <https://github.com/NVIDIA/cuda-python/blob/main/cuda_bindings/examples/0_Introduction/simpleCubemapTexture_test.py>`_
18+
- `simple_cubemap_texture.py <https://github.com/NVIDIA/cuda-python/blob/|cuda_bindings_github_ref|/cuda_bindings/examples/0_Introduction/simple_cubemap_texture.py>`_
1919
demonstrates cubemap texture sampling and transformation.
20-
- `simpleP2P_test.py <https://github.com/NVIDIA/cuda-python/blob/main/cuda_bindings/examples/0_Introduction/simpleP2P_test.py>`_
20+
- `simple_p2p.py <https://github.com/NVIDIA/cuda-python/blob/|cuda_bindings_github_ref|/cuda_bindings/examples/0_Introduction/simple_p2p.py>`_
2121
shows peer-to-peer memory access and transfers between multiple GPUs.
22-
- `simpleZeroCopy_test.py <https://github.com/NVIDIA/cuda-python/blob/main/cuda_bindings/examples/0_Introduction/simpleZeroCopy_test.py>`_
22+
- `simple_zero_copy.py <https://github.com/NVIDIA/cuda-python/blob/|cuda_bindings_github_ref|/cuda_bindings/examples/0_Introduction/simple_zero_copy.py>`_
2323
uses zero-copy mapped host memory for vector addition.
24-
- `systemWideAtomics_test.py <https://github.com/NVIDIA/cuda-python/blob/main/cuda_bindings/examples/0_Introduction/systemWideAtomics_test.py>`_
24+
- `system_wide_atomics.py <https://github.com/NVIDIA/cuda-python/blob/|cuda_bindings_github_ref|/cuda_bindings/examples/0_Introduction/system_wide_atomics.py>`_
2525
demonstrates system-wide atomic operations on managed memory.
26-
- `vectorAddDrv_test.py <https://github.com/NVIDIA/cuda-python/blob/main/cuda_bindings/examples/0_Introduction/vectorAddDrv_test.py>`_
26+
- `vector_add_drv.py <https://github.com/NVIDIA/cuda-python/blob/|cuda_bindings_github_ref|/cuda_bindings/examples/0_Introduction/vector_add_drv.py>`_
2727
uses the CUDA Driver API and unified virtual addressing for vector addition.
28-
- `vectorAddMMAP_test.py <https://github.com/NVIDIA/cuda-python/blob/main/cuda_bindings/examples/0_Introduction/vectorAddMMAP_test.py>`_
28+
- `vector_add_mmap.py <https://github.com/NVIDIA/cuda-python/blob/|cuda_bindings_github_ref|/cuda_bindings/examples/0_Introduction/vector_add_mmap.py>`_
2929
uses virtual memory management APIs such as ``cuMemCreate`` and
3030
``cuMemMap`` for vector addition.
3131

3232
Concepts and techniques
3333
-----------------------
3434

35-
- `streamOrderedAllocation_test.py <https://github.com/NVIDIA/cuda-python/blob/main/cuda_bindings/examples/2_Concepts_and_Techniques/streamOrderedAllocation_test.py>`_
35+
- `stream_ordered_allocation.py <https://github.com/NVIDIA/cuda-python/blob/|cuda_bindings_github_ref|/cuda_bindings/examples/2_Concepts_and_Techniques/stream_ordered_allocation.py>`_
3636
demonstrates ``cudaMallocAsync`` and ``cudaFreeAsync`` together with
3737
memory-pool release thresholds.
3838

3939
CUDA features
4040
-------------
4141

42-
- `globalToShmemAsyncCopy_test.py <https://github.com/NVIDIA/cuda-python/blob/main/cuda_bindings/examples/3_CUDA_Features/globalToShmemAsyncCopy_test.py>`_
42+
- `global_to_shmem_async_copy.py <https://github.com/NVIDIA/cuda-python/blob/|cuda_bindings_github_ref|/cuda_bindings/examples/3_CUDA_Features/global_to_shmem_async_copy.py>`_
4343
compares asynchronous global-to-shared-memory copy strategies in matrix
4444
multiplication kernels.
45-
- `simpleCudaGraphs_test.py <https://github.com/NVIDIA/cuda-python/blob/main/cuda_bindings/examples/3_CUDA_Features/simpleCudaGraphs_test.py>`_
45+
- `simple_cuda_graphs.py <https://github.com/NVIDIA/cuda-python/blob/|cuda_bindings_github_ref|/cuda_bindings/examples/3_CUDA_Features/simple_cuda_graphs.py>`_
4646
shows both manual CUDA graph construction and stream-capture-based replay.
4747

4848
Libraries and tools
4949
-------------------
5050

51-
- `conjugateGradientMultiBlockCG_test.py <https://github.com/NVIDIA/cuda-python/blob/main/cuda_bindings/examples/4_CUDA_Libraries/conjugateGradientMultiBlockCG_test.py>`_
51+
- `conjugate_gradient_multi_block_cg.py <https://github.com/NVIDIA/cuda-python/blob/|cuda_bindings_github_ref|/cuda_bindings/examples/4_CUDA_Libraries/conjugate_gradient_multi_block_cg.py>`_
5252
implements a conjugate-gradient solver with cooperative groups and
5353
multi-block synchronization.
54-
- `nvidia_smi.py <https://github.com/NVIDIA/cuda-python/blob/main/cuda_bindings/examples/4_CUDA_Libraries/nvidia_smi.py>`_
54+
- `nvidia_smi.py <https://github.com/NVIDIA/cuda-python/blob/|cuda_bindings_github_ref|/cuda_bindings/examples/4_CUDA_Libraries/nvidia_smi.py>`_
5555
uses NVML to implement a Python subset of ``nvidia-smi``.
5656

5757
Advanced and interoperability
5858
-----------------------------
5959

60-
- `isoFDModelling_test.py <https://github.com/NVIDIA/cuda-python/blob/main/cuda_bindings/examples/extra/isoFDModelling_test.py>`_
60+
- `iso_fd_modelling.py <https://github.com/NVIDIA/cuda-python/blob/|cuda_bindings_github_ref|/cuda_bindings/examples/extra/iso_fd_modelling.py>`_
6161
runs isotropic finite-difference wave propagation across multiple GPUs with
6262
peer-to-peer halo exchange.
63-
- `jit_program_test.py <https://github.com/NVIDIA/cuda-python/blob/main/cuda_bindings/examples/extra/jit_program_test.py>`_
63+
- `jit_program.py <https://github.com/NVIDIA/cuda-python/blob/|cuda_bindings_github_ref|/cuda_bindings/examples/extra/jit_program.py>`_
6464
JIT-compiles a SAXPY kernel with NVRTC and launches it through the Driver
6565
API.
66-
- `numba_emm_plugin.py <https://github.com/NVIDIA/cuda-python/blob/main/cuda_bindings/examples/extra/numba_emm_plugin.py>`_
66+
- `numba_emm_plugin.py <https://github.com/NVIDIA/cuda-python/blob/|cuda_bindings_github_ref|/cuda_bindings/examples/extra/numba_emm_plugin.py>`_
6767
shows how to back Numba's EMM interface with the NVIDIA CUDA Python Driver
6868
API.

cuda_bindings/docs/source/overview.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ CUDA objects
522522
Certain CUDA kernels use native CUDA types as their parameters such as ``cudaTextureObject_t``. These types require special handling since they're neither a primitive ctype nor a custom user type. Since ``cuda.bindings`` exposes each of them as Python classes, they each implement ``getPtr()`` and ``__int__()``. These two callables used to support the NumPy and ctypes approach. The difference between each call is further described under `Tips and Tricks <https://nvidia.github.io/cuda-python/cuda-bindings/latest/tips_and_tricks.html#>`_.
523523

524524
For this example, lets use the ``transformKernel`` from
525-
`examples/0_Introduction/simpleCubemapTexture_test.py <https://github.com/NVIDIA/cuda-python/blob/main/cuda_bindings/examples/0_Introduction/simpleCubemapTexture_test.py>`_.
525+
`simple_cubemap_texture.py <https://github.com/NVIDIA/cuda-python/blob/|cuda_bindings_github_ref|/cuda_bindings/examples/0_Introduction/simple_cubemap_texture.py>`_.
526526
The :doc:`examples` page links to more samples covering textures, graphs,
527527
memory mapping, and multi-GPU workflows.
528528

0 commit comments

Comments
 (0)