Skip to content

Commit d4f53ee

Browse files
Copilotleofang
andcommitted
Convert all markdown files to ReST format and add pre-commit hook
Co-authored-by: leofang <5534781+leofang@users.noreply.github.com>
1 parent f56d4a6 commit d4f53ee

45 files changed

Lines changed: 2286 additions & 32 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.pre-commit-config.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ repos:
3030
language: python
3131
additional_dependencies:
3232
- https://files.pythonhosted.org/packages/cc/20/ff623b09d963f88bfde16306a54e12ee5ea43e9b597108672ff3a408aad6/pathspec-0.12.1-py3-none-any.whl
33+
- id: no-markdown-in-docs
34+
name: Prevent Markdown files in cuda_*/docs/ directories
35+
entry: bash -c 'if git diff --cached --name-only --diff-filter=A | grep -E "^cuda_.*/docs/.*\.md$"; then echo "Error: Markdown files are not allowed in cuda_*/docs/ directories. Please use .rst format instead."; exit 1; fi'
36+
language: system
37+
pass_filenames: false
38+
always_run: true
3339

3440
- repo: https://github.com/PyCQA/bandit
3541
rev: 2d0b675b04c80ae42277e10500db06a0a37bae17 # frozen: 1.8.6

cuda_bindings/docs/README.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Build the documentation
2+
=======================
3+
4+
1. Install the ``cuda-bindings`` package of the version that we need to document.
5+
2. Ensure the version is included in the ```versions.json`` <./versions.json>`__.
6+
3. Build the docs with ``./build_docs.sh``.
7+
4. The html artifacts should be available under both ``./build/html/latest`` and ``./build/html/<version>``.
8+
9+
Alternatively, we can build all the docs at once by running ```cuda_python/docs/build_all_docs.sh`` <../../cuda_python/docs/build_all_docs.sh>`__.
10+
11+
To publish the docs with the built version, it is important to note that the html files of older versions should be kept intact, in order for the version selection (through ``versions.json``) to work.
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
Code of Conduct
2+
===============
3+
4+
Overview
5+
--------
6+
7+
Define the code of conduct followed and enforced for the ``cuda.bindings`` project.
8+
9+
Our Pledge
10+
----------
11+
12+
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
13+
14+
Our Standards
15+
-------------
16+
17+
Examples of behavior that contributes to creating a positive environment include:
18+
19+
- Using welcoming and inclusive language
20+
- Being respectful of differing viewpoints and experiences
21+
- Gracefully accepting constructive criticism
22+
- Focusing on what is best for the community
23+
- Showing empathy towards other community members
24+
25+
Examples of unacceptable behavior by participants include:
26+
27+
- The use of sexualized language or imagery and unwelcome sexual attention or advances
28+
- Trolling, insulting/derogatory comments, and personal or political attacks
29+
- Public or private harassment
30+
- Publishing others’ private information, such as a physical or electronic address, without explicit permission
31+
- Other conduct which could reasonably be considered inappropriate in a professional setting
32+
33+
Our Responsibilities
34+
--------------------
35+
36+
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
37+
38+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
39+
40+
Scope
41+
-----
42+
43+
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
44+
45+
Enforcement
46+
-----------
47+
48+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at cuda-python-conduct@nvidia.com All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
49+
50+
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project’s leadership.
51+
52+
Attribution
53+
-----------
54+
55+
This Code of Conduct is adapted from the `Contributor Covenant <https://www.contributor-covenant.org>`__, version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
56+
57+
For answers to common questions about this code of conduct, see https://www.contributor-covenant.org/faq
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Contributing
2+
============
3+
4+
Thank you for your interest in contributing to ``cuda-bindings``! Based on the type of contribution, it will fall into two categories:
5+
6+
1. You want to report a bug, feature request, or documentation issue
7+
8+
- File an `issue <https://github.com/NVIDIA/cuda-python/issues/new/choose>`__ describing what you encountered or what you want to see changed.
9+
- 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.
10+
11+
2. You want to implement a feature, improvement, or bug fix:
12+
13+
- At this time we do not accept code contributions.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Environment Variables
2+
=====================
3+
4+
Build-Time Environment Variables
5+
--------------------------------
6+
7+
- ``CUDA_HOME`` or ``CUDA_PATH``: Specifies the location of the CUDA Toolkit.
8+
9+
- ``CUDA_PYTHON_PARSER_CACHING`` : bool, toggles the caching of parsed header files during the cuda-bindings build process. If caching is enabled (``CUDA_PYTHON_PARSER_CACHING`` is True), the cache path is set to ./cache\_, where is derived from the cuda toolkit libraries used to build cuda-bindings.
10+
11+
- ``CUDA_PYTHON_PARALLEL_LEVEL`` (previously ``PARALLEL_LEVEL``) : int, sets the number of threads used in the compilation of extension modules. Not setting it or setting it to 0 would disable parallel builds.
12+
13+
Runtime Environment Variables
14+
-----------------------------
15+
16+
- ``CUDA_PYTHON_CUDA_PER_THREAD_DEFAULT_STREAM`` : When set to 1, the default stream is the per-thread default stream. When set to 0, the default stream is the legacy default stream. This defaults to 0, for the legacy default stream. See `Stream Synchronization Behavior <https://docs.nvidia.com/cuda/cuda-runtime-api/stream-sync-behavior.html>`__ for an explanation of the legacy and per-thread default streams.

cuda_bindings/docs/source/index.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99
:caption: Contents:
1010

1111
release
12-
install.md
13-
overview.md
14-
motivation.md
15-
environment_variables.md
12+
install.rst
13+
overview.rst
14+
motivation.rst
15+
environment_variables.rst
1616
api
1717
tips_and_tricks
1818
support
19-
contribute.md
20-
conduct.md
19+
contribute.rst
20+
conduct.rst
2121
license
2222

2323

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
Installation
2+
============
3+
4+
Runtime Requirements
5+
--------------------
6+
7+
``cuda.bindings`` supports the same platforms as CUDA. Runtime dependencies are:
8+
9+
- Linux (x86-64, arm64) and Windows (x86-64)
10+
- Python 3.9 - 3.13
11+
- Driver: Linux (580.65.06 or later) Windows (580.88 or later)
12+
- Optionally, NVRTC, nvJitLink, NVVM, and cuFile from CUDA Toolkit 13.x
13+
14+
.. note::
15+
16+
The optional CUDA Toolkit components are now installed via the ``cuda-toolkit`` metapackage from PyPI for improved dependency resolution. Components can also be installed via Conda, OS-specific package managers, or local installers (as described in the CUDA Toolkit `Windows <https://docs.nvidia.com/cuda/cuda-installation-guide-microsoft-windows/index.html>`__ and `Linux <https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html>`__ Installation Guides).
17+
18+
Starting from v12.8.0, ``cuda-python`` becomes a meta package which currently depends only on ``cuda-bindings``; in the future more sub-packages will be added to ``cuda-python``. In the instructions below, we still use ``cuda-python`` as example to serve existing users, but everything is applicable to ``cuda-bindings`` as well.
19+
20+
Installing from PyPI
21+
--------------------
22+
23+
.. code:: console
24+
25+
$ pip install -U cuda-python
26+
27+
Install all optional dependencies with:
28+
29+
.. code-block:: shell
30+
31+
pip install -U cuda-python[all]
32+
33+
Where the optional dependencies include:
34+
35+
- ``nvidia-cuda-nvrtc`` (NVRTC runtime compilation library)
36+
- ``nvidia-nvjitlink`` (nvJitLink library)
37+
- ``nvidia-nvvm`` (NVVM library)
38+
- ``nvidia-cufile`` (cuFile library, Linux only)
39+
40+
These are now installed through the ``cuda-toolkit`` metapackage for improved dependency resolution.
41+
42+
Installing from Conda
43+
---------------------
44+
45+
.. code:: console
46+
47+
$ conda install -c conda-forge cuda-python
48+
49+
.. note::
50+
51+
When using conda, the `cuda-version\` metapackage can be used to control the versions of CUDA Toolkit components that are installed to the conda environment.`
52+
53+
For example:
54+
55+
.. code:: console
56+
57+
$ conda install -c conda-forge cuda-python cuda-version=13
58+
59+
Installing from Source
60+
----------------------
61+
62+
Requirements
63+
~~~~~~~~~~~~
64+
65+
- CUDA Toolkit headers [1]_
66+
- CUDA Runtime static library [2]_
67+
68+
Source builds require that the provided CUDA headers are of the same major.minor version as the ``cuda.bindings`` you’re trying to build. Despite this requirement, note that the minor version compatibility is still maintained. Use the ``CUDA_HOME`` (or ``CUDA_PATH``) environment variable to specify the location of your headers. For example, if your headers are located in ``/usr/local/cuda/include``, then you should set ``CUDA_HOME`` with:
69+
70+
.. code:: console
71+
72+
$ export CUDA_HOME=/usr/local/cuda
73+
74+
See `Environment Variables <environment_variables.rst>`__ for a description of other build-time environment variables.
75+
76+
.. note::
77+
78+
Only `cydriver\`, `cyruntime\` and `cynvrtc\` are impacted by the header requirement.`
79+
80+
Editable Install
81+
~~~~~~~~~~~~~~~~
82+
83+
You can use
84+
85+
.. code:: console
86+
87+
$ pip install -v -e .
88+
89+
to install the module as editable in your current Python environment (e.g. for testing of porting other libraries to use the binding).
90+
91+
.. [1]
92+
User projects that ``cimport`` CUDA symbols in Cython must also use CUDA Toolkit (CTK) types as provided by the ``cuda.bindings`` major.minor version. This results in CTK headers becoming a transitive dependency of downstream projects through CUDA Python.
93+
94+
.. [2]
95+
The CUDA Runtime static library (``libcudart_static.a`` on Linux, ``cudart_static.lib`` on Windows) is part of the CUDA Toolkit. If using conda packages, it is contained in the ``cuda-cudart-static`` package.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Motivation
2+
==========
3+
4+
What is CUDA Python?
5+
--------------------
6+
7+
NVIDIA’s CUDA Python provides `Cython <https://cython.org/>`__ bindings and Python wrappers for the driver and runtime API for existing toolkits and libraries to simplify GPU-based accelerated processing. Python is one of the most popular programming languages for science, engineering, data analytics, and deep learning applications. The goal of CUDA Python is to unify the Python ecosystem with a single set of interfaces that provide full coverage of and access to the CUDA host APIs from Python.
8+
9+
Why CUDA Python?
10+
----------------
11+
12+
CUDA Python provides uniform APIs and bindings for inclusion into existing toolkits and libraries to simplify GPU-based parallel processing for HPC, data science, and AI.
13+
14+
`Numba <https://numba.pydata.org/>`__, a Python compiler from `Anaconda <https://www.anaconda.com/>`__ that can compile Python code for execution on CUDA-capable GPUs, provides Python developers with an easy entry into GPU-accelerated computing and a path for using increasingly sophisticated CUDA code with a minimum of new syntax and jargon. Numba has its own CUDA driver API bindings that can now be replaced with CUDA Python. With CUDA Python and Numba, you get the best of both worlds: rapid iterative development with Python and the speed of a compiled language targeting both CPUs and NVIDIA GPUs.
15+
16+
`CuPy <https://cupy.dev/>`__ is a `NumPy <https://numpy.org/>`__/`SciPy <https://www.scipy.org/>`__ compatible Array library, from `Preferred Networks <https://www.preferred.jp/en/>`__, for GPU-accelerated computing with Python. CUDA Python simplifies the CuPy build and allows for a faster and smaller memory footprint when importing the CuPy Python module. In the future, when more CUDA Toolkit libraries are supported, CuPy will have a lighter maintenance overhead and have fewer wheels to release. Users benefit from a faster CUDA runtime!
17+
18+
Our goal is to help unify the Python CUDA ecosystem with a single standard set of interfaces, providing full coverage of, and access to, the CUDA host APIs from Python. We want to provide a foundation for the ecosystem to build on top of in unison to allow composing different accelerated libraries together to solve the problems at hand. We also want to lower the barrier to entry for Python developers to utilize NVIDIA GPUs.

0 commit comments

Comments
 (0)