8000 simplify a bit DLPack support and add comment · mpi4py/mpi4py@4acb6bd · GitHub
[go: up one dir, main page]

Skip to content

Commit 4acb6bd

Browse files
committed
simplify a bit DLPack support and add comment
1 parent 7338c11 commit 4acb6bd

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

src/mpi4py/MPI/asdlpack.pxi

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#------------------------------------------------------------------------------
2+
# Below is dlpack.h (as of v0.6)
23

34
cdef extern from * nogil:
45
ctypedef unsigned char uint8_t
@@ -20,8 +21,8 @@ ctypedef enum DLDeviceType:
2021
kDLCUDAManaged = 13
2122

2223
ctypedef struct DLDevice:
23-
DLDeviceType device_type
24-
int device_id
24+
DLDeviceType device_type
25+
int device_id
2526

2627
ctypedef enum DLDataTypeCode:
2728
kDLInt = 0
@@ -169,17 +170,11 @@ cdef int Py_GetDLPackBuffer(object obj, Py_buffer *view, int flags) except -1:
169170

170171
try:
171172
dlpack = obj.__dlpack__
172-
except AttributeError:
173-
raise NotImplementedError("dlpack: missing __dlpack__ method")
174-
175-
try:
176173
dlp 7A71 ack_device = obj.__dlpack_device__
177174
except AttributeError:
178-
dlpack_device = None
179-
if dlpack_device is not None:
180-
device_type, device_id = dlpack_device()
181-
else:
182-
device_type, devide_id = kDLCPU, 0
175+
raise NotImplementedError("dlpack: missing support")
176+
177+
device_type, device_id = dlpack_device()
183178
if device_type == kDLCPU:
184179
capsule = dlpack()
185180
else:

0 commit comments

Comments
 (0)
0