Skip to content

Commit 3a06baf

Browse files
committed
Provide NumPy type table
1 parent c0ba513 commit 3a06baf

1 file changed

Lines changed: 54 additions & 4 deletions

File tree

cuda_bindings/docs/source/overview.md

Lines changed: 54 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -335,11 +335,61 @@ void testkernel(int i, int *pi,
335335
"""
336336
```
337337

338-
The first step is to create array objects with types corresponding to your kernel arguments.
339-
CuPy's user guide for [Kernel arguments](https://docs.cupy.dev/en/stable/user_guide/kernel.html#kernel-arguments) describes how primitive Numpy types correspond to kernel types,
340-
as well as how custom user types can be made.
338+
The first step is to create array objects with types corresponding to your kernel arguments. Primative Numpy types have the following corresponding kernel types:
341339

342-
For this example we have:
340+
```{list-table} Correspondence between NumPy types and kernel types.
341+
:header-rows: 1
342+
343+
* - NumPy type
344+
- Corresponding kernel types
345+
- itemsize (bytes)
346+
* - bool
347+
- bool
348+
- 1
349+
* - int8
350+
- char, signed char
351+
- 1
352+
* - int16
353+
- short, signed short
354+
- 2
355+
* - int32
356+
- int, signed int
357+
- 4
358+
* - int64
359+
- long long, signed long long
360+
- 8
361+
* - uint8
362+
- unsigned char
363+
- 1
364+
* - uint16
365+
- unsigned short
366+
- 2
367+
* - uint32
368+
- unsigned int
369+
- 4
370+
* - uint64
371+
- unsigned long long
372+
- 8
373+
* - float16
374+
- half
375+
- 2
376+
* - float32
377+
- float
378+
- 4
379+
* - float64
380+
- double
381+
- 8
382+
* - complex64
383+
- float2, cuFloatComplex, complex<float>
384+
- 8
385+
* - complex128
386+
- double2, cuDoubleComplex, complex<double>
387+
- 16
388+
```
389+
390+
Furthermore, custom NumPy types can be used to support both platform-dependent types and user-defined structures as kernel arguments.
391+
392+
This example uses the following types:
343393
* `int` is `np.uint32`
344394
* `float` is `np.float32`
345395
* `int*` and `float*` is `np.uint64`

0 commit comments

Comments
 (0)