Skip to content

Commit

Permalink
Patch 11.8.1
Browse files Browse the repository at this point in the history
- Resolve issue 27
- Update install instructions to use latest CTK
  • Loading branch information
vzhurba01 committed Nov 4, 2022
1 parent d375d22 commit 451a19e
Show file tree
Hide file tree
Showing 37 changed files with 659 additions and 187 deletions.
55 changes: 4 additions & 51 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,63 +11,15 @@ work are as follows:
* CUDA Toolkit 11.0 to 11.8
* Cython - e.g. 0.29.21

### Compilation
### Installing

To compile the extension in-place, run:

```
python setup.py build_ext --inplace
```

To compile for debugging the extension modules with gdb, pass the `--debug`
argument to setup.py.


### Develop installation

You can use

```
pip install -e .
```

to install the module as editible in your current Python environment (e.g. for
testing of porting other libraries to use the binding).


### Build the Docs

```
conda env create -f docs_src/environment-docs.yml
conda activate cuda-python-docs
```
Then compile and install `cuda-python` following the steps above.

```
cd docs_src
make html
open build/html/index.html
```

### Publish the Docs

```
git checkout gh-pages
cd docs_src
make html
cp -a build/html/. ../docs/
```
Refer to documentation for installation options and requirements: [nvidia.github.io/cuda-python/](https://nvidia.github.io/cuda-python/install.html)

## Testing

### Requirements

Dependencies of the test execution and some versions that are known to
work are as follows:

* numpy-1.19.5
* scipy-1.6.3
* pytest-benchmark-3.4.1
Latest dependencies can be found in [requirements.txt](https://github.com/NVIDIA/cuda-python/blob/main/requirements.txt).

### Unit-tests

Expand All @@ -76,6 +28,7 @@ You can run the included tests with:
```
python -m pytest
```

### Benchmark

You can run benchmark only tests with:
Expand Down
11 changes: 11 additions & 0 deletions cuda/_lib/utils.pxd.in
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,17 @@ cdef class HelperCUjit_option:
cdef vector[char*] _charstarstar # list of names
cdef InputVoidPtrPtrHelper _voidstarstar # list of addresses
{{endif}}
{{if 'CUmemAllocationHandleType_enum' in found_types}}

cdef class HelperCUmemAllocationHandleType:
cdef void* _cptr
cdef ccuda.CUmemAllocationHandleType_enum _type

# Return values
cdef int _int
cdef void* _handle
cdef unsigned int _d3dkmt_handle
{{endif}}

cdef class InputVoidPtrPtrHelper:
cdef void** _cptr
55 changes: 55 additions & 0 deletions cuda/_lib/utils.pyx.in
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,61 @@ cdef class HelperCUjit_option:
def cptr(self):
return <void_ptr>self._cptr
{{endif}}
{{if 'CUmemAllocationHandleType_enum' in found_types}}

cdef class HelperCUmemAllocationHandleType:
def __cinit__(self, attr):
self._type = attr.value
if False:
pass
{{if 'CU_MEM_HANDLE_TYPE_NONE' in found_values}}
elif self._type in (ccuda.CUmemAllocationHandleType_enum.CU_MEM_HANDLE_TYPE_NONE,):
self._cptr = <void*>&self._int
{{endif}}
{{if 'CU_MEM_HANDLE_TYPE_POSIX_FILE_DESCRIPTOR' in found_values}}
elif self._type in (ccuda.CUmemAllocationHandleType_enum.CU_MEM_HANDLE_TYPE_POSIX_FILE_DESCRIPTOR,):
self._cptr = <void*>&self._int
{{endif}}
{{if 'CU_MEM_HANDLE_TYPE_WIN32' in found_values}}
elif self._type in (ccuda.CUmemAllocationHandleType_enum.CU_MEM_HANDLE_TYPE_WIN32,):
self._cptr = <void*>&self._handle
{{endif}}
{{if 'CU_MEM_HANDLE_TYPE_WIN32_KMT' in found_values}}
elif self._type in (ccuda.CUmemAllocationHandleType_enum.CU_MEM_HANDLE_TYPE_WIN32_KMT,):
self._cptr = <void*>&self._d3dkmt_handle
{{endif}}
else:
raise TypeError('Unsupported attribute: {}'.format(attr.name))

def __dealloc__(self):
pass

@property
def cptr(self):
return <void_ptr>self._cptr

def pyObj(self):
if False:
pass
{{if 'CU_MEM_HANDLE_TYPE_NONE' in found_values}}
elif self._type in (ccuda.CUmemAllocationHandleType_enum.CU_MEM_HANDLE_TYPE_NONE,):
return self._int
{{endif}}
{{if 'CU_MEM_HANDLE_TYPE_POSIX_FILE_DESCRIPTOR' in found_values}}
elif self._type in (ccuda.CUmemAllocationHandleType_enum.CU_MEM_HANDLE_TYPE_POSIX_FILE_DESCRIPTOR,):
return self._int
{{endif}}
{{if 'CU_MEM_HANDLE_TYPE_WIN32' in found_values}}
elif self._type in (ccuda.CUmemAllocationHandleType_enum.CU_MEM_HANDLE_TYPE_WIN32,):
return <void_ptr>self._handle
{{endif}}
{{if 'CU_MEM_HANDLE_TYPE_WIN32_KMT' in found_values}}
elif self._type in (ccuda.CUmemAllocationHandleType_enum.CU_MEM_HANDLE_TYPE_WIN32_KMT,):
return self._d3dkmt_handle
{{endif}}
else:
raise TypeError('Unsupported attribute: {}'.format(self._type))
{{endif}}

cdef class InputVoidPtrPtrHelper:
def __cinit__(self, lst):
Expand Down
28 changes: 14 additions & 14 deletions cuda/cuda.pyx.in
Original file line number Diff line number Diff line change
Expand Up @@ -13365,7 +13365,7 @@ def cuDeviceGetAttribute(attrib not None : CUdevice_attribute, dev):
{{if 'cuDeviceGetNvSciSyncAttributes' in found_functions}}

@cython.embedsignature(True)
def cuDeviceGetNvSciSyncAttributes(dev, int flags):
def cuDeviceGetNvSciSyncAttributes(nvSciSyncAttrList, dev, int flags):
""" Return NvSciSync attributes that this device can support.

Returns in `nvSciSyncAttrList`, the properties of NvSciSync that this
Expand Down Expand Up @@ -13405,6 +13405,8 @@ def cuDeviceGetNvSciSyncAttributes(dev, int flags):

Parameters
----------
nvSciSyncAttrList : Any
Return NvSciSync attributes supported.
dev : :py:obj:`~.CUdevice`
Valid Cuda Device to get NvSciSync attributes for.
flags : int
Expand All @@ -13414,8 +13416,6 @@ def cuDeviceGetNvSciSyncAttributes(dev, int flags):
-------
CUresult

nvSciSyncAttrList : Any
Return NvSciSync attributes supported.

See Also
--------
Expand All @@ -13431,10 +13431,10 @@ def cuDeviceGetNvSciSyncAttributes(dev, int flags):
pdev = int(CUdevice(dev))
cdev = <ccuda.CUdevice>pdev

cdef void_ptr nvSciSyncAttrList = 0
cdef void* cnvSciSyncAttrList_ptr = <void*>nvSciSyncAttrList
cnvSciSyncAttrList = utils.HelperInputVoidPtr(nvSciSyncAttrList)
cdef void* cnvSciSyncAttrList_ptr = <void*><void_ptr>cnvSciSyncAttrList.cptr
err = ccuda.cuDeviceGetNvSciSyncAttributes(cnvSciSyncAttrList_ptr, cdev, flags)
return (CUresult(err), nvSciSyncAttrList)
return (CUresult(err),)
{{endif}}

{{if 'cuDeviceSetMemPool' in found_functions}}
Expand Down Expand Up @@ -20150,8 +20150,8 @@ def cuMemGetHandleForAddressRange(dptr, size_t size, handleType not None : CUmem
pdptr = int(CUdeviceptr(dptr))
cdptr = <ccuda.CUdeviceptr><void_ptr>pdptr

cdef void_ptr handle = 0
cdef void* chandle_ptr = <void*>handle
cdef int handle = 0
cdef void* chandle_ptr = <void*>&handle
cdef ccuda.CUmemRangeHandleType chandleType = handleType.value
err = ccuda.cuMemGetHandleForAddressRange(chandle_ptr, cdptr, size, chandleType, flags)
return (CUresult(err), handle)
Expand Down Expand Up @@ -20794,11 +20794,11 @@ def cuMemExportToShareableHandle(handle, handleType not None : CUmemAllocationHa
phandle = int(CUmemGenericAllocationHandle(handle))
chandle = <ccuda.CUmemGenericAllocationHandle><void_ptr>phandle

cdef void_ptr shareableHandle = 0
cdef void* cshareableHandle_ptr = <void*>shareableHandle
cdef utils.HelperCUmemAllocationHandleType cshareableHandle = utils.HelperCUmemAllocationHandleType(handleType)
cdef void* cshareableHandle_ptr = <void*><void_ptr>cshareableHandle.cptr
cdef ccuda.CUmemAllocationHandleType chandleType = handleType.value
err = ccuda.cuMemExportToShareableHandle(cshareableHandle_ptr, chandle, chandleType, flags)
return (CUresult(err), shareableHandle)
return (CUresult(err), cshareableHandle.pyObj())
{{endif}}

{{if 'cuMemImportFromShareableHandle' in found_functions}}
Expand Down Expand Up @@ -21560,11 +21560,11 @@ def cuMemPoolExportToShareableHandle(pool, handleType not None : CUmemAllocation
ppool = int(CUmemoryPool(pool))
cpool = <ccuda.CUmemoryPool><void_ptr>ppool

cdef void_ptr handle_out = 0
cdef void* chandle_out_ptr = <void*>handle_out
cdef utils.HelperCUmemAllocationHandleType chandle_out = utils.HelperCUmemAllocationHandleType(handleType)
cdef void* chandle_out_ptr = <void*><void_ptr>chandle_out.cptr
cdef ccuda.CUmemAllocationHandleType chandleType = handleType.value
err = ccuda.cuMemPoolExportToShareableHandle(chandle_out_ptr, cpool, chandleType, flags)
return (CUresult(err), handle_out)
return (CUresult(err), chandle_out.pyObj())
{{endif}}

{{if 'cuMemPoolImportFromShareableHandle' in found_functions}}
Expand Down
20 changes: 10 additions & 10 deletions cuda/cudart.pyx.in
Original file line number Diff line number Diff line change
Expand Up @@ -12312,7 +12312,7 @@ def cudaDeviceGetMemPool(int device):
{{if 'cudaDeviceGetNvSciSyncAttributes' in found_functions}}

@cython.embedsignature(True)
def cudaDeviceGetNvSciSyncAttributes(int device, int flags):
def cudaDeviceGetNvSciSyncAttributes(nvSciSyncAttrList, int device, int flags):
""" Return NvSciSync attributes that this device can support.

Returns in `nvSciSyncAttrList`, the properties of NvSciSync that this
Expand Down Expand Up @@ -12347,6 +12347,8 @@ def cudaDeviceGetNvSciSyncAttributes(int device, int flags):

Parameters
----------
nvSciSyncAttrList : Any
Return NvSciSync attributes supported.
device : int
Valid Cuda Device to get NvSciSync attributes for.
flags : int
Expand All @@ -12356,17 +12358,15 @@ def cudaDeviceGetNvSciSyncAttributes(int device, int flags):
-------
cudaError_t

nvSciSyncAttrList : Any
Return NvSciSync attributes supported.

See Also
--------
:py:obj:`~.cudaImportExternalSemaphore`, :py:obj:`~.cudaDestroyExternalSemaphore`, :py:obj:`~.cudaSignalExternalSemaphoresAsync`, :py:obj:`~.cudaWaitExternalSemaphoresAsync`
"""
cdef void_ptr nvSciSyncAttrList = 0
cdef void* cnvSciSyncAttrList_ptr = <void*>nvSciSyncAttrList
cnvSciSyncAttrList = utils.HelperInputVoidPtr(nvSciSyncAttrList)
cdef void* cnvSciSyncAttrList_ptr = <void*><void_ptr>cnvSciSyncAttrList.cptr
err = ccudart.cudaDeviceGetNvSciSyncAttributes(cnvSciSyncAttrList_ptr, device, flags)
return (cudaError_t(err), nvSciSyncAttrList)
return (cudaError_t(err),)
{{endif}}

{{if 'cudaDeviceGetP2PAttribute' in found_functions}}
Expand Down Expand Up @@ -19805,11 +19805,11 @@ def cudaMemPoolExportToShareableHandle(memPool, handleType not None : cudaMemAll
pmemPool = int(cudaMemPool_t(memPool))
cmemPool = <ccudart.cudaMemPool_t><void_ptr>pmemPool

cdef void_ptr shareableHandle = 0
cdef void* cshareableHandle_ptr = <void*>shareableHandle
cdef utils.HelperCUmemAllocationHandleType cshareableHandle = utils.HelperCUmemAllocationHandleType(handleType)
cdef void* cshareableHandle_ptr = <void*><void_ptr>cshareableHandle.cptr
cdef ccudart.cudaMemAllocationHandleType chandleType = handleType.value
err = ccudart.cudaMemPoolExportToShareableHandle(cshareableHandle_ptr, cmemPool, chandleType, flags)
return (cudaError_t(err), shareableHandle)
return (cudaError_t(err), cshareableHandle.pyObj())
{{endif}}

{{if 'cudaMemPoolImportFromShareableHandle' in found_functions}}
Expand Down Expand Up @@ -23522,7 +23522,7 @@ def cudaGraphMemFreeNodeGetParams(node):
cnode = <ccudart.cudaGraphNode_t><void_ptr>pnode

cdef void_ptr dptr_out = 0
cdef void* cdptr_out_ptr = <void*>dptr_out
cdef void* cdptr_out_ptr = <void*>&dptr_out
err = ccudart.cudaGraphMemFreeNodeGetParams(cnode, cdptr_out_ptr)
return (cudaError_t(err), dptr_out)
{{endif}}
Expand Down
2 changes: 1 addition & 1 deletion docs/.buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 2173daa5e1d85d4fd21eb27f7801cf13
config: ad24118d52f507b84ce833bbfdacae42
tags: 645f666f9bcd5a90fca523b33c5a78b7
15 changes: 7 additions & 8 deletions docs/_sources/install.md.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,14 @@ conda install -c nvidia cuda-python

### Requirements

Building dependencies:
* cython>=0.29.24
Installing from source requires the latest CUDA Toolkit (CTK), matching the major.minor of CUDA Python. The installed package will still be compatible with all minor CTK versions.

Unit-test dependencies:
* pytest>=6.2.4
* pytest-benchmark>=3.4.1
* numpy>=1.21.1
Environment variable CUDA_HOME must be set to CTK root directory:
```
export CUDA_HOME=/usr/local/cuda
```

Latest list of dependencies can be found at [requirements.txt](https://github.com/NVIDIA/cuda-python/blob/main/requirements.txt)
Remaining build and test dependencies are outlined in [requirements.txt](https://github.com/NVIDIA/cuda-python/blob/main/requirements.txt)

### In-place

Expand All @@ -56,7 +55,7 @@ You can use
pip install -e .
```

to install the module as editible in your current Python environment (e.g. for
to install the module as editible in your current Python environment (e.g. for
testing of porting other libraries to use the binding).

## Build the Docs
Expand Down
1 change: 1 addition & 0 deletions docs/_sources/release.md.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
maxdepth: 3
---

11.8.1 <release/11.8.1-notes>
11.8.0 <release/11.8.0-notes>
11.7.1 <release/11.7.1-notes>
11.7.0 <release/11.7.0-notes>
Expand Down
32 changes: 32 additions & 0 deletions docs/_sources/release/11.8.1-notes.md.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# CUDA Python 11.8.1 Release notes

Released on November 4, 2022

## Hightlights
- Resolves [issue #27](https://github.com/NVIDIA/cuda-python/issues/24)
- Update install instructions to use latest CTK

## Limitations

### CUDA Functions Not Supported in this Release

- Symbol APIs
- cudaGraphExecMemcpyNodeSetParamsFromSymbol
- cudaGraphExecMemcpyNodeSetParamsToSymbol
- cudaGraphAddMemcpyNodeToSymbol
- cudaGraphAddMemcpyNodeFromSymbol
- cudaGraphMemcpyNodeSetParamsToSymbol
- cudaGraphMemcpyNodeSetParamsFromSymbol
- cudaMemcpyToSymbol
- cudaMemcpyFromSymbol
- cudaMemcpyToSymbolAsync
- cudaMemcpyFromSymbolAsync
- cudaGetSymbolAddress
- cudaGetSymbolSize
- cudaGetFuncBySymbol
- Launch Options
- cudaLaunchKernel
- cudaLaunchCooperativeKernel
- cudaLaunchCooperativeKernelMultiDevice
- cudaSetValidDevices
- cudaVDPAUSetVDPAUDevice
2 changes: 1 addition & 1 deletion docs/_static/documentation_options.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var DOCUMENTATION_OPTIONS = {
URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'),
VERSION: '11.8.0',
VERSION: '11.8.1',
LANGUAGE: 'None',
COLLAPSE_INDEX: false,
BUILDER: 'html',
Expand Down
Loading

0 comments on commit 451a19e

Please sign in to comment.