Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ instance/
# Sphinx documentation
docs_src/_build/
*/docs/source/generated/
*/docs/source/module/generated/

# PyBuilder
.pybuilder/
Expand Down
41 changes: 40 additions & 1 deletion cuda_bindings/docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

# -- Path setup --------------------------------------------------------------

import inspect
import os
import sys
from pathlib import Path
Expand Down Expand Up @@ -103,7 +104,7 @@ def _github_examples_ref():
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ["_static"]
html_static_path = [] # ["_static"] does not exist in our environment

# skip cmdline prompts
copybutton_exclude = ".linenos, .gp"
Expand All @@ -120,7 +121,45 @@ def _github_examples_ref():
"cufile": ("https://docs.nvidia.com/gpudirect-storage/api-reference-guide/", None),
}


def _sanitize_generated_docstring(lines):
doc_lines = inspect.cleandoc("\n".join(lines)).splitlines()
if not doc_lines:
return

if "(" in doc_lines[0] and ")" in doc_lines[0]:
doc_lines = doc_lines[1:]
while doc_lines and not doc_lines[0].strip():
doc_lines.pop(0)

if not doc_lines:
lines[:] = []
return

lines[:] = [".. code-block:: text", ""]
lines.extend(f" {line}" if line else " " for line in doc_lines)


def autodoc_process_docstring(app, what, name, obj, options, lines):
if name.startswith("cuda.bindings."):
_sanitize_generated_docstring(lines)


def rewrite_source(app, docname, source):
text = source[0]

if docname.startswith("release/"):
text = text.replace(".. module:: cuda.bindings\n\n", "", 1)

source[0] = text


suppress_warnings = [
# for warnings about multiple possible targets, see NVIDIA/cuda-python#152
"ref.python",
]


def setup(app):
app.connect("autodoc-process-docstring", autodoc_process_docstring)
app.connect("source-read", rewrite_source)
23 changes: 14 additions & 9 deletions cuda_bindings/docs/source/contribute.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,17 @@
Contributing
============

Thank you for your interest in contributing to ``cuda-bindings``! Based on the type of contribution, it will fall into two categories:

1. You want to report a bug, feature request, or documentation issue
- File an `issue <https://github.com/NVIDIA/cuda-python/issues/new/choose>`_ describing what you encountered or what you want to see changed.
- The NVIDIA team will evaluate the issues and triage them, scheduling
them for a release. If you believe the issue needs priority attention
comment on the issue to notify the team.
2. You want to implement a feature, improvement, or bug fix:
- At this time we do not accept code contributions.
Thank you for your interest in contributing to ``cuda-bindings``! Based on the
type of contribution, it will fall into two categories:

1. You want to report a bug, feature request, or documentation issue.

File an `issue <https://github.com/NVIDIA/cuda-python/issues/new/choose>`_
describing what you encountered or what you want to see changed. The NVIDIA
team will evaluate the issue, triage it, and schedule it for a release. If
you believe the issue needs priority attention, comment on the issue to
notify the team.

2. You want to implement a feature, improvement, or bug fix.

At this time we do not accept code contributions.
4 changes: 2 additions & 2 deletions cuda_bindings/docs/source/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ Installing from Source
----------------------

Requirements
^^^^^^^^^^^^
~~~~~~~~~~~~

* CUDA Toolkit headers[^1]
* CUDA Runtime static library[^2]
Expand All @@ -100,7 +100,7 @@ See `Environment Variables <environment_variables.rst>`_ for a description of ot
Only ``cydriver``, ``cyruntime`` and ``cynvrtc`` are impacted by the header requirement.

Editable Install
^^^^^^^^^^^^^^^^
~~~~~~~~~~~~~~~~

You can use:

Expand Down
6 changes: 3 additions & 3 deletions cuda_bindings/docs/source/overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ code into
`PTX <https://docs.nvidia.com/cuda/parallel-thread-execution/index.html>`_ and
then extract the function to be called at a later point in the application. You
construct your device code in the form of a string and compile it with
`NVRTC <http://docs.nvidia.com/cuda/nvrtc/index.html>`_, a runtime compilation
`NVRTC <https://docs.nvidia.com/cuda/nvrtc/index.html>`_, a runtime compilation
library for CUDA C++. Using the NVIDIA `Driver
API <http://docs.nvidia.com/cuda/cuda-driver-api/index.html>`_, manually create a
API <https://docs.nvidia.com/cuda/cuda-driver-api/index.html>`_, manually create a
CUDA context and all required resources on the GPU, then launch the compiled
CUDA C++ code and retrieve the results from the GPU. Now that you have an
overview, jump into a commonly used example for parallel programming:
Expand Down Expand Up @@ -428,7 +428,7 @@ Putting it all together:
)

The final step is to construct a ``kernelParams`` argument that fulfills all of the launch API conditions. This is made easy because each array object comes
with a `ctypes <https://numpy.org/doc/stable/reference/generated/numpy.ndarray.ctypes.html#numpy.ndarray.ctypes>`_ data attribute that returns the underlying ``void*`` pointer value.
with NumPy's `ctypes data attribute <https://numpy.org/doc/stable/reference/generated/numpy.ndarray.ctypes.html#numpy.ndarray.ctypes>`_ that returns the underlying ``void*`` pointer value.

By having the final array object contain all pointers, we fulfill the contiguous array requirement:

Expand Down
2 changes: 1 addition & 1 deletion cuda_bindings/docs/source/release/11.8.6-notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
.. SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE

``cuda-bindings`` 11.8.6 Release notes
====================================
==========================================

Released on January 24, 2025.

Expand Down
2 changes: 1 addition & 1 deletion cuda_bindings/docs/source/release/12.8.0-notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
.. SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE

``cuda-bindings`` 12.8.0 Release notes
====================================
==========================================

Released on January 24, 2025.

Expand Down
Loading
Loading