Commit bf9c4c0
authored
Use new python dlpack interface, fixing warnings (#1082)
dlpack changed their Python interface to make the stream synchronization semantics clearer (see dmlc/dlpack#57). The interface now involves the consumer calling the __dlpack__() method on the producer array, with an optional stream argument (see https://data-apis.org/array-api/latest/API_specification/generated/array_api.array.__dlpack__.html).
I'm not sure our example is strictly correct, since we don't formally "consume" the array (instead, we just maintain a reference while operating on it, then let it go out of scope).
This fixes some warnings when running the examples, e.g.
```
/workspaces/MatX/build/../examples/python_integration_sample/example_matxutil.py:70: VisibleDeprecationWarning: This function is deprecated and will be removed in a future release. Use the cupy.from_dlpack() array constructor instead.
c_dlp = c.toDlpack()
/workspaces/MatX/build/../examples/python_integration_sample/example_matxutil.py:71: VisibleDeprecationWarning: This function is deprecated and will be removed in a future release. Use the cupy.from_dlpack() array constructor instead.
a_dlp = a.toDlpack()
/workspaces/MatX/build/../examples/python_integration_sample/example_matxutil.py:72: VisibleDeprecationWarning: This function is deprecated and will be removed in a future release. Use the cupy.from_dlpack() array constructor instead.
b_dlp = b.toDlpack()
```1 parent 0f53ca5 commit bf9c4c0
1 file changed
+5
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
71 | | - | |
72 | | - | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| |||
0 commit comments