Skip to content

Commit 0e956ee

Browse files
committed
Use intp instead of uint64 for addresses
1 parent 6d65657 commit 0e956ee

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

cuda_bindings/docs/source/overview.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -392,10 +392,10 @@ Furthermore, custom NumPy types can be used to support both platform-dependent t
392392
This example uses the following types:
393393
* `int` is `np.uint32`
394394
* `float` is `np.float32`
395-
* `int*` and `float*` is `np.uint64`
395+
* `int*`, `float*` and `testStruct*` is `np.intp`
396396
* `testStruct` is a custom user type `np.dtype([("value", np.int32)], align=True)`
397397

398-
Note how both of the pointers are `np.uint64` since the pointers values are always a representation of an address space.
398+
Note how both of the pointers are `np.intp` since the pointers values are always a representation of an address space.
399399

400400
Putting it all together:
401401
```python
@@ -410,11 +410,11 @@ pStruct_host = checkCudaErrors(cudart.cudaHostAlloc(testStruct.itemsize, cudart.
410410
# Collect all input kernel arguments into a single tuple for further processing
411411
kernelValues = (
412412
np.array(1, dtype=np.uint32),
413-
np.array([pInt_host], dtype=np.uint64),
413+
np.array([pInt_host], dtype=np.intp),
414414
np.array(123.456, dtype=np.float32),
415-
np.array([pFloat_host], dtype=np.uint64),
415+
np.array([pFloat_host], dtype=np.intp),
416416
np.array([5], testStruct),
417-
np.array([pStruct_host], dtype=np.uint64),
417+
np.array([pStruct_host], dtype=np.intp),
418418
)
419419
```
420420

@@ -424,7 +424,7 @@ with a [ctypes](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.c
424424
By having the final array object contain all pointers, we fulfill the contiguous array requirement:
425425

426426
```python
427-
kernelParams = np.array([arg.ctypes.data for arg in kernelValues], dtype=np.uint64)
427+
kernelParams = np.array([arg.ctypes.data for arg in kernelValues], dtype=np.intp)
428428
```
429429

430430
The launch API supports [Buffer Protocol](https://docs.python.org/3/c-api/buffer.html) objects, therefore we can pass the array object directly.
@@ -546,15 +546,15 @@ def main():
546546
...
547547
```
548548

549-
For NumPy, we can convert these CUDA types by leveraging the `__int__()` call to fetch the address of the underlying `cudaTextureObject_t` C object and wrapping it in a NumPy object array of type `np.uint64`:
549+
For NumPy, we can convert these CUDA types by leveraging the `__int__()` call to fetch the address of the underlying `cudaTextureObject_t` C object and wrapping it in a NumPy object array of type `np.intp`:
550550

551551
```python
552552
kernelValues = (
553-
np.array([d_data], dtype=np.uint64),
553+
np.array([d_data], dtype=np.intp),
554554
np.array(width, dtype=np.uint32),
555-
np.array([int(tex)], dtype=np.uint64),
555+
np.array([int(tex)], dtype=np.intp),
556556
)
557-
kernelArgs = np.array([arg.ctypes.data for arg in kernelValues], dtype=np.uint64)
557+
kernelArgs = np.array([arg.ctypes.data for arg in kernelValues], dtype=np.intp)
558558
```
559559

560560
For ctypes, we leverage the special handling of `None` type since each Python class already implements `getPtr()`:

0 commit comments

Comments
 (0)