Skip to content

Commit

Permalink
Apply remaining touch ups for patch release
Browse files Browse the repository at this point in the history
- Issue #102: Rename root cuda to cuda_bindings
- Issue #145: Explain layout change
- Issue #108: Resolve how to run editable builds
  • Loading branch information
vzhurba01 committed Oct 11, 2024
1 parent 797286b commit 11a9013
Show file tree
Hide file tree
Showing 97 changed files with 137 additions and 70 deletions.
48 changes: 24 additions & 24 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,32 @@ __pycache__/
.pytest_cache/
.benchmarks/
*.cpp
!cuda/cuda/bindings/_lib/param_packer.cpp
!cuda/cuda/bindings/_bindings/loader.cpp
!cuda_bindings/cuda/bindings/_lib/param_packer.cpp
!cuda_bindings/cuda/bindings/_bindings/loader.cpp

# CUDA Python specific (auto-generated)
cuda/cuda/bindings/_bindings/cydriver.pxd
cuda/cuda/bindings/_bindings/cydriver.pyx
cuda/cuda/bindings/_bindings/cynvrtc.pxd
cuda/cuda/bindings/_bindings/cynvrtc.pyx
cuda/cuda/bindings/_lib/cyruntime/cyruntime.pxd
cuda/cuda/bindings/_lib/cyruntime/cyruntime.pyx
cuda/cuda/bindings/_lib/cyruntime/utils.pxd
cuda/cuda/bindings/_lib/cyruntime/utils.pyx
cuda/cuda/bindings/_lib/utils.pxd
cuda/cuda/bindings/_lib/utils.pyx
cuda/cuda/bindings/cydriver.pxd
cuda/cuda/bindings/cydriver.pyx
cuda/cuda/bindings/cyruntime.pxd
cuda/cuda/bindings/cyruntime.pyx
cuda/cuda/bindings/cynvrtc.pxd
cuda/cuda/bindings/cynvrtc.pyx
cuda/cuda/bindings/driver.pxd
cuda/cuda/bindings/driver.pyx
cuda/cuda/bindings/runtime.pxd
cuda/cuda/bindings/runtime.pyx
cuda/cuda/bindings/nvrtc.pxd
cuda/cuda/bindings/nvrtc.pyx
cuda_bindings/cuda/bindings/_bindings/cydriver.pxd
cuda_bindings/cuda/bindings/_bindings/cydriver.pyx
cuda_bindings/cuda/bindings/_bindings/cynvrtc.pxd
cuda_bindings/cuda/bindings/_bindings/cynvrtc.pyx
cuda_bindings/cuda/bindings/_lib/cyruntime/cyruntime.pxd
cuda_bindings/cuda/bindings/_lib/cyruntime/cyruntime.pyx
cuda_bindings/cuda/bindings/_lib/cyruntime/utils.pxd
cuda_bindings/cuda/bindings/_lib/cyruntime/utils.pyx
cuda_bindings/cuda/bindings/_lib/utils.pxd
cuda_bindings/cuda/bindings/_lib/utils.pyx
cuda_bindings/cuda/bindings/cydriver.pxd
cuda_bindings/cuda/bindings/cydriver.pyx
cuda_bindings/cuda/bindings/cyruntime.pxd
cuda_bindings/cuda/bindings/cyruntime.pyx
cuda_bindings/cuda/bindings/cynvrtc.pxd
cuda_bindings/cuda/bindings/cynvrtc.pyx
cuda_bindings/cuda/bindings/driver.pxd
cuda_bindings/cuda/bindings/driver.pyx
cuda_bindings/cuda/bindings/runtime.pxd
cuda_bindings/cuda/bindings/runtime.pyx
cuda_bindings/cuda/bindings/nvrtc.pxd
cuda_bindings/cuda/bindings/nvrtc.pyx

# Distribution / packaging
.Python
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,23 @@ Latest dependencies can be found in [requirements.txt](https://github.com/NVIDIA
You can run the included tests with:

```
python -m pytest
python -m pytest tests/
```

### Benchmark

You can run benchmark only tests with:

```
python -m pytest --benchmark-only
python -m pytest --benchmark-only benchmarks/
```

### Samples

You can run the included tests with:

```
python -m pytest examples
python -m pytest examples/
```

## Examples
Expand Down
Empty file.
3 changes: 0 additions & 3 deletions cuda/cuda/bindings/examples/setup.cfg

This file was deleted.

Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion cuda/pytest.ini → cuda_bindings/benchmarks/pytest.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# pytest.ini
[pytest]
required_plugins = pytest-benchmark
addopts = --benchmark-skip
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
# is strictly prohibited.
import numpy as np
from cuda import cuda
from cuda.bindings.examples.common import common
from cuda.bindings.examples.common.helper_cuda import checkCudaErrors, findCudaDevice
from common import common
from common.helper_cuda import checkCudaErrors, findCudaDevice

clock_nvrtc = '''\
extern "C" __global__ void timedReduction(const float *hinput, float *output, clock_t *timer)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
import sys
import time
from cuda import cuda, cudart
from cuda.bindings.examples.common import common
from cuda.bindings.examples.common.helper_cuda import checkCudaErrors, findCudaDevice
from common import common
from common.helper_cuda import checkCudaErrors, findCudaDevice

simpleCubemapTexture = '''\
extern "C"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import numpy as np
import sys
from cuda import cuda, cudart
from cuda.bindings.examples.common import common
from cuda.bindings.examples.common.helper_cuda import checkCudaErrors
from common import common
from common.helper_cuda import checkCudaErrors

simplep2p = '''\
extern "C"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
import random as rnd
import sys
from cuda import cuda, cudart
from cuda.bindings.examples.common import common
from cuda.bindings.examples.common.helper_cuda import checkCudaErrors
from cuda.bindings.examples.common.helper_string import checkCmdLineFlag
from common import common
from common.helper_cuda import checkCudaErrors
from common.helper_string import checkCmdLineFlag

simpleZeroCopy = '''\
extern "C"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
import sys
import os
from cuda import cuda, cudart
from cuda.bindings.examples.common import common
from cuda.bindings.examples.common.helper_cuda import checkCudaErrors, findCudaDevice
from common import common
from common.helper_cuda import checkCudaErrors, findCudaDevice

systemWideAtomics = '''\
#define LOOP_NUM 50
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import math
import numpy as np
from cuda import cuda
from cuda.bindings.examples.common import common
from cuda.bindings.examples.common.helper_cuda import checkCudaErrors, findCudaDeviceDRV
from common import common
from common.helper_cuda import checkCudaErrors, findCudaDeviceDRV

vectorAddDrv = '''\
/* Vector addition: C = A + B.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
import numpy as np
import sys
from cuda import cuda
from cuda.bindings.examples.common import common
from cuda.bindings.examples.common.helper_cuda import checkCudaErrors, findCudaDeviceDRV
from common import common
from common.helper_cuda import checkCudaErrors, findCudaDeviceDRV

vectorAddMMAP = '''\
/* Vector addition: C = A + B.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
import random as rnd
import sys
from cuda import cuda, cudart
from cuda.bindings.examples.common import common
from cuda.bindings.examples.common.helper_cuda import checkCudaErrors, findCudaDevice
from cuda.bindings.examples.common.helper_string import checkCmdLineFlag
from common import common
from common.helper_cuda import checkCudaErrors, findCudaDevice
from common.helper_string import checkCmdLineFlag

streamOrderedAllocation = '''\
/* Add two vectors on the GPU */
Expand Down Expand Up @@ -166,6 +166,7 @@ def streamOrderedAllocationPostSync(dev, nelem, a, b, c) :
return errorNorm/refNorm < 1.e-6

def main():
cuda.cuInit(0)
if checkCmdLineFlag("help"):
print("Usage: streamOrderedAllocation [OPTION]\n");
print("Options:");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
import pytest
from cuda import cuda, cudart
from enum import Enum
from cuda.bindings.examples.common import common
from cuda.bindings.examples.common.helper_cuda import checkCudaErrors, findCudaDevice
from cuda.bindings.examples.common.helper_string import checkCmdLineFlag, getCmdLineArgumentInt
from common import common
from common.helper_cuda import checkCudaErrors, findCudaDevice
from common.helper_string import checkCmdLineFlag, getCmdLineArgumentInt

blockSize = 16
class kernels(Enum):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
import pytest
import random as rnd
from cuda import cuda, cudart
from cuda.bindings.examples.common import common
from cuda.bindings.examples.common.helper_cuda import checkCudaErrors, findCudaDevice
from common import common
from common.helper_cuda import checkCudaErrors, findCudaDevice

THREADS_PER_BLOCK = 512
GRAPH_LAUNCH_ITERATIONS = 3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
import numpy as np
import sys
from cuda import cuda, cudart
from cuda.bindings.examples.common import common
from cuda.bindings.examples.common.helper_cuda import checkCudaErrors, findCudaDevice
from common import common
from common.helper_cuda import checkCudaErrors, findCudaDevice
from random import random

conjugateGradientMultiBlockCG = '''\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import numpy as np
import os
from cuda import cuda, cudart, nvrtc
from cuda.bindings.examples.common.helper_cuda import checkCudaErrors
from common.helper_cuda import checkCudaErrors

class KernelHelper:
def __init__(self, code, devID):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# this software and related documentation outside the terms of the EULA
# is strictly prohibited.
from cuda import cuda, cudart, nvrtc
from cuda.bindings.examples.common.helper_string import getCmdLineArgumentInt, checkCmdLineFlag
from common.helper_string import getCmdLineArgumentInt, checkCmdLineFlag

def _cudaGetErrorEnum(error):
if isinstance(error, cuda.CUresult):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import numpy as np
import time
from cuda import cuda, cudart
from cuda.bindings.examples.common import common
from cuda.bindings.examples.common.helper_cuda import checkCudaErrors
from common import common
from common.helper_cuda import checkCudaErrors

isoPropagator = '''\
extern "C"
Expand Down
4 changes: 4 additions & 0 deletions cuda_bindings/examples/pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[pytest]
python_files = *_test.py
python_functions = main
pythonpath = .
File renamed without changes.
File renamed without changes.
10 changes: 7 additions & 3 deletions cuda/setup.py → cuda_bindings/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@
cache='./cache_{}'.format(library.split('.')[0]) if PARSER_CACHING else None,
replace=replace)

if library == 'driver':
CUDA_VERSION = parser.defs['macros']['CUDA_VERSION'] if 'CUDA_VERSION' in parser.defs['macros'] else 'Unknown'
print(f'Found CUDA_VERSION: {CUDA_VERSION}')

# Combine types with others since they sometimes get tangled
found_types += {key for key in parser.defs['types']}
found_types += {key for key in parser.defs['structs']}
Expand Down Expand Up @@ -225,7 +229,7 @@ def do_cythonize(extensions):
# public (deprecated, to be removed)
["cuda/*.pyx"],
# tests
["cuda/bindings/tests/*.pyx"],
["tests/*.pyx"],
]

for sources in sources_list:
Expand Down Expand Up @@ -256,9 +260,9 @@ def finalize_options(self):
setup(
version=versioneer.get_version(),
ext_modules=do_cythonize(extensions),
packages=find_packages(include=["cuda.cuda", "cuda.cuda.*", "cuda.cuda.bindings", "cuda.cuda.bindings._bindings", "cuda.cuda.bindings._lib", "cuda.cuda.bindings._lib.cyruntime", "cuda.cuda.bindings.tests"]),
packages=find_packages(include=["cuda.cuda", "cuda.cuda.*", "cuda.cuda.bindings", "cuda.cuda.bindings._bindings", "cuda.cuda.bindings._lib", "cuda.cuda.bindings._lib.cyruntime", "tests"]),
package_data=dict.fromkeys(
find_packages(include=["cuda.cuda", "cuda.cuda.*", "cuda.cuda.bindings", "cuda.cuda.bindings._bindings", "cuda.cuda.bindings._lib", "cuda.cuda.bindings._lib.cyruntime", "cuda.cuda.bindings.tests"]),
find_packages(include=["cuda.cuda", "cuda.cuda.*", "cuda.cuda.bindings", "cuda.cuda.bindings._bindings", "cuda.cuda.bindings._lib", "cuda.cuda.bindings._lib.cyruntime", "tests"]),
["*.pxd", "*.pyx", "*.py", "*.h", "*.cpp"],
),
cmdclass=cmdclass,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ def wrapped(*args, **kwargs):
return wrapped


cython_test_modules = ["cuda.bindings.tests.test_ccuda",
"cuda.bindings.tests.test_ccudart",
"cuda.bindings.tests.test_interoperability_cython"]
cython_test_modules = ["test_ccuda",
"test_ccudart",
"test_interoperability_cython"]


for mod in cython_test_modules:
Expand Down
File renamed without changes.
File renamed without changes.
22 changes: 21 additions & 1 deletion docs/_sources/release/12.6.1-notes.md.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,27 @@
Released on October 7, 2024

## Hightlights
- Resolve [Issue #90](https://github.com/NVIDIA/cuda-python/issues/90): Use new layout in preperation for cuda-python becoming a metapackage
- Resolve [Issue #90](https://github.com/NVIDIA/cuda-python/issues/90): Use new layout in preparation for cuda-python becoming a metapackage
- Resolve [Issue #75](https://github.com/NVIDIA/cuda-python/issues/75): CUDA namespace cleanup

## CUDA namespace cleanup with a new module layout

[Issue #75](https://github.com/NVIDIA/cuda-python/issues/75) explains in detail what the new module layout is, what problem it fixes and how it impacts the users. However for the sake of completeness, this release notes will highlight key points of this change.

Before this change, `cuda-python` was tightly coupled to CUDA Toolkit releases and all new features would inherit this coupling regardless of their applicability. As we develop new features, this coupling was becoming overly restrictive and motivated a new solution: Convert `cuda-python` into a metapackage where we use `cuda` as a namespace with existing bindings code moved to a `cuda_bindings` subpackage.

This patch release applies the new module layout for the bindings as follows:
- `cuda.cuda` -> `cuda.bindings.driver`
- `cuda.ccuda` -> `cuda.bindings.cydriver`
- `cuda.cudart` -> `cuda.bindings.runtime`
- `cuda.ccudart` -> `cuda.bindings.cyruntime`
- `cuda.nvrtc` -> `cuda.bindings.nvrtc`
- `cuda.cnvrtc` -> `cuda.bindings.cynvrtc`

Deprecation warnings are turned on as a notice to switch to the new module layout.

```{note} This is non-breaking, backwards compatible change. All old module path will continue work as they "forward" user calls towards the new layout.
```

## Limitations

Expand Down
1 change: 1 addition & 0 deletions docs/release.html
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ <h1>Release Notes<a class="headerlink" href="#release-notes" title="Permalink to
<ul>
<li class="toctree-l1"><a class="reference internal" href="release/12.6.1-notes.html"> 12.6.1</a><ul>
<li class="toctree-l2"><a class="reference internal" href="release/12.6.1-notes.html#hightlights">Hightlights</a></li>
<li class="toctree-l2"><a class="reference internal" href="release/12.6.1-notes.html#cuda-namespace-cleanup-with-a-new-module-layout">CUDA namespace cleanup with a new module layout</a></li>
<li class="toctree-l2"><a class="reference internal" href="release/12.6.1-notes.html#limitations">Limitations</a><ul>
<li class="toctree-l3"><a class="reference internal" href="release/12.6.1-notes.html#cuda-functions-not-supported-in-this-release">CUDA Functions Not Supported in this Release</a></li>
</ul>
Expand Down
23 changes: 22 additions & 1 deletion docs/release/12.6.1-notes.html
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,29 @@ <h1>CUDA Python 12.6.1 Release notes<a class="headerlink" href="#cuda-python-12-
<section id="hightlights">
<h2>Hightlights<a class="headerlink" href="#hightlights" title="Permalink to this heading">#</a></h2>
<ul class="simple">
<li><p>Resolve <a class="reference external" href="https://github.com/NVIDIA/cuda-python/issues/90">Issue #90</a>: Use new layout in preperation for cuda-python becoming a metapackage</p></li>
<li><p>Resolve <a class="reference external" href="https://github.com/NVIDIA/cuda-python/issues/90">Issue #90</a>: Use new layout in preparation for cuda-python becoming a metapackage</p></li>
<li><p>Resolve <a class="reference external" href="https://github.com/NVIDIA/cuda-python/issues/75">Issue #75</a>: CUDA namespace cleanup</p></li>
</ul>
</section>
<section id="cuda-namespace-cleanup-with-a-new-module-layout">
<h2>CUDA namespace cleanup with a new module layout<a class="headerlink" href="#cuda-namespace-cleanup-with-a-new-module-layout" title="Permalink to this heading">#</a></h2>
<p><a class="reference external" href="https://github.com/NVIDIA/cuda-python/issues/75">Issue #75</a> explains in detail what the new module layout is, what problem it fixes and how it impacts the users. However for the sake of completeness, this release notes will highlight key points of this change.</p>
<p>Before this change, <code class="docutils literal notranslate"><span class="pre">cuda-python</span></code> was tightly coupled to CUDA Toolkit releases and all new features would inherit this coupling regardless of their applicability. As we develop new features, this coupling was becoming overly restrictive and motivated a new solution: Convert <code class="docutils literal notranslate"><span class="pre">cuda-python</span></code> into a metapackage where we use <code class="docutils literal notranslate"><span class="pre">cuda</span></code> as a namespace with existing bindings code moved to a <code class="docutils literal notranslate"><span class="pre">cuda_bindings</span></code> subpackage.</p>
<p>This patch release applies the new module layout for the bindings as follows:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">cuda.cuda</span></code> -&gt; <code class="docutils literal notranslate"><span class="pre">cuda.bindings.driver</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">cuda.ccuda</span></code> -&gt; <code class="docutils literal notranslate"><span class="pre">cuda.bindings.cydriver</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">cuda.cudart</span></code> -&gt; <code class="docutils literal notranslate"><span class="pre">cuda.bindings.runtime</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">cuda.ccudart</span></code> -&gt; <code class="docutils literal notranslate"><span class="pre">cuda.bindings.cyruntime</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">cuda.nvrtc</span></code> -&gt; <code class="docutils literal notranslate"><span class="pre">cuda.bindings.nvrtc</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">cuda.cnvrtc</span></code> -&gt; <code class="docutils literal notranslate"><span class="pre">cuda.bindings.cynvrtc</span></code></p></li>
</ul>
<p>Deprecation warnings are turned on as a notice to switch to the new module layout.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>This is non-breaking, backwards compatible change. All old module path will continue work as they “forward” user calls towards the new layout.</p>
</div>
</section>
<section id="limitations">
<h2>Limitations<a class="headerlink" href="#limitations" title="Permalink to this heading">#</a></h2>
<section id="cuda-functions-not-supported-in-this-release">
Expand Down Expand Up @@ -334,6 +354,7 @@ <h3>CUDA Functions Not Supported in this Release<a class="headerlink" href="#cud
<ul>
<li><a class="reference internal" href="#">CUDA Python 12.6.1 Release notes</a><ul>
<li><a class="reference internal" href="#hightlights">Hightlights</a></li>
<li><a class="reference internal" href="#cuda-namespace-cleanup-with-a-new-module-layout">CUDA namespace cleanup with a new module layout</a></li>
<li><a class="reference internal" href="#limitations">Limitations</a><ul>
<li><a class="reference internal" href="#cuda-functions-not-supported-in-this-release">CUDA Functions Not Supported in this Release</a></li>
</ul>
Expand Down
2 changes: 1 addition & 1 deletion docs/searchindex.js

Large diffs are not rendered by default.

Loading

0 comments on commit 11a9013

Please sign in to comment.