Coverage for cuda/bindings/cufile.pyx: 38.28%

1933 statements  

« prev     ^ index     » next       coverage.py v7.17.2, created at 2026-11-05 01:11 +0000

1# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 

2# 

3# SPDX-License-Identifier: Apache-2.0 

4# 

5# This code was automatically generated across versions from 12.9.1 to 13.4.1. Do not modify it directly. 

6# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=51aa8097269246ec75ca06d0fd4f4ba97a110908146a66dfed09997c052406f3 

7  

8  

9# <<<< PREAMBLE CONTENT >>>> 

10  

11cimport cpython as _cyb_cpython 

12cimport cpython.buffer as _cyb_cpython_buffer 

13from cpython.buffer cimport ( 

14 PyBUF_SIMPLE as _cyb_PyBUF_SIMPLE, 

15 PyBuffer_Release as _cyb_PyBuffer_Release, 

16 PyObject_GetBuffer as _cyb_PyObject_GetBuffer, 

17 Py_buffer as _cyb_Py_buffer, 

18) 

19cimport cpython.memoryview as _cyb_cpython_memoryview 

20from cython cimport view as _cyb_view 

21from libc.stdint cimport ( 

22 intptr_t, 

23 uint64_t, 

24) 

25from libc.stdlib cimport ( 

26 calloc as _cyb_calloc, 

27 free as _cyb_free, 

28 malloc as _cyb_malloc, 

29) 

30from libc.string cimport ( 

31 memcmp as _cyb_memcmp, 

32 memcpy as _cyb_memcpy, 

33 memmove as _cyb_memmove, 

34) 

35from libcpp cimport bool as _cyb_bool 

36  

37from cuda.bindings._internal._fast_enum import FastEnum as _cyb_FastEnum 

38  

39import numpy as _numpy 

40  

41cdef _cyb___getbuffer(object self, _cyb_cpython.Py_buffer *buffer, void *ptr, int size, bint readonly): 

42 buffer.buf = <char *>ptr 

43 buffer.format = 'b' 

44 buffer.internal = NULL 

45 buffer.itemsize = 1 

46 buffer.len = size 

47 buffer.ndim = 1 

48 buffer.obj = self 

49 buffer.readonly = readonly 

50 buffer.shape = &buffer.len 

51 buffer.strides = &buffer.itemsize 

52 buffer.suboffsets = NULL 

53  

54cdef inline intptr_t _cyb_array_ptr(object arr) except? 0: 

55 cdef _cyb_cpython.Py_buffer view 

56 cdef intptr_t ptr 

57 _cyb_cpython.PyObject_GetBuffer(arr, &view, _cyb_cpython_buffer.PyBUF_STRIDES) 1hljnpqrstfbdBimkouvwxygceC

58 ptr = <intptr_t>view.buf 1hljnpqrstfbdBimkouvwxygceC

59 _cyb_cpython.PyBuffer_Release(&view) 1hljnpqrstfbdBimkouvwxygceC

60 return ptr 1hljnpqrstfbdBimkouvwxygceC

61  

62cdef _cyb_from_buffer(buffer, size, lowpp_type): 

63 cdef _cyb_cpython.Py_buffer view 

64 if _cyb_cpython.PyObject_GetBuffer(buffer, &view, _cyb_cpython_buffer.PyBUF_SIMPLE) != 0: 

65 raise TypeError("buffer argument does not support the buffer protocol") 

66 try: 

67 if view.itemsize != 1: 

68 raise ValueError("buffer itemsize must be 1 byte") 

69 if view.len != size: 

70 raise ValueError(f"buffer length must be {size} bytes") 

71 return lowpp_type.from_ptr(<intptr_t><void *>view.buf, view.readonly != 0, buffer) 

72 finally: 

73 _cyb_cpython.PyBuffer_Release(&view) 

74  

75cdef _cyb_from_data(data, dtype_name, expected_dtype, lowpp_type): 

76 # _numpy.recarray is a subclass of _numpy.ndarray, so implicitly handled here. 

77 if isinstance(data, lowpp_type): 1fbdgce

78 return data 1fbdgce

79 if not isinstance(data, _numpy.ndarray): 

80 raise TypeError("data argument must be a NumPy ndarray") 

81 if data.size != 1: 

82 raise ValueError("data array must have a size of 1") 

83 if data.dtype != expected_dtype: 

84 raise ValueError(f"data array must be of dtype {dtype_name}") 

85 return lowpp_type.from_ptr(data.ctypes.data, not data.flags.writeable, data) 

86  

87  

88# <<<< END OF PREAMBLE CONTENT >>>> 

89  

90cimport cython # NOQA 

91from libc cimport errno 

92from ._internal.utils cimport (get_nested_resource_ptr, 

93 nested_resource) 

94  

95import cython 

96  

97from cuda.bindings.driver import CUresult as pyCUresult 

98  

99############################################################################### 

100# POD 

101############################################################################### 

102  

103cdef _get__py_anon_pod1_dtype_offsets(): 

104 cdef cuda_bindings_cufile__anon_pod1 pod 

105 return _numpy.dtype({ 

106 'names': ['fd', 'handle'], 

107 'formats': [_numpy.int32, _numpy.intp], 

108 'offsets': [ 

109 (<intptr_t>&(pod.fd)) - (<intptr_t>&pod), 

110 (<intptr_t>&(pod.handle)) - (<intptr_t>&pod), 

111 ], 

112 'itemsize': sizeof(cuda_bindings_cufile__anon_pod1), 

113 }) 

114  

115_py_anon_pod1_dtype = _get__py_anon_pod1_dtype_offsets() 

116  

117cdef class _py_anon_pod1: 

118 """Empty-initialize an instance of `cuda_bindings_cufile__anon_pod1`. 

119  

120  

121 .. seealso:: `cuda_bindings_cufile__anon_pod1` 

122 """ 

123 cdef: 

124 cuda_bindings_cufile__anon_pod1 *_ptr 

125 object _owner 

126 bint _owns_ptr 

127 bint _readonly 

128  

129 def __init__(self): 

130 self._ptr = <cuda_bindings_cufile__anon_pod1 *>_cyb_calloc(1, sizeof(cuda_bindings_cufile__anon_pod1)) 

131 if self._ptr == NULL: 

132 raise MemoryError("Error allocating _py_anon_pod1") 

133 self._owns_ptr = True 

134 self._owner = None 

135 self._readonly = False 

136  

137 def __dealloc__(self): 

138 cdef cuda_bindings_cufile__anon_pod1 *ptr 

139 if self._owns_ptr and self._ptr != NULL: 

140 ptr = self._ptr 

141 self._ptr = NULL 

142 _cyb_free(ptr) 

143  

144 def __repr__(self): 

145 return f"<{__name__}._py_anon_pod1 object at {hex(id(self))}>" 

146  

147 @property 

148 def ptr(self): 

149 """Get the pointer address to the data as Python :class:`int`.""" 

150 return <intptr_t>(self._ptr) 

151  

152 cdef intptr_t _get_ptr(self): 

153 return <intptr_t>(self._ptr) 

154  

155 def __int__(self): 

156 return <intptr_t>(self._ptr) 

157  

158 def __eq__(self, other): 

159 cdef _py_anon_pod1 other_ 

160 if not isinstance(other, _py_anon_pod1): 

161 return False 

162 other_ = other 

163 return (_cyb_memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(cuda_bindings_cufile__anon_pod1)) == 0) 

164  

165 def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): 

166 _cyb___getbuffer(self, buffer, <void *>self._ptr, sizeof(cuda_bindings_cufile__anon_pod1), self._readonly) 

167  

168 def __releasebuffer__(self, Py_buffer *buffer): 

169 pass 

170  

171 def __setitem__(self, key, val): 

172 cdef _cyb_Py_buffer view 

173 if key == 0: 

174 if self._readonly: 

175 raise ValueError("This _py_anon_pod1 instance is read-only") 

176 _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) 

177 try: 

178 if <size_t>view.len < sizeof(cuda_bindings_cufile__anon_pod1): 

179 raise ValueError( 

180 "source buffer too small: expected at least %d bytes, got %d" % (sizeof(cuda_bindings_cufile__anon_pod1), view.len) 

181 ) 

182 _cyb_memmove(<void*>self._ptr, view.buf, sizeof(cuda_bindings_cufile__anon_pod1)) 

183 self._readonly = view.readonly != 0 

184 finally: 

185 _cyb_PyBuffer_Release(&view) 

186 else: 

187 setattr(self, key, val) 

188  

189 @property 

190 def fd(self): 

191 """int: """ 

192 return self._ptr[0].fd 

193  

194 @fd.setter 

195 def fd(self, val): 

196 if self._readonly: 

197 raise ValueError("This _py_anon_pod1 instance is read-only") 

198 self._ptr[0].fd = val 

199  

200 @property 

201 def handle(self): 

202 """int: """ 

203 return <intptr_t>(self._ptr[0].handle) 

204  

205 @handle.setter 

206 def handle(self, val): 

207 if self._readonly: 

208 raise ValueError("This _py_anon_pod1 instance is read-only") 

209 self._ptr[0].handle = <void *><intptr_t>val 

210  

211 @staticmethod 

212 def from_buffer(buffer): 

213 """Create an _py_anon_pod1 instance with the memory from the given buffer.""" 

214 return _cyb_from_buffer(buffer, sizeof(cuda_bindings_cufile__anon_pod1), _py_anon_pod1) 

215  

216 @staticmethod 

217 def from_data(data): 

218 """Create an _py_anon_pod1 instance wrapping the given NumPy array. 

219  

220 Args: 

221 data (_numpy.ndarray): a single-element array of dtype `_py_anon_pod1_dtype` holding the data. 

222 """ 

223 return _cyb_from_data(data, "_py_anon_pod1_dtype", _py_anon_pod1_dtype, _py_anon_pod1) 

224  

225 @staticmethod 

226 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): 

227 """Create an _py_anon_pod1 instance wrapping the given pointer. 

228  

229 Args: 

230 ptr (intptr_t): pointer address as Python :class:`int` to the data. 

231 owner (object): The Python object that owns the pointer. If not provided, data will be copied. 

232 readonly (bool): whether the data is read-only (to the user). default is `False`. 

233 """ 

234 if ptr == 0: 

235 raise ValueError("ptr must not be null (0)") 

236 cdef _py_anon_pod1 obj = _py_anon_pod1.__new__(_py_anon_pod1) 

237 if owner is None: 

238 obj._ptr = <cuda_bindings_cufile__anon_pod1 *>_cyb_malloc(sizeof(cuda_bindings_cufile__anon_pod1)) 

239 if obj._ptr == NULL: 

240 raise MemoryError("Error allocating _py_anon_pod1") 

241 _cyb_memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(cuda_bindings_cufile__anon_pod1)) 

242 obj._owns_ptr = True 

243 obj._owner = None 

244 else: 

245 obj._ptr = <cuda_bindings_cufile__anon_pod1 *>ptr 

246 obj._owns_ptr = False 

247 obj._owner = owner 

248 obj._readonly = readonly 

249 return obj 

250  

251  

252cdef _get__py_anon_pod3_dtype_offsets(): 

253 cdef cuda_bindings_cufile__anon_pod3 pod 

254 return _numpy.dtype({ 

255 'names': ['dev_ptr_base', 'file_offset', 'dev_ptr_offset', 'size_'], 

256 'formats': [_numpy.intp, _numpy.int64, _numpy.int64, _numpy.uint64], 

257 'offsets': [ 

258 (<intptr_t>&(pod.devPtr_base)) - (<intptr_t>&pod), 

259 (<intptr_t>&(pod.file_offset)) - (<intptr_t>&pod), 

260 (<intptr_t>&(pod.devPtr_offset)) - (<intptr_t>&pod), 

261 (<intptr_t>&(pod.size)) - (<intptr_t>&pod), 

262 ], 

263 'itemsize': sizeof(cuda_bindings_cufile__anon_pod3), 

264 }) 

265  

266_py_anon_pod3_dtype = _get__py_anon_pod3_dtype_offsets() 

267  

268cdef class _py_anon_pod3: 

269 """Empty-initialize an instance of `cuda_bindings_cufile__anon_pod3`. 

270  

271  

272 .. seealso:: `cuda_bindings_cufile__anon_pod3` 

273 """ 

274 cdef: 

275 cuda_bindings_cufile__anon_pod3 *_ptr 

276 object _owner 

277 bint _owns_ptr 

278 bint _readonly 

279  

280 def __init__(self): 

281 self._ptr = <cuda_bindings_cufile__anon_pod3 *>_cyb_calloc(1, sizeof(cuda_bindings_cufile__anon_pod3)) 

282 if self._ptr == NULL: 

283 raise MemoryError("Error allocating _py_anon_pod3") 

284 self._owns_ptr = True 

285 self._owner = None 

286 self._readonly = False 

287  

288 def __dealloc__(self): 

289 cdef cuda_bindings_cufile__anon_pod3 *ptr 

290 if self._owns_ptr and self._ptr != NULL: 

291 ptr = self._ptr 

292 self._ptr = NULL 

293 _cyb_free(ptr) 

294  

295 def __repr__(self): 

296 return f"<{__name__}._py_anon_pod3 object at {hex(id(self))}>" 

297  

298 @property 

299 def ptr(self): 

300 """Get the pointer address to the data as Python :class:`int`.""" 

301 return <intptr_t>(self._ptr) 

302  

303 cdef intptr_t _get_ptr(self): 

304 return <intptr_t>(self._ptr) 

305  

306 def __int__(self): 

307 return <intptr_t>(self._ptr) 

308  

309 def __eq__(self, other): 

310 cdef _py_anon_pod3 other_ 

311 if not isinstance(other, _py_anon_pod3): 

312 return False 

313 other_ = other 

314 return (_cyb_memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(cuda_bindings_cufile__anon_pod3)) == 0) 

315  

316 def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): 

317 _cyb___getbuffer(self, buffer, <void *>self._ptr, sizeof(cuda_bindings_cufile__anon_pod3), self._readonly) 

318  

319 def __releasebuffer__(self, Py_buffer *buffer): 

320 pass 

321  

322 def __setitem__(self, key, val): 

323 cdef _cyb_Py_buffer view 

324 if key == 0: 

325 if self._readonly: 

326 raise ValueError("This _py_anon_pod3 instance is read-only") 

327 _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) 

328 try: 

329 if <size_t>view.len < sizeof(cuda_bindings_cufile__anon_pod3): 

330 raise ValueError( 

331 "source buffer too small: expected at least %d bytes, got %d" % (sizeof(cuda_bindings_cufile__anon_pod3), view.len) 

332 ) 

333 _cyb_memmove(<void*>self._ptr, view.buf, sizeof(cuda_bindings_cufile__anon_pod3)) 

334 self._readonly = view.readonly != 0 

335 finally: 

336 _cyb_PyBuffer_Release(&view) 

337 else: 

338 setattr(self, key, val) 

339  

340 @property 

341 def dev_ptr_base(self): 

342 """int: """ 

343 return <intptr_t>(self._ptr[0].devPtr_base) 

344  

345 @dev_ptr_base.setter 

346 def dev_ptr_base(self, val): 

347 if self._readonly: 

348 raise ValueError("This _py_anon_pod3 instance is read-only") 

349 self._ptr[0].devPtr_base = <void *><intptr_t>val 

350  

351 @property 

352 def file_offset(self): 

353 """int: """ 

354 return self._ptr[0].file_offset 

355  

356 @file_offset.setter 

357 def file_offset(self, val): 

358 if self._readonly: 

359 raise ValueError("This _py_anon_pod3 instance is read-only") 

360 self._ptr[0].file_offset = val 

361  

362 @property 

363 def dev_ptr_offset(self): 

364 """int: """ 

365 return self._ptr[0].devPtr_offset 

366  

367 @dev_ptr_offset.setter 

368 def dev_ptr_offset(self, val): 

369 if self._readonly: 

370 raise ValueError("This _py_anon_pod3 instance is read-only") 

371 self._ptr[0].devPtr_offset = val 

372  

373 @property 

374 def size_(self): 

375 """int: """ 

376 return self._ptr[0].size 

377  

378 @size_.setter 

379 def size_(self, val): 

380 if self._readonly: 

381 raise ValueError("This _py_anon_pod3 instance is read-only") 

382 self._ptr[0].size = val 

383  

384 @staticmethod 

385 def from_buffer(buffer): 

386 """Create an _py_anon_pod3 instance with the memory from the given buffer.""" 

387 return _cyb_from_buffer(buffer, sizeof(cuda_bindings_cufile__anon_pod3), _py_anon_pod3) 

388  

389 @staticmethod 

390 def from_data(data): 

391 """Create an _py_anon_pod3 instance wrapping the given NumPy array. 

392  

393 Args: 

394 data (_numpy.ndarray): a single-element array of dtype `_py_anon_pod3_dtype` holding the data. 

395 """ 

396 return _cyb_from_data(data, "_py_anon_pod3_dtype", _py_anon_pod3_dtype, _py_anon_pod3) 

397  

398 @staticmethod 

399 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): 

400 """Create an _py_anon_pod3 instance wrapping the given pointer. 

401  

402 Args: 

403 ptr (intptr_t): pointer address as Python :class:`int` to the data. 

404 owner (object): The Python object that owns the pointer. If not provided, data will be copied. 

405 readonly (bool): whether the data is read-only (to the user). default is `False`. 

406 """ 

407 if ptr == 0: 

408 raise ValueError("ptr must not be null (0)") 

409 cdef _py_anon_pod3 obj = _py_anon_pod3.__new__(_py_anon_pod3) 

410 if owner is None: 

411 obj._ptr = <cuda_bindings_cufile__anon_pod3 *>_cyb_malloc(sizeof(cuda_bindings_cufile__anon_pod3)) 

412 if obj._ptr == NULL: 

413 raise MemoryError("Error allocating _py_anon_pod3") 

414 _cyb_memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(cuda_bindings_cufile__anon_pod3)) 

415 obj._owns_ptr = True 

416 obj._owner = None 

417 else: 

418 obj._ptr = <cuda_bindings_cufile__anon_pod3 *>ptr 

419 obj._owns_ptr = False 

420 obj._owner = owner 

421 obj._readonly = readonly 

422 return obj 

423  

424  

425cdef _get_io_events_dtype_offsets(): 

426 cdef CUfileIOEvents_t pod 

427 return _numpy.dtype({ 

428 'names': ['cookie', 'status', 'ret'], 

429 'formats': [_numpy.intp, _numpy.int32, _numpy.uint64], 

430 'offsets': [ 

431 (<intptr_t>&(pod.cookie)) - (<intptr_t>&pod), 

432 (<intptr_t>&(pod.status)) - (<intptr_t>&pod), 

433 (<intptr_t>&(pod.ret)) - (<intptr_t>&pod), 

434 ], 

435 'itemsize': sizeof(CUfileIOEvents_t), 

436 }) 

437  

438io_events_dtype = _get_io_events_dtype_offsets() 

439cdef object io_events_dtype_record = _numpy.dtype((_numpy.record, io_events_dtype)) 

440  

441cdef class IOEvents: 

442 """Empty-initialize an array of `CUfileIOEvents_t`. 

443 The resulting object is of length `size` and of dtype `io_events_dtype`. 

444 If default-constructed, the instance represents a single struct. 

445  

446 Args: 

447 size (int): number of structs, default=1. 

448  

449 .. seealso:: `CUfileIOEvents_t` 

450 """ 

451 cdef: 

452 readonly object _data 

453 object _owner 

454  

455 def __init__(self, size=1): 

456 self._data = _numpy.zeros(size, dtype=io_events_dtype_record) 1hjik

457 assert self._data.itemsize == sizeof(CUfileIOEvents_t), \ 1hjik

458 f"itemsize {self._data.itemsize} mismatches struct size { sizeof(CUfileIOEvents_t) }" 

459  

460 def __repr__(self): 

461 if self._data.size > 1: 

462 return f"<{__name__}.IOEvents_Array_{self._data.size} object at {hex(id(self))}>" 

463 else: 

464 return f"<{__name__}.IOEvents object at {hex(id(self))}>" 

465  

466 @property 

467 def ptr(self): 

468 """Get the pointer address to the data as Python :class:`int`.""" 

469 return _cyb_array_ptr(self._data) 1hjik

470  

471 cdef intptr_t _get_ptr(self): 

472 return _cyb_array_ptr(self._data) 

473  

474 def __int__(self): 

475 if self._data.size > 1 and not self._data.flags["C_CONTIGUOUS"]: 

476 raise TypeError("int() argument must be a bytes-like object of size 1, or a " 

477 "C-contiguous array. To get the pointer address of a " 

478 "non-contiguous array, use .ptr") 

479 return _cyb_array_ptr(self._data) 

480  

481 def __len__(self): 

482 return self._data.size 

483  

484 def __eq__(self, other): 

485 cdef object self_data = self._data 

486 if (not isinstance(other, IOEvents)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype: 

487 return False 

488 return bool((self_data == other._data).all()) 

489  

490 def __getbuffer__(self, Py_buffer *buffer, int flags): 

491 _cyb_cpython.PyObject_GetBuffer(self._data, buffer, flags) 

492  

493 def __releasebuffer__(self, Py_buffer *buffer): 

494 _cyb_cpython.PyBuffer_Release(buffer) 

495  

496 @property 

497 def cookie(self): 

498 """Union[~_numpy.intp, int]: """ 

499 if self._data.size == 1: 1hjik

500 return int(self._data["cookie"][0]) 1hjik

501 return self._data["cookie"] 

502  

503 @cookie.setter 

504 def cookie(self, val): 

505 if not self._data.flags.writeable: 

506 raise ValueError("This IOEvents instance is read-only") 

507 self._data["cookie"] = val 

508  

509 @property 

510 def status(self): 

511 """Union[~_numpy.int32, int]: """ 

512 if self._data.size == 1: 1hjik

513 return int(self._data["status"][0]) 1hjik

514 return self._data["status"] 

515  

516 @status.setter 

517 def status(self, val): 

518 if not self._data.flags.writeable: 

519 raise ValueError("This IOEvents instance is read-only") 

520 self._data["status"] = val 

521  

522 @property 

523 def ret(self): 

524 """Union[~_numpy.uint64, int]: """ 

525 if self._data.size == 1: 1hi

526 return int(self._data["ret"][0]) 1hi

527 return self._data["ret"] 

528  

529 @ret.setter 

530 def ret(self, val): 

531 if not self._data.flags.writeable: 

532 raise ValueError("This IOEvents instance is read-only") 

533 self._data["ret"] = val 

534  

535 def __getitem__(self, key): 

536 cdef ssize_t key_ 

537 cdef ssize_t size 

538 cdef IOEvents obj 

539 if isinstance(key, int): 1hjik

540 key_ = key 1hjik

541 size = self._data.size 1hjik

542 if key_ >= size or key_ <= -(size+1): 1hjik

543 raise IndexError("index is out of bounds") 

544 if key_ < 0: 1hjik

545 key_ += size 

546 obj = IOEvents.__new__(IOEvents) 1hjik

547 obj._data = self._data[key_:key_+1] 1hjik

548 obj._owner = self._owner 1hjik

549 return obj 1hjik

550 out = self._data[key] 

551 if isinstance(out, _numpy.ndarray): 

552 if out.dtype == io_events_dtype: 

553 obj = IOEvents.from_data(out) 

554 obj._owner = self._owner 

555 return obj 

556 if out.dtype.names is not None: 

557 return out.view(_numpy.recarray) 

558 return out 

559  

560 def __setitem__(self, key, val): 

561 self._data[key] = val 

562  

563 @staticmethod 

564 def from_buffer(buffer): 

565 """Create an IOEvents instance with the memory from the given buffer.""" 

566 return IOEvents.from_data(_numpy.frombuffer(buffer, dtype=io_events_dtype)) 

567  

568 @staticmethod 

569 def from_data(data): 

570 """Create an IOEvents instance wrapping the given NumPy array. 

571  

572 Args: 

573 data (_numpy.ndarray): a 1D array of dtype `io_events_dtype` holding the data. 

574 """ 

575 cdef IOEvents obj = IOEvents.__new__(IOEvents) 

576 if not isinstance(data, _numpy.ndarray): 

577 raise TypeError("data argument must be a NumPy ndarray") 

578 if data.ndim != 1: 

579 raise ValueError("data array must be 1D") 

580 if data.dtype != io_events_dtype: 

581 raise ValueError("data array must be of dtype io_events_dtype") 

582 obj._data = data.view(dtype=io_events_dtype_record, type=_numpy.ndarray) 

583 return obj 

584  

585 @staticmethod 

586 def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False, object owner=None): 

587 """Create an IOEvents instance wrapping the given pointer. 

588  

589 Args: 

590 ptr (intptr_t): pointer address as Python :class:`int` to the data. 

591 size (int): number of structs, default=1. 

592 readonly (bool): whether the data is read-only (to the user). default is `False`. 

593 owner (object): object that owns the memory at *ptr*. A strong reference is 

594 kept so the backing storage outlives this wrapper. 

595 """ 

596 if ptr == 0: 

597 raise ValueError("ptr must not be null (0)") 

598 cdef IOEvents obj = IOEvents.__new__(IOEvents) 

599 cdef flag = _cyb_cpython_buffer.PyBUF_READ if readonly else _cyb_cpython_buffer.PyBUF_WRITE 

600 cdef object buf = _cyb_cpython_memoryview.PyMemoryView_FromMemory( 

601 <char*>ptr, sizeof(CUfileIOEvents_t) * size, flag) 

602 obj._data = _numpy.ndarray(size, buffer=buf, dtype=io_events_dtype_record) 

603 obj._owner = owner 

604 return obj 

605  

606  

607cdef _get_op_counter_dtype_offsets(): 

608 cdef CUfileOpCounter_t pod 

609 return _numpy.dtype({ 

610 'names': ['ok', 'err'], 

611 'formats': [_numpy.uint64, _numpy.uint64], 

612 'offsets': [ 

613 (<intptr_t>&(pod.ok)) - (<intptr_t>&pod), 

614 (<intptr_t>&(pod.err)) - (<intptr_t>&pod), 

615 ], 

616 'itemsize': sizeof(CUfileOpCounter_t), 

617 }) 

618  

619op_counter_dtype = _get_op_counter_dtype_offsets() 

620  

621cdef class OpCounter: 

622 """Empty-initialize an instance of `CUfileOpCounter_t`. 

623  

624  

625 .. seealso:: `CUfileOpCounter_t` 

626 """ 

627 cdef: 

628 CUfileOpCounter_t *_ptr 

629 object _owner 

630 bint _owns_ptr 

631 bint _readonly 

632  

633 def __init__(self): 

634 self._ptr = <CUfileOpCounter_t *>_cyb_calloc(1, sizeof(CUfileOpCounter_t)) 

635 if self._ptr == NULL: 

636 raise MemoryError("Error allocating OpCounter") 

637 self._owns_ptr = True 

638 self._owner = None 

639 self._readonly = False 

640  

641 def __dealloc__(self): 

642 cdef CUfileOpCounter_t *ptr 

643 if self._owns_ptr and self._ptr != NULL: 1fbgc

644 ptr = self._ptr 

645 self._ptr = NULL 

646 _cyb_free(ptr) 

647  

648 def __repr__(self): 

649 return f"<{__name__}.OpCounter object at {hex(id(self))}>" 

650  

651 @property 

652 def ptr(self): 

653 """Get the pointer address to the data as Python :class:`int`.""" 

654 return <intptr_t>(self._ptr) 

655  

656 cdef intptr_t _get_ptr(self): 

657 return <intptr_t>(self._ptr) 

658  

659 def __int__(self): 

660 return <intptr_t>(self._ptr) 

661  

662 def __eq__(self, other): 

663 cdef OpCounter other_ 

664 if not isinstance(other, OpCounter): 

665 return False 

666 other_ = other 

667 return (_cyb_memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(CUfileOpCounter_t)) == 0) 

668  

669 def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): 

670 _cyb___getbuffer(self, buffer, <void *>self._ptr, sizeof(CUfileOpCounter_t), self._readonly) 

671  

672 def __releasebuffer__(self, Py_buffer *buffer): 

673 pass 

674  

675 def __setitem__(self, key, val): 

676 cdef _cyb_Py_buffer view 

677 if key == 0: 

678 if self._readonly: 

679 raise ValueError("This OpCounter instance is read-only") 

680 _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) 

681 try: 

682 if <size_t>view.len < sizeof(CUfileOpCounter_t): 

683 raise ValueError( 

684 "source buffer too small: expected at least %d bytes, got %d" % (sizeof(CUfileOpCounter_t), view.len) 

685 ) 

686 _cyb_memmove(<void*>self._ptr, view.buf, sizeof(CUfileOpCounter_t)) 

687 self._readonly = view.readonly != 0 

688 finally: 

689 _cyb_PyBuffer_Release(&view) 

690 else: 

691 setattr(self, key, val) 

692  

693 @property 

694 def ok(self): 

695 """int: """ 

696 return self._ptr[0].ok 1fbgc

697  

698 @ok.setter 

699 def ok(self, val): 

700 if self._readonly: 

701 raise ValueError("This OpCounter instance is read-only") 

702 self._ptr[0].ok = val 

703  

704 @property 

705 def err(self): 

706 """int: """ 

707 return self._ptr[0].err 

708  

709 @err.setter 

710 def err(self, val): 

711 if self._readonly: 

712 raise ValueError("This OpCounter instance is read-only") 

713 self._ptr[0].err = val 

714  

715 @staticmethod 

716 def from_buffer(buffer): 

717 """Create an OpCounter instance with the memory from the given buffer.""" 

718 return _cyb_from_buffer(buffer, sizeof(CUfileOpCounter_t), OpCounter) 

719  

720 @staticmethod 

721 def from_data(data): 

722 """Create an OpCounter instance wrapping the given NumPy array. 

723  

724 Args: 

725 data (_numpy.ndarray): a single-element array of dtype `op_counter_dtype` holding the data. 

726 """ 

727 return _cyb_from_data(data, "op_counter_dtype", op_counter_dtype, OpCounter) 1fbgc

728  

729 @staticmethod 

730 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): 

731 """Create an OpCounter instance wrapping the given pointer. 

732  

733 Args: 

734 ptr (intptr_t): pointer address as Python :class:`int` to the data. 

735 owner (object): The Python object that owns the pointer. If not provided, data will be copied. 

736 readonly (bool): whether the data is read-only (to the user). default is `False`. 

737 """ 

738 if ptr == 0: 1fbgc

739 raise ValueError("ptr must not be null (0)") 

740 cdef OpCounter obj = OpCounter.__new__(OpCounter) 1fbgc

741 if owner is None: 1fbgc

742 obj._ptr = <CUfileOpCounter_t *>_cyb_malloc(sizeof(CUfileOpCounter_t)) 

743 if obj._ptr == NULL: 

744 raise MemoryError("Error allocating OpCounter") 

745 _cyb_memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(CUfileOpCounter_t)) 

746 obj._owns_ptr = True 

747 obj._owner = None 

748 else: 

749 obj._ptr = <CUfileOpCounter_t *>ptr 1fbgc

750 obj._owns_ptr = False 1fbgc

751 obj._owner = owner 1fbgc

752 obj._readonly = readonly 1fbgc

753 return obj 1fbgc

754  

755  

756cdef _get_per_gpu_stats_dtype_offsets(): 

757 cdef CUfilePerGpuStats_t pod 

758 return _numpy.dtype({ 

759 'names': ['uuid', 'read_bytes', 'read_bw_bytes_per_sec', 'read_utilization', 'read_duration_us', 'n_total_reads', 'n_p2p_reads', 'n_nvfs_reads', 'n_posix_reads', 'n_unaligned_reads', 'n_dr_reads', 'n_sparse_regions', 'n_inline_regions', 'n_reads_err', 'writes_bytes', 'write_bw_bytes_per_sec', 'write_utilization', 'write_duration_us', 'n_total_writes', 'n_p2p_writes', 'n_nvfs_writes', 'n_posix_writes', 'n_unaligned_writes', 'n_dr_writes', 'n_writes_err', 'n_mmap', 'n_mmap_ok', 'n_mmap_err', 'n_mmap_free', 'reg_bytes'], 

760 'formats': [(_numpy.int8, 16), _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64], 

761 'offsets': [ 

762 (<intptr_t>&(pod.uuid)) - (<intptr_t>&pod), 

763 (<intptr_t>&(pod.read_bytes)) - (<intptr_t>&pod), 

764 (<intptr_t>&(pod.read_bw_bytes_per_sec)) - (<intptr_t>&pod), 

765 (<intptr_t>&(pod.read_utilization)) - (<intptr_t>&pod), 

766 (<intptr_t>&(pod.read_duration_us)) - (<intptr_t>&pod), 

767 (<intptr_t>&(pod.n_total_reads)) - (<intptr_t>&pod), 

768 (<intptr_t>&(pod.n_p2p_reads)) - (<intptr_t>&pod), 

769 (<intptr_t>&(pod.n_nvfs_reads)) - (<intptr_t>&pod), 

770 (<intptr_t>&(pod.n_posix_reads)) - (<intptr_t>&pod), 

771 (<intptr_t>&(pod.n_unaligned_reads)) - (<intptr_t>&pod), 

772 (<intptr_t>&(pod.n_dr_reads)) - (<intptr_t>&pod), 

773 (<intptr_t>&(pod.n_sparse_regions)) - (<intptr_t>&pod), 

774 (<intptr_t>&(pod.n_inline_regions)) - (<intptr_t>&pod), 

775 (<intptr_t>&(pod.n_reads_err)) - (<intptr_t>&pod), 

776 (<intptr_t>&(pod.writes_bytes)) - (<intptr_t>&pod), 

777 (<intptr_t>&(pod.write_bw_bytes_per_sec)) - (<intptr_t>&pod), 

778 (<intptr_t>&(pod.write_utilization)) - (<intptr_t>&pod), 

779 (<intptr_t>&(pod.write_duration_us)) - (<intptr_t>&pod), 

780 (<intptr_t>&(pod.n_total_writes)) - (<intptr_t>&pod), 

781 (<intptr_t>&(pod.n_p2p_writes)) - (<intptr_t>&pod), 

782 (<intptr_t>&(pod.n_nvfs_writes)) - (<intptr_t>&pod), 

783 (<intptr_t>&(pod.n_posix_writes)) - (<intptr_t>&pod), 

784 (<intptr_t>&(pod.n_unaligned_writes)) - (<intptr_t>&pod), 

785 (<intptr_t>&(pod.n_dr_writes)) - (<intptr_t>&pod), 

786 (<intptr_t>&(pod.n_writes_err)) - (<intptr_t>&pod), 

787 (<intptr_t>&(pod.n_mmap)) - (<intptr_t>&pod), 

788 (<intptr_t>&(pod.n_mmap_ok)) - (<intptr_t>&pod), 

789 (<intptr_t>&(pod.n_mmap_err)) - (<intptr_t>&pod), 

790 (<intptr_t>&(pod.n_mmap_free)) - (<intptr_t>&pod), 

791 (<intptr_t>&(pod.reg_bytes)) - (<intptr_t>&pod), 

792 ], 

793 'itemsize': sizeof(CUfilePerGpuStats_t), 

794 }) 

795  

796per_gpu_stats_dtype = _get_per_gpu_stats_dtype_offsets() 

797cdef object per_gpu_stats_dtype_record = _numpy.dtype((_numpy.record, per_gpu_stats_dtype)) 

798  

799cdef class PerGpuStats: 

800 """Empty-initialize an array of `CUfilePerGpuStats_t`. 

801 The resulting object is of length `size` and of dtype `per_gpu_stats_dtype`. 

802 If default-constructed, the instance represents a single struct. 

803  

804 Args: 

805 size (int): number of structs, default=1. 

806  

807 .. seealso:: `CUfilePerGpuStats_t` 

808 """ 

809 cdef: 

810 readonly object _data 

811 object _owner 

812  

813 def __init__(self, size=1): 

814 self._data = _numpy.zeros(size, dtype=per_gpu_stats_dtype_record) 

815 assert self._data.itemsize == sizeof(CUfilePerGpuStats_t), \ 

816 f"itemsize {self._data.itemsize} mismatches struct size { sizeof(CUfilePerGpuStats_t) }" 

817  

818 def __repr__(self): 

819 if self._data.size > 1: 

820 return f"<{__name__}.PerGpuStats_Array_{self._data.size} object at {hex(id(self))}>" 

821 else: 

822 return f"<{__name__}.PerGpuStats object at {hex(id(self))}>" 

823  

824 @property 

825 def ptr(self): 

826 """Get the pointer address to the data as Python :class:`int`.""" 

827 return _cyb_array_ptr(self._data) 

828  

829 cdef intptr_t _get_ptr(self): 

830 return _cyb_array_ptr(self._data) 

831  

832 def __int__(self): 

833 if self._data.size > 1 and not self._data.flags["C_CONTIGUOUS"]: 

834 raise TypeError("int() argument must be a bytes-like object of size 1, or a " 

835 "C-contiguous array. To get the pointer address of a " 

836 "non-contiguous array, use .ptr") 

837 return _cyb_array_ptr(self._data) 

838  

839 def __len__(self): 

840 return self._data.size 

841  

842 def __eq__(self, other): 

843 cdef object self_data = self._data 

844 if (not isinstance(other, PerGpuStats)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype: 

845 return False 

846 return bool((self_data == other._data).all()) 

847  

848 def __getbuffer__(self, Py_buffer *buffer, int flags): 

849 _cyb_cpython.PyObject_GetBuffer(self._data, buffer, flags) 

850  

851 def __releasebuffer__(self, Py_buffer *buffer): 

852 _cyb_cpython.PyBuffer_Release(buffer) 

853  

854 @property 

855 def uuid(self): 

856 """~_numpy.int8: (array of length 16).""" 

857 return self._data["uuid"] 

858  

859 @uuid.setter 

860 def uuid(self, val): 

861 if not self._data.flags.writeable: 

862 raise ValueError("This PerGpuStats instance is read-only") 

863 self._data["uuid"] = val 

864  

865 @property 

866 def read_bytes(self): 

867 """Union[~_numpy.uint64, int]: """ 

868 if self._data.size == 1: 

869 return int(self._data["read_bytes"][0]) 

870 return self._data["read_bytes"] 

871  

872 @read_bytes.setter 

873 def read_bytes(self, val): 

874 if not self._data.flags.writeable: 

875 raise ValueError("This PerGpuStats instance is read-only") 

876 self._data["read_bytes"] = val 

877  

878 @property 

879 def read_bw_bytes_per_sec(self): 

880 """Union[~_numpy.uint64, int]: """ 

881 if self._data.size == 1: 

882 return int(self._data["read_bw_bytes_per_sec"][0]) 

883 return self._data["read_bw_bytes_per_sec"] 

884  

885 @read_bw_bytes_per_sec.setter 

886 def read_bw_bytes_per_sec(self, val): 

887 if not self._data.flags.writeable: 

888 raise ValueError("This PerGpuStats instance is read-only") 

889 self._data["read_bw_bytes_per_sec"] = val 

890  

891 @property 

892 def read_utilization(self): 

893 """Union[~_numpy.uint64, int]: """ 

894 if self._data.size == 1: 

895 return int(self._data["read_utilization"][0]) 

896 return self._data["read_utilization"] 

897  

898 @read_utilization.setter 

899 def read_utilization(self, val): 

900 if not self._data.flags.writeable: 

901 raise ValueError("This PerGpuStats instance is read-only") 

902 self._data["read_utilization"] = val 

903  

904 @property 

905 def read_duration_us(self): 

906 """Union[~_numpy.uint64, int]: """ 

907 if self._data.size == 1: 

908 return int(self._data["read_duration_us"][0]) 

909 return self._data["read_duration_us"] 

910  

911 @read_duration_us.setter 

912 def read_duration_us(self, val): 

913 if not self._data.flags.writeable: 

914 raise ValueError("This PerGpuStats instance is read-only") 

915 self._data["read_duration_us"] = val 

916  

917 @property 

918 def n_total_reads(self): 

919 """Union[~_numpy.uint64, int]: """ 

920 if self._data.size == 1: 1de

921 return int(self._data["n_total_reads"][0]) 1de

922 return self._data["n_total_reads"] 

923  

924 @n_total_reads.setter 

925 def n_total_reads(self, val): 

926 if not self._data.flags.writeable: 

927 raise ValueError("This PerGpuStats instance is read-only") 

928 self._data["n_total_reads"] = val 

929  

930 @property 

931 def n_p2p_reads(self): 

932 """Union[~_numpy.uint64, int]: """ 

933 if self._data.size == 1: 

934 return int(self._data["n_p2p_reads"][0]) 

935 return self._data["n_p2p_reads"] 

936  

937 @n_p2p_reads.setter 

938 def n_p2p_reads(self, val): 

939 if not self._data.flags.writeable: 

940 raise ValueError("This PerGpuStats instance is read-only") 

941 self._data["n_p2p_reads"] = val 

942  

943 @property 

944 def n_nvfs_reads(self): 

945 """Union[~_numpy.uint64, int]: """ 

946 if self._data.size == 1: 

947 return int(self._data["n_nvfs_reads"][0]) 

948 return self._data["n_nvfs_reads"] 

949  

950 @n_nvfs_reads.setter 

951 def n_nvfs_reads(self, val): 

952 if not self._data.flags.writeable: 

953 raise ValueError("This PerGpuStats instance is read-only") 

954 self._data["n_nvfs_reads"] = val 

955  

956 @property 

957 def n_posix_reads(self): 

958 """Union[~_numpy.uint64, int]: """ 

959 if self._data.size == 1: 

960 return int(self._data["n_posix_reads"][0]) 

961 return self._data["n_posix_reads"] 

962  

963 @n_posix_reads.setter 

964 def n_posix_reads(self, val): 

965 if not self._data.flags.writeable: 

966 raise ValueError("This PerGpuStats instance is read-only") 

967 self._data["n_posix_reads"] = val 

968  

969 @property 

970 def n_unaligned_reads(self): 

971 """Union[~_numpy.uint64, int]: """ 

972 if self._data.size == 1: 

973 return int(self._data["n_unaligned_reads"][0]) 

974 return self._data["n_unaligned_reads"] 

975  

976 @n_unaligned_reads.setter 

977 def n_unaligned_reads(self, val): 

978 if not self._data.flags.writeable: 

979 raise ValueError("This PerGpuStats instance is read-only") 

980 self._data["n_unaligned_reads"] = val 

981  

982 @property 

983 def n_dr_reads(self): 

984 """Union[~_numpy.uint64, int]: """ 

985 if self._data.size == 1: 

986 return int(self._data["n_dr_reads"][0]) 

987 return self._data["n_dr_reads"] 

988  

989 @n_dr_reads.setter 

990 def n_dr_reads(self, val): 

991 if not self._data.flags.writeable: 

992 raise ValueError("This PerGpuStats instance is read-only") 

993 self._data["n_dr_reads"] = val 

994  

995 @property 

996 def n_sparse_regions(self): 

997 """Union[~_numpy.uint64, int]: """ 

998 if self._data.size == 1: 

999 return int(self._data["n_sparse_regions"][0]) 

1000 return self._data["n_sparse_regions"] 

1001  

1002 @n_sparse_regions.setter 

1003 def n_sparse_regions(self, val): 

1004 if not self._data.flags.writeable: 

1005 raise ValueError("This PerGpuStats instance is read-only") 

1006 self._data["n_sparse_regions"] = val 

1007  

1008 @property 

1009 def n_inline_regions(self): 

1010 """Union[~_numpy.uint64, int]: """ 

1011 if self._data.size == 1: 

1012 return int(self._data["n_inline_regions"][0]) 

1013 return self._data["n_inline_regions"] 

1014  

1015 @n_inline_regions.setter 

1016 def n_inline_regions(self, val): 

1017 if not self._data.flags.writeable: 

1018 raise ValueError("This PerGpuStats instance is read-only") 

1019 self._data["n_inline_regions"] = val 

1020  

1021 @property 

1022 def n_reads_err(self): 

1023 """Union[~_numpy.uint64, int]: """ 

1024 if self._data.size == 1: 

1025 return int(self._data["n_reads_err"][0]) 

1026 return self._data["n_reads_err"] 

1027  

1028 @n_reads_err.setter 

1029 def n_reads_err(self, val): 

1030 if not self._data.flags.writeable: 

1031 raise ValueError("This PerGpuStats instance is read-only") 

1032 self._data["n_reads_err"] = val 

1033  

1034 @property 

1035 def writes_bytes(self): 

1036 """Union[~_numpy.uint64, int]: """ 

1037 if self._data.size == 1: 

1038 return int(self._data["writes_bytes"][0]) 

1039 return self._data["writes_bytes"] 

1040  

1041 @writes_bytes.setter 

1042 def writes_bytes(self, val): 

1043 if not self._data.flags.writeable: 

1044 raise ValueError("This PerGpuStats instance is read-only") 

1045 self._data["writes_bytes"] = val 

1046  

1047 @property 

1048 def write_bw_bytes_per_sec(self): 

1049 """Union[~_numpy.uint64, int]: """ 

1050 if self._data.size == 1: 

1051 return int(self._data["write_bw_bytes_per_sec"][0]) 

1052 return self._data["write_bw_bytes_per_sec"] 

1053  

1054 @write_bw_bytes_per_sec.setter 

1055 def write_bw_bytes_per_sec(self, val): 

1056 if not self._data.flags.writeable: 

1057 raise ValueError("This PerGpuStats instance is read-only") 

1058 self._data["write_bw_bytes_per_sec"] = val 

1059  

1060 @property 

1061 def write_utilization(self): 

1062 """Union[~_numpy.uint64, int]: """ 

1063 if self._data.size == 1: 

1064 return int(self._data["write_utilization"][0]) 

1065 return self._data["write_utilization"] 

1066  

1067 @write_utilization.setter 

1068 def write_utilization(self, val): 

1069 if not self._data.flags.writeable: 

1070 raise ValueError("This PerGpuStats instance is read-only") 

1071 self._data["write_utilization"] = val 

1072  

1073 @property 

1074 def write_duration_us(self): 

1075 """Union[~_numpy.uint64, int]: """ 

1076 if self._data.size == 1: 

1077 return int(self._data["write_duration_us"][0]) 

1078 return self._data["write_duration_us"] 

1079  

1080 @write_duration_us.setter 

1081 def write_duration_us(self, val): 

1082 if not self._data.flags.writeable: 

1083 raise ValueError("This PerGpuStats instance is read-only") 

1084 self._data["write_duration_us"] = val 

1085  

1086 @property 

1087 def n_total_writes(self): 

1088 """Union[~_numpy.uint64, int]: """ 

1089 if self._data.size == 1: 

1090 return int(self._data["n_total_writes"][0]) 

1091 return self._data["n_total_writes"] 

1092  

1093 @n_total_writes.setter 

1094 def n_total_writes(self, val): 

1095 if not self._data.flags.writeable: 

1096 raise ValueError("This PerGpuStats instance is read-only") 

1097 self._data["n_total_writes"] = val 

1098  

1099 @property 

1100 def n_p2p_writes(self): 

1101 """Union[~_numpy.uint64, int]: """ 

1102 if self._data.size == 1: 

1103 return int(self._data["n_p2p_writes"][0]) 

1104 return self._data["n_p2p_writes"] 

1105  

1106 @n_p2p_writes.setter 

1107 def n_p2p_writes(self, val): 

1108 if not self._data.flags.writeable: 

1109 raise ValueError("This PerGpuStats instance is read-only") 

1110 self._data["n_p2p_writes"] = val 

1111  

1112 @property 

1113 def n_nvfs_writes(self): 

1114 """Union[~_numpy.uint64, int]: """ 

1115 if self._data.size == 1: 

1116 return int(self._data["n_nvfs_writes"][0]) 

1117 return self._data["n_nvfs_writes"] 

1118  

1119 @n_nvfs_writes.setter 

1120 def n_nvfs_writes(self, val): 

1121 if not self._data.flags.writeable: 

1122 raise ValueError("This PerGpuStats instance is read-only") 

1123 self._data["n_nvfs_writes"] = val 

1124  

1125 @property 

1126 def n_posix_writes(self): 

1127 """Union[~_numpy.uint64, int]: """ 

1128 if self._data.size == 1: 

1129 return int(self._data["n_posix_writes"][0]) 

1130 return self._data["n_posix_writes"] 

1131  

1132 @n_posix_writes.setter 

1133 def n_posix_writes(self, val): 

1134 if not self._data.flags.writeable: 

1135 raise ValueError("This PerGpuStats instance is read-only") 

1136 self._data["n_posix_writes"] = val 

1137  

1138 @property 

1139 def n_unaligned_writes(self): 

1140 """Union[~_numpy.uint64, int]: """ 

1141 if self._data.size == 1: 

1142 return int(self._data["n_unaligned_writes"][0]) 

1143 return self._data["n_unaligned_writes"] 

1144  

1145 @n_unaligned_writes.setter 

1146 def n_unaligned_writes(self, val): 

1147 if not self._data.flags.writeable: 

1148 raise ValueError("This PerGpuStats instance is read-only") 

1149 self._data["n_unaligned_writes"] = val 

1150  

1151 @property 

1152 def n_dr_writes(self): 

1153 """Union[~_numpy.uint64, int]: """ 

1154 if self._data.size == 1: 

1155 return int(self._data["n_dr_writes"][0]) 

1156 return self._data["n_dr_writes"] 

1157  

1158 @n_dr_writes.setter 

1159 def n_dr_writes(self, val): 

1160 if not self._data.flags.writeable: 

1161 raise ValueError("This PerGpuStats instance is read-only") 

1162 self._data["n_dr_writes"] = val 

1163  

1164 @property 

1165 def n_writes_err(self): 

1166 """Union[~_numpy.uint64, int]: """ 

1167 if self._data.size == 1: 

1168 return int(self._data["n_writes_err"][0]) 

1169 return self._data["n_writes_err"] 

1170  

1171 @n_writes_err.setter 

1172 def n_writes_err(self, val): 

1173 if not self._data.flags.writeable: 

1174 raise ValueError("This PerGpuStats instance is read-only") 

1175 self._data["n_writes_err"] = val 

1176  

1177 @property 

1178 def n_mmap(self): 

1179 """Union[~_numpy.uint64, int]: """ 

1180 if self._data.size == 1: 

1181 return int(self._data["n_mmap"][0]) 

1182 return self._data["n_mmap"] 

1183  

1184 @n_mmap.setter 

1185 def n_mmap(self, val): 

1186 if not self._data.flags.writeable: 

1187 raise ValueError("This PerGpuStats instance is read-only") 

1188 self._data["n_mmap"] = val 

1189  

1190 @property 

1191 def n_mmap_ok(self): 

1192 """Union[~_numpy.uint64, int]: """ 

1193 if self._data.size == 1: 

1194 return int(self._data["n_mmap_ok"][0]) 

1195 return self._data["n_mmap_ok"] 

1196  

1197 @n_mmap_ok.setter 

1198 def n_mmap_ok(self, val): 

1199 if not self._data.flags.writeable: 

1200 raise ValueError("This PerGpuStats instance is read-only") 

1201 self._data["n_mmap_ok"] = val 

1202  

1203 @property 

1204 def n_mmap_err(self): 

1205 """Union[~_numpy.uint64, int]: """ 

1206 if self._data.size == 1: 

1207 return int(self._data["n_mmap_err"][0]) 

1208 return self._data["n_mmap_err"] 

1209  

1210 @n_mmap_err.setter 

1211 def n_mmap_err(self, val): 

1212 if not self._data.flags.writeable: 

1213 raise ValueError("This PerGpuStats instance is read-only") 

1214 self._data["n_mmap_err"] = val 

1215  

1216 @property 

1217 def n_mmap_free(self): 

1218 """Union[~_numpy.uint64, int]: """ 

1219 if self._data.size == 1: 

1220 return int(self._data["n_mmap_free"][0]) 

1221 return self._data["n_mmap_free"] 

1222  

1223 @n_mmap_free.setter 

1224 def n_mmap_free(self, val): 

1225 if not self._data.flags.writeable: 

1226 raise ValueError("This PerGpuStats instance is read-only") 

1227 self._data["n_mmap_free"] = val 

1228  

1229 @property 

1230 def reg_bytes(self): 

1231 """Union[~_numpy.uint64, int]: """ 

1232 if self._data.size == 1: 

1233 return int(self._data["reg_bytes"][0]) 

1234 return self._data["reg_bytes"] 

1235  

1236 @reg_bytes.setter 

1237 def reg_bytes(self, val): 

1238 if not self._data.flags.writeable: 

1239 raise ValueError("This PerGpuStats instance is read-only") 

1240 self._data["reg_bytes"] = val 

1241  

1242 def __getitem__(self, key): 

1243 cdef ssize_t key_ 

1244 cdef ssize_t size 

1245 cdef PerGpuStats obj 

1246 if isinstance(key, int): 1de

1247 key_ = key 1de

1248 size = self._data.size 1de

1249 if key_ >= size or key_ <= -(size+1): 1de

1250 raise IndexError("index is out of bounds") 

1251 if key_ < 0: 1de

1252 key_ += size 

1253 obj = PerGpuStats.__new__(PerGpuStats) 1de

1254 obj._data = self._data[key_:key_+1] 1de

1255 obj._owner = self._owner 1de

1256 return obj 1de

1257 out = self._data[key] 

1258 if isinstance(out, _numpy.ndarray): 

1259 if out.dtype == per_gpu_stats_dtype: 

1260 obj = PerGpuStats.from_data(out) 

1261 obj._owner = self._owner 

1262 return obj 

1263 if out.dtype.names is not None: 

1264 return out.view(_numpy.recarray) 

1265 return out 

1266  

1267 def __setitem__(self, key, val): 

1268 self._data[key] = val 

1269  

1270 @staticmethod 

1271 def from_buffer(buffer): 

1272 """Create an PerGpuStats instance with the memory from the given buffer.""" 

1273 return PerGpuStats.from_data(_numpy.frombuffer(buffer, dtype=per_gpu_stats_dtype)) 

1274  

1275 @staticmethod 

1276 def from_data(data): 

1277 """Create an PerGpuStats instance wrapping the given NumPy array. 

1278  

1279 Args: 

1280 data (_numpy.ndarray): a 1D array of dtype `per_gpu_stats_dtype` holding the data. 

1281 """ 

1282 cdef PerGpuStats obj = PerGpuStats.__new__(PerGpuStats) 

1283 if not isinstance(data, _numpy.ndarray): 

1284 raise TypeError("data argument must be a NumPy ndarray") 

1285 if data.ndim != 1: 

1286 raise ValueError("data array must be 1D") 

1287 if data.dtype != per_gpu_stats_dtype: 

1288 raise ValueError("data array must be of dtype per_gpu_stats_dtype") 

1289 obj._data = data.view(dtype=per_gpu_stats_dtype_record, type=_numpy.ndarray) 

1290 return obj 

1291  

1292 @staticmethod 

1293 def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False, object owner=None): 

1294 """Create an PerGpuStats instance wrapping the given pointer. 

1295  

1296 Args: 

1297 ptr (intptr_t): pointer address as Python :class:`int` to the data. 

1298 size (int): number of structs, default=1. 

1299 readonly (bool): whether the data is read-only (to the user). default is `False`. 

1300 owner (object): object that owns the memory at *ptr*. A strong reference is 

1301 kept so the backing storage outlives this wrapper. 

1302 """ 

1303 if ptr == 0: 1de

1304 raise ValueError("ptr must not be null (0)") 

1305 cdef PerGpuStats obj = PerGpuStats.__new__(PerGpuStats) 1de

1306 cdef flag = _cyb_cpython_buffer.PyBUF_READ if readonly else _cyb_cpython_buffer.PyBUF_WRITE 1de

1307 cdef object buf = _cyb_cpython_memoryview.PyMemoryView_FromMemory( 1de

1308 <char*>ptr, sizeof(CUfilePerGpuStats_t) * size, flag) 1de

1309 obj._data = _numpy.ndarray(size, buffer=buf, dtype=per_gpu_stats_dtype_record) 1de

1310 obj._owner = owner 1de

1311 return obj 1de

1312  

1313  

1314cdef _get_io_vec_dtype_offsets(): 

1315 cdef CUfileIOVec_t pod 

1316 return _numpy.dtype({ 

1317 'names': ['base_', 'len'], 

1318 'formats': [_numpy.intp, _numpy.uint64], 

1319 'offsets': [ 

1320 (<intptr_t>&(pod.base)) - (<intptr_t>&pod), 

1321 (<intptr_t>&(pod.len)) - (<intptr_t>&pod), 

1322 ], 

1323 'itemsize': sizeof(CUfileIOVec_t), 

1324 }) 

1325  

1326io_vec_dtype = _get_io_vec_dtype_offsets() 

1327cdef object io_vec_dtype_record = _numpy.dtype((_numpy.record, io_vec_dtype)) 

1328  

1329cdef class IOVec: 

1330 """Empty-initialize an array of `CUfileIOVec_t`. 

1331 The resulting object is of length `size` and of dtype `io_vec_dtype`. 

1332 If default-constructed, the instance represents a single struct. 

1333  

1334 Args: 

1335 size (int): number of structs, default=1. 

1336  

1337 .. seealso:: `CUfileIOVec_t` 

1338 """ 

1339 cdef: 

1340 readonly object _data 

1341 object _owner 

1342  

1343 def __init__(self, size=1): 

1344 self._data = _numpy.zeros(size, dtype=io_vec_dtype_record) 

1345 assert self._data.itemsize == sizeof(CUfileIOVec_t), \ 

1346 f"itemsize {self._data.itemsize} mismatches struct size { sizeof(CUfileIOVec_t) }" 

1347  

1348 def __repr__(self): 

1349 if self._data.size > 1: 

1350 return f"<{__name__}.IOVec_Array_{self._data.size} object at {hex(id(self))}>" 

1351 else: 

1352 return f"<{__name__}.IOVec object at {hex(id(self))}>" 

1353  

1354 @property 

1355 def ptr(self): 

1356 """Get the pointer address to the data as Python :class:`int`.""" 

1357 return _cyb_array_ptr(self._data) 

1358  

1359 cdef intptr_t _get_ptr(self): 

1360 return _cyb_array_ptr(self._data) 

1361  

1362 def __int__(self): 

1363 if self._data.size > 1 and not self._data.flags["C_CONTIGUOUS"]: 

1364 raise TypeError("int() argument must be a bytes-like object of size 1, or a " 

1365 "C-contiguous array. To get the pointer address of a " 

1366 "non-contiguous array, use .ptr") 

1367 return _cyb_array_ptr(self._data) 

1368  

1369 def __len__(self): 

1370 return self._data.size 

1371  

1372 def __eq__(self, other): 

1373 cdef object self_data = self._data 

1374 if (not isinstance(other, IOVec)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype: 

1375 return False 

1376 return bool((self_data == other._data).all()) 

1377  

1378 def __getbuffer__(self, Py_buffer *buffer, int flags): 

1379 _cyb_cpython.PyObject_GetBuffer(self._data, buffer, flags) 

1380  

1381 def __releasebuffer__(self, Py_buffer *buffer): 

1382 _cyb_cpython.PyBuffer_Release(buffer) 

1383  

1384 @property 

1385 def base_(self): 

1386 """Union[~_numpy.intp, int]: """ 

1387 if self._data.size == 1: 

1388 return int(self._data["base_"][0]) 

1389 return self._data["base_"] 

1390  

1391 @base_.setter 

1392 def base_(self, val): 

1393 if not self._data.flags.writeable: 

1394 raise ValueError("This IOVec instance is read-only") 

1395 self._data["base_"] = val 

1396  

1397 @property 

1398 def len(self): 

1399 """Union[~_numpy.uint64, int]: """ 

1400 if self._data.size == 1: 

1401 return int(self._data["len"][0]) 

1402 return self._data["len"] 

1403  

1404 @len.setter 

1405 def len(self, val): 

1406 if not self._data.flags.writeable: 

1407 raise ValueError("This IOVec instance is read-only") 

1408 self._data["len"] = val 

1409  

1410 def __getitem__(self, key): 

1411 cdef ssize_t key_ 

1412 cdef ssize_t size 

1413 cdef IOVec obj 

1414 if isinstance(key, int): 

1415 key_ = key 

1416 size = self._data.size 

1417 if key_ >= size or key_ <= -(size+1): 

1418 raise IndexError("index is out of bounds") 

1419 if key_ < 0: 

1420 key_ += size 

1421 obj = IOVec.__new__(IOVec) 

1422 obj._data = self._data[key_:key_+1] 

1423 obj._owner = self._owner 

1424 return obj 

1425 out = self._data[key] 

1426 if isinstance(out, _numpy.ndarray): 

1427 if out.dtype == io_vec_dtype: 

1428 obj = IOVec.from_data(out) 

1429 obj._owner = self._owner 

1430 return obj 

1431 if out.dtype.names is not None: 

1432 return out.view(_numpy.recarray) 

1433 return out 

1434  

1435 def __setitem__(self, key, val): 

1436 self._data[key] = val 

1437  

1438 @staticmethod 

1439 def from_buffer(buffer): 

1440 """Create an IOVec instance with the memory from the given buffer.""" 

1441 return IOVec.from_data(_numpy.frombuffer(buffer, dtype=io_vec_dtype)) 

1442  

1443 @staticmethod 

1444 def from_data(data): 

1445 """Create an IOVec instance wrapping the given NumPy array. 

1446  

1447 Args: 

1448 data (_numpy.ndarray): a 1D array of dtype `io_vec_dtype` holding the data. 

1449 """ 

1450 cdef IOVec obj = IOVec.__new__(IOVec) 

1451 if not isinstance(data, _numpy.ndarray): 

1452 raise TypeError("data argument must be a NumPy ndarray") 

1453 if data.ndim != 1: 

1454 raise ValueError("data array must be 1D") 

1455 if data.dtype != io_vec_dtype: 

1456 raise ValueError("data array must be of dtype io_vec_dtype") 

1457 obj._data = data.view(dtype=io_vec_dtype_record, type=_numpy.ndarray) 

1458 return obj 

1459  

1460 @staticmethod 

1461 def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False, object owner=None): 

1462 """Create an IOVec instance wrapping the given pointer. 

1463  

1464 Args: 

1465 ptr (intptr_t): pointer address as Python :class:`int` to the data. 

1466 size (int): number of structs, default=1. 

1467 readonly (bool): whether the data is read-only (to the user). default is `False`. 

1468 owner (object): object that owns the memory at *ptr*. A strong reference is 

1469 kept so the backing storage outlives this wrapper. 

1470 """ 

1471 if ptr == 0: 

1472 raise ValueError("ptr must not be null (0)") 

1473 cdef IOVec obj = IOVec.__new__(IOVec) 

1474 cdef flag = _cyb_cpython_buffer.PyBUF_READ if readonly else _cyb_cpython_buffer.PyBUF_WRITE 

1475 cdef object buf = _cyb_cpython_memoryview.PyMemoryView_FromMemory( 

1476 <char*>ptr, sizeof(CUfileIOVec_t) * size, flag) 

1477 obj._data = _numpy.ndarray(size, buffer=buf, dtype=io_vec_dtype_record) 

1478 obj._owner = owner 

1479 return obj 

1480  

1481  

1482cdef _get_descr_dtype_offsets(): 

1483 cdef CUfileDescr_t pod 

1484 return _numpy.dtype({ 

1485 'names': ['type', 'handle', 'fs_ops'], 

1486 'formats': [_numpy.int32, _py_anon_pod1_dtype, _numpy.intp], 

1487 'offsets': [ 

1488 (<intptr_t>&(pod.type)) - (<intptr_t>&pod), 

1489 (<intptr_t>&(pod.handle)) - (<intptr_t>&pod), 

1490 (<intptr_t>&(pod.fs_ops)) - (<intptr_t>&pod), 

1491 ], 

1492 'itemsize': sizeof(CUfileDescr_t), 

1493 }) 

1494  

1495descr_dtype = _get_descr_dtype_offsets() 

1496cdef object descr_dtype_record = _numpy.dtype((_numpy.record, descr_dtype)) 

1497  

1498cdef class Descr: 

1499 """Empty-initialize an array of `CUfileDescr_t`. 

1500 The resulting object is of length `size` and of dtype `descr_dtype`. 

1501 If default-constructed, the instance represents a single struct. 

1502  

1503 Args: 

1504 size (int): number of structs, default=1. 

1505  

1506 .. seealso:: `CUfileDescr_t` 

1507 """ 

1508 cdef: 

1509 readonly object _data 

1510 object _owner 

1511  

1512 def __init__(self, size=1): 

1513 self._data = _numpy.zeros(size, dtype=descr_dtype_record) 1hljnpqrstfbdBimkouvwxygceC

1514 assert self._data.itemsize == sizeof(CUfileDescr_t), \ 1hljnpqrstfbdBimkouvwxygceC

1515 f"itemsize {self._data.itemsize} mismatches struct size { sizeof(CUfileDescr_t) }" 

1516  

1517 def __repr__(self): 

1518 if self._data.size > 1: 

1519 return f"<{__name__}.Descr_Array_{self._data.size} object at {hex(id(self))}>" 

1520 else: 

1521 return f"<{__name__}.Descr object at {hex(id(self))}>" 

1522  

1523 @property 

1524 def ptr(self): 

1525 """Get the pointer address to the data as Python :class:`int`.""" 

1526 return _cyb_array_ptr(self._data) 1hljnpqrstfbdBimkouvwxygceC

1527  

1528 cdef intptr_t _get_ptr(self): 

1529 return _cyb_array_ptr(self._data) 

1530  

1531 def __int__(self): 

1532 if self._data.size > 1 and not self._data.flags["C_CONTIGUOUS"]: 

1533 raise TypeError("int() argument must be a bytes-like object of size 1, or a " 

1534 "C-contiguous array. To get the pointer address of a " 

1535 "non-contiguous array, use .ptr") 

1536 return _cyb_array_ptr(self._data) 

1537  

1538 def __len__(self): 

1539 return self._data.size 

1540  

1541 def __eq__(self, other): 

1542 cdef object self_data = self._data 

1543 if (not isinstance(other, Descr)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype: 

1544 return False 

1545 return bool((self_data == other._data).all()) 

1546  

1547 def __getbuffer__(self, Py_buffer *buffer, int flags): 

1548 _cyb_cpython.PyObject_GetBuffer(self._data, buffer, flags) 

1549  

1550 def __releasebuffer__(self, Py_buffer *buffer): 

1551 _cyb_cpython.PyBuffer_Release(buffer) 

1552  

1553 @property 

1554 def type(self): 

1555 """Union[~_numpy.int32, int]: """ 

1556 if self._data.size == 1: 

1557 return int(self._data["type"][0]) 

1558 return self._data["type"] 

1559  

1560 @type.setter 

1561 def type(self, val): 

1562 if not self._data.flags.writeable: 1hljnpqrstfbdBimkouvwxygceC

1563 raise ValueError("This Descr instance is read-only") 

1564 self._data["type"] = val 1hljnpqrstfbdBimkouvwxygceC

1565  

1566 @property 

1567 def handle(self): 

1568 """_py_anon_pod1_dtype: """ 

1569 return self._data["handle"].view(_numpy.recarray) 1hljnpqrstfbdBimkouvwxygceC

1570  

1571 @handle.setter 

1572 def handle(self, val): 

1573 if not self._data.flags.writeable: 

1574 raise ValueError("This Descr instance is read-only") 

1575 self._data["handle"] = val 

1576  

1577 @property 

1578 def fs_ops(self): 

1579 """Union[~_numpy.intp, int]: """ 

1580 if self._data.size == 1: 

1581 return int(self._data["fs_ops"][0]) 

1582 return self._data["fs_ops"] 

1583  

1584 @fs_ops.setter 

1585 def fs_ops(self, val): 

1586 if not self._data.flags.writeable: 1hljnpqrstfbdBimkouvwxygceC

1587 raise ValueError("This Descr instance is read-only") 

1588 self._data["fs_ops"] = val 1hljnpqrstfbdBimkouvwxygceC

1589  

1590 def __getitem__(self, key): 

1591 cdef ssize_t key_ 

1592 cdef ssize_t size 

1593 cdef Descr obj 

1594 if isinstance(key, int): 

1595 key_ = key 

1596 size = self._data.size 

1597 if key_ >= size or key_ <= -(size+1): 

1598 raise IndexError("index is out of bounds") 

1599 if key_ < 0: 

1600 key_ += size 

1601 obj = Descr.__new__(Descr) 

1602 obj._data = self._data[key_:key_+1] 

1603 obj._owner = self._owner 

1604 return obj 

1605 out = self._data[key] 

1606 if isinstance(out, _numpy.ndarray): 

1607 if out.dtype == descr_dtype: 

1608 obj = Descr.from_data(out) 

1609 obj._owner = self._owner 

1610 return obj 

1611 if out.dtype.names is not None: 

1612 return out.view(_numpy.recarray) 

1613 return out 

1614  

1615 def __setitem__(self, key, val): 

1616 self._data[key] = val 

1617  

1618 @staticmethod 

1619 def from_buffer(buffer): 

1620 """Create an Descr instance with the memory from the given buffer.""" 

1621 return Descr.from_data(_numpy.frombuffer(buffer, dtype=descr_dtype)) 

1622  

1623 @staticmethod 

1624 def from_data(data): 

1625 """Create an Descr instance wrapping the given NumPy array. 

1626  

1627 Args: 

1628 data (_numpy.ndarray): a 1D array of dtype `descr_dtype` holding the data. 

1629 """ 

1630 cdef Descr obj = Descr.__new__(Descr) 

1631 if not isinstance(data, _numpy.ndarray): 

1632 raise TypeError("data argument must be a NumPy ndarray") 

1633 if data.ndim != 1: 

1634 raise ValueError("data array must be 1D") 

1635 if data.dtype != descr_dtype: 

1636 raise ValueError("data array must be of dtype descr_dtype") 

1637 obj._data = data.view(dtype=descr_dtype_record, type=_numpy.ndarray) 

1638 return obj 

1639  

1640 @staticmethod 

1641 def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False, object owner=None): 

1642 """Create an Descr instance wrapping the given pointer. 

1643  

1644 Args: 

1645 ptr (intptr_t): pointer address as Python :class:`int` to the data. 

1646 size (int): number of structs, default=1. 

1647 readonly (bool): whether the data is read-only (to the user). default is `False`. 

1648 owner (object): object that owns the memory at *ptr*. A strong reference is 

1649 kept so the backing storage outlives this wrapper. 

1650 """ 

1651 if ptr == 0: 

1652 raise ValueError("ptr must not be null (0)") 

1653 cdef Descr obj = Descr.__new__(Descr) 

1654 cdef flag = _cyb_cpython_buffer.PyBUF_READ if readonly else _cyb_cpython_buffer.PyBUF_WRITE 

1655 cdef object buf = _cyb_cpython_memoryview.PyMemoryView_FromMemory( 

1656 <char*>ptr, sizeof(CUfileDescr_t) * size, flag) 

1657 obj._data = _numpy.ndarray(size, buffer=buf, dtype=descr_dtype_record) 

1658 obj._owner = owner 

1659 return obj 

1660  

1661  

1662cdef _get__py_anon_pod2_dtype_offsets(): 

1663 cdef cuda_bindings_cufile__anon_pod2 pod 

1664 return _numpy.dtype({ 

1665 'names': ['batch'], 

1666 'formats': [_py_anon_pod3_dtype], 

1667 'offsets': [ 

1668 (<intptr_t>&(pod.batch)) - (<intptr_t>&pod), 

1669 ], 

1670 'itemsize': sizeof(cuda_bindings_cufile__anon_pod2), 

1671 }) 

1672  

1673_py_anon_pod2_dtype = _get__py_anon_pod2_dtype_offsets() 

1674  

1675cdef class _py_anon_pod2: 

1676 """Empty-initialize an instance of `cuda_bindings_cufile__anon_pod2`. 

1677  

1678  

1679 .. seealso:: `cuda_bindings_cufile__anon_pod2` 

1680 """ 

1681 cdef: 

1682 cuda_bindings_cufile__anon_pod2 *_ptr 

1683 object _owner 

1684 bint _owns_ptr 

1685 bint _readonly 

1686  

1687 def __init__(self): 

1688 self._ptr = <cuda_bindings_cufile__anon_pod2 *>_cyb_calloc(1, sizeof(cuda_bindings_cufile__anon_pod2)) 

1689 if self._ptr == NULL: 

1690 raise MemoryError("Error allocating _py_anon_pod2") 

1691 self._owns_ptr = True 

1692 self._owner = None 

1693 self._readonly = False 

1694  

1695 def __dealloc__(self): 

1696 cdef cuda_bindings_cufile__anon_pod2 *ptr 

1697 if self._owns_ptr and self._ptr != NULL: 

1698 ptr = self._ptr 

1699 self._ptr = NULL 

1700 _cyb_free(ptr) 

1701  

1702 def __repr__(self): 

1703 return f"<{__name__}._py_anon_pod2 object at {hex(id(self))}>" 

1704  

1705 @property 

1706 def ptr(self): 

1707 """Get the pointer address to the data as Python :class:`int`.""" 

1708 return <intptr_t>(self._ptr) 

1709  

1710 cdef intptr_t _get_ptr(self): 

1711 return <intptr_t>(self._ptr) 

1712  

1713 def __int__(self): 

1714 return <intptr_t>(self._ptr) 

1715  

1716 def __eq__(self, other): 

1717 cdef _py_anon_pod2 other_ 

1718 if not isinstance(other, _py_anon_pod2): 

1719 return False 

1720 other_ = other 

1721 return (_cyb_memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(cuda_bindings_cufile__anon_pod2)) == 0) 

1722  

1723 def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): 

1724 _cyb___getbuffer(self, buffer, <void *>self._ptr, sizeof(cuda_bindings_cufile__anon_pod2), self._readonly) 

1725  

1726 def __releasebuffer__(self, Py_buffer *buffer): 

1727 pass 

1728  

1729 def __setitem__(self, key, val): 

1730 cdef _cyb_Py_buffer view 

1731 if key == 0: 

1732 if self._readonly: 

1733 raise ValueError("This _py_anon_pod2 instance is read-only") 

1734 _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) 

1735 try: 

1736 if <size_t>view.len < sizeof(cuda_bindings_cufile__anon_pod2): 

1737 raise ValueError( 

1738 "source buffer too small: expected at least %d bytes, got %d" % (sizeof(cuda_bindings_cufile__anon_pod2), view.len) 

1739 ) 

1740 _cyb_memmove(<void*>self._ptr, view.buf, sizeof(cuda_bindings_cufile__anon_pod2)) 

1741 self._readonly = view.readonly != 0 

1742 finally: 

1743 _cyb_PyBuffer_Release(&view) 

1744 else: 

1745 setattr(self, key, val) 

1746  

1747 @property 

1748 def batch(self): 

1749 """_py_anon_pod3: """ 

1750 return _py_anon_pod3.from_ptr( 

1751 <intptr_t>&(self._ptr[0].batch), 

1752 readonly=self._readonly, 

1753 owner=self, 

1754 ) 

1755  

1756 @batch.setter 

1757 def batch(self, val): 

1758 if self._readonly: 

1759 raise ValueError("This _py_anon_pod2 instance is read-only") 

1760 cdef _py_anon_pod3 val_ = val 

1761 _cyb_memcpy(<void *>&(self._ptr[0].batch), <void *>(val_._get_ptr()), sizeof(cuda_bindings_cufile__anon_pod3) * 1) 

1762  

1763 @staticmethod 

1764 def from_buffer(buffer): 

1765 """Create an _py_anon_pod2 instance with the memory from the given buffer.""" 

1766 return _cyb_from_buffer(buffer, sizeof(cuda_bindings_cufile__anon_pod2), _py_anon_pod2) 

1767  

1768 @staticmethod 

1769 def from_data(data): 

1770 """Create an _py_anon_pod2 instance wrapping the given NumPy array. 

1771  

1772 Args: 

1773 data (_numpy.ndarray): a single-element array of dtype `_py_anon_pod2_dtype` holding the data. 

1774 """ 

1775 return _cyb_from_data(data, "_py_anon_pod2_dtype", _py_anon_pod2_dtype, _py_anon_pod2) 

1776  

1777 @staticmethod 

1778 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): 

1779 """Create an _py_anon_pod2 instance wrapping the given pointer. 

1780  

1781 Args: 

1782 ptr (intptr_t): pointer address as Python :class:`int` to the data. 

1783 owner (object): The Python object that owns the pointer. If not provided, data will be copied. 

1784 readonly (bool): whether the data is read-only (to the user). default is `False`. 

1785 """ 

1786 if ptr == 0: 

1787 raise ValueError("ptr must not be null (0)") 

1788 cdef _py_anon_pod2 obj = _py_anon_pod2.__new__(_py_anon_pod2) 

1789 if owner is None: 

1790 obj._ptr = <cuda_bindings_cufile__anon_pod2 *>_cyb_malloc(sizeof(cuda_bindings_cufile__anon_pod2)) 

1791 if obj._ptr == NULL: 

1792 raise MemoryError("Error allocating _py_anon_pod2") 

1793 _cyb_memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(cuda_bindings_cufile__anon_pod2)) 

1794 obj._owns_ptr = True 

1795 obj._owner = None 

1796 else: 

1797 obj._ptr = <cuda_bindings_cufile__anon_pod2 *>ptr 

1798 obj._owns_ptr = False 

1799 obj._owner = owner 

1800 obj._readonly = readonly 

1801 return obj 

1802  

1803  

1804cdef _get_stats_level1_dtype_offsets(): 

1805 cdef CUfileStatsLevel1_t pod 

1806 return _numpy.dtype({ 

1807 'names': ['read_ops', 'write_ops', 'hdl_register_ops', 'hdl_deregister_ops', 'buf_register_ops', 'buf_deregister_ops', 'read_bytes', 'write_bytes', 'read_bw_bytes_per_sec', 'write_bw_bytes_per_sec', 'read_lat_avg_us', 'write_lat_avg_us', 'read_ops_per_sec', 'write_ops_per_sec', 'read_lat_sum_us', 'write_lat_sum_us', 'batch_submit_ops', 'batch_complete_ops', 'batch_setup_ops', 'batch_cancel_ops', 'batch_destroy_ops', 'batch_enqueued_ops', 'batch_posix_enqueued_ops', 'batch_processed_ops', 'batch_posix_processed_ops', 'batch_nvfs_submit_ops', 'batch_p2p_submit_ops', 'batch_aio_submit_ops', 'batch_iouring_submit_ops', 'batch_mixed_io_submit_ops', 'batch_total_submit_ops', 'batch_read_bytes', 'batch_write_bytes', 'batch_read_bw_bytes', 'batch_write_bw_bytes', 'batch_submit_lat_avg_us', 'batch_completion_lat_avg_us', 'batch_submit_ops_per_sec', 'batch_complete_ops_per_sec', 'batch_submit_lat_sum_us', 'batch_completion_lat_sum_us', 'last_batch_read_bytes', 'last_batch_write_bytes', 'readv_ops', 'writev_ops', 'readv_bytes', 'writev_bytes', 'readv_bw_bytes_per_sec', 'writev_bw_bytes_per_sec', 'readv_lat_avg_us', 'writev_lat_avg_us', 'readv_ops_per_sec', 'writev_ops_per_sec', 'readv_lat_sum_us', 'writev_lat_sum_us'], 

1808 'formats': [op_counter_dtype, op_counter_dtype, op_counter_dtype, op_counter_dtype, op_counter_dtype, op_counter_dtype, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, op_counter_dtype, op_counter_dtype, op_counter_dtype, op_counter_dtype, op_counter_dtype, op_counter_dtype, op_counter_dtype, op_counter_dtype, op_counter_dtype, op_counter_dtype, op_counter_dtype, op_counter_dtype, op_counter_dtype, op_counter_dtype, op_counter_dtype, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, op_counter_dtype, op_counter_dtype, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64], 

1809 'offsets': [ 

1810 (<intptr_t>&(pod.read_ops)) - (<intptr_t>&pod), 

1811 (<intptr_t>&(pod.write_ops)) - (<intptr_t>&pod), 

1812 (<intptr_t>&(pod.hdl_register_ops)) - (<intptr_t>&pod), 

1813 (<intptr_t>&(pod.hdl_deregister_ops)) - (<intptr_t>&pod), 

1814 (<intptr_t>&(pod.buf_register_ops)) - (<intptr_t>&pod), 

1815 (<intptr_t>&(pod.buf_deregister_ops)) - (<intptr_t>&pod), 

1816 (<intptr_t>&(pod.read_bytes)) - (<intptr_t>&pod), 

1817 (<intptr_t>&(pod.write_bytes)) - (<intptr_t>&pod), 

1818 (<intptr_t>&(pod.read_bw_bytes_per_sec)) - (<intptr_t>&pod), 

1819 (<intptr_t>&(pod.write_bw_bytes_per_sec)) - (<intptr_t>&pod), 

1820 (<intptr_t>&(pod.read_lat_avg_us)) - (<intptr_t>&pod), 

1821 (<intptr_t>&(pod.write_lat_avg_us)) - (<intptr_t>&pod), 

1822 (<intptr_t>&(pod.read_ops_per_sec)) - (<intptr_t>&pod), 

1823 (<intptr_t>&(pod.write_ops_per_sec)) - (<intptr_t>&pod), 

1824 (<intptr_t>&(pod.read_lat_sum_us)) - (<intptr_t>&pod), 

1825 (<intptr_t>&(pod.write_lat_sum_us)) - (<intptr_t>&pod), 

1826 (<intptr_t>&(pod.batch_submit_ops)) - (<intptr_t>&pod), 

1827 (<intptr_t>&(pod.batch_complete_ops)) - (<intptr_t>&pod), 

1828 (<intptr_t>&(pod.batch_setup_ops)) - (<intptr_t>&pod), 

1829 (<intptr_t>&(pod.batch_cancel_ops)) - (<intptr_t>&pod), 

1830 (<intptr_t>&(pod.batch_destroy_ops)) - (<intptr_t>&pod), 

1831 (<intptr_t>&(pod.batch_enqueued_ops)) - (<intptr_t>&pod), 

1832 (<intptr_t>&(pod.batch_posix_enqueued_ops)) - (<intptr_t>&pod), 

1833 (<intptr_t>&(pod.batch_processed_ops)) - (<intptr_t>&pod), 

1834 (<intptr_t>&(pod.batch_posix_processed_ops)) - (<intptr_t>&pod), 

1835 (<intptr_t>&(pod.batch_nvfs_submit_ops)) - (<intptr_t>&pod), 

1836 (<intptr_t>&(pod.batch_p2p_submit_ops)) - (<intptr_t>&pod), 

1837 (<intptr_t>&(pod.batch_aio_submit_ops)) - (<intptr_t>&pod), 

1838 (<intptr_t>&(pod.batch_iouring_submit_ops)) - (<intptr_t>&pod), 

1839 (<intptr_t>&(pod.batch_mixed_io_submit_ops)) - (<intptr_t>&pod), 

1840 (<intptr_t>&(pod.batch_total_submit_ops)) - (<intptr_t>&pod), 

1841 (<intptr_t>&(pod.batch_read_bytes)) - (<intptr_t>&pod), 

1842 (<intptr_t>&(pod.batch_write_bytes)) - (<intptr_t>&pod), 

1843 (<intptr_t>&(pod.batch_read_bw_bytes)) - (<intptr_t>&pod), 

1844 (<intptr_t>&(pod.batch_write_bw_bytes)) - (<intptr_t>&pod), 

1845 (<intptr_t>&(pod.batch_submit_lat_avg_us)) - (<intptr_t>&pod), 

1846 (<intptr_t>&(pod.batch_completion_lat_avg_us)) - (<intptr_t>&pod), 

1847 (<intptr_t>&(pod.batch_submit_ops_per_sec)) - (<intptr_t>&pod), 

1848 (<intptr_t>&(pod.batch_complete_ops_per_sec)) - (<intptr_t>&pod), 

1849 (<intptr_t>&(pod.batch_submit_lat_sum_us)) - (<intptr_t>&pod), 

1850 (<intptr_t>&(pod.batch_completion_lat_sum_us)) - (<intptr_t>&pod), 

1851 (<intptr_t>&(pod.last_batch_read_bytes)) - (<intptr_t>&pod), 

1852 (<intptr_t>&(pod.last_batch_write_bytes)) - (<intptr_t>&pod), 

1853 (<intptr_t>&(pod.readv_ops)) - (<intptr_t>&pod), 

1854 (<intptr_t>&(pod.writev_ops)) - (<intptr_t>&pod), 

1855 (<intptr_t>&(pod.readv_bytes)) - (<intptr_t>&pod), 

1856 (<intptr_t>&(pod.writev_bytes)) - (<intptr_t>&pod), 

1857 (<intptr_t>&(pod.readv_bw_bytes_per_sec)) - (<intptr_t>&pod), 

1858 (<intptr_t>&(pod.writev_bw_bytes_per_sec)) - (<intptr_t>&pod), 

1859 (<intptr_t>&(pod.readv_lat_avg_us)) - (<intptr_t>&pod), 

1860 (<intptr_t>&(pod.writev_lat_avg_us)) - (<intptr_t>&pod), 

1861 (<intptr_t>&(pod.readv_ops_per_sec)) - (<intptr_t>&pod), 

1862 (<intptr_t>&(pod.writev_ops_per_sec)) - (<intptr_t>&pod), 

1863 (<intptr_t>&(pod.readv_lat_sum_us)) - (<intptr_t>&pod), 

1864 (<intptr_t>&(pod.writev_lat_sum_us)) - (<intptr_t>&pod), 

1865 ], 

1866 'itemsize': sizeof(CUfileStatsLevel1_t), 

1867 }) 

1868  

1869stats_level1_dtype = _get_stats_level1_dtype_offsets() 

1870  

1871cdef class StatsLevel1: 

1872 """Empty-initialize an instance of `CUfileStatsLevel1_t`. 

1873  

1874  

1875 .. seealso:: `CUfileStatsLevel1_t` 

1876 """ 

1877 cdef: 

1878 CUfileStatsLevel1_t *_ptr 

1879 object _owner 

1880 bint _owns_ptr 

1881 bint _readonly 

1882  

1883 def __init__(self): 

1884 self._ptr = <CUfileStatsLevel1_t *>_cyb_calloc(1, sizeof(CUfileStatsLevel1_t)) 1fg

1885 if self._ptr == NULL: 1fg

1886 raise MemoryError("Error allocating StatsLevel1") 

1887 self._owns_ptr = True 1fg

1888 self._owner = None 1fg

1889 self._readonly = False 1fg

1890  

1891 def __dealloc__(self): 

1892 cdef CUfileStatsLevel1_t *ptr 

1893 if self._owns_ptr and self._ptr != NULL: 1fbgc

1894 ptr = self._ptr 1fg

1895 self._ptr = NULL 1fg

1896 _cyb_free(ptr) 1fg

1897  

1898 def __repr__(self): 

1899 return f"<{__name__}.StatsLevel1 object at {hex(id(self))}>" 

1900  

1901 @property 

1902 def ptr(self): 

1903 """Get the pointer address to the data as Python :class:`int`.""" 

1904 return <intptr_t>(self._ptr) 1fg

1905  

1906 cdef intptr_t _get_ptr(self): 

1907 return <intptr_t>(self._ptr) 

1908  

1909 def __int__(self): 

1910 return <intptr_t>(self._ptr) 

1911  

1912 def __eq__(self, other): 

1913 cdef StatsLevel1 other_ 

1914 if not isinstance(other, StatsLevel1): 

1915 return False 

1916 other_ = other 

1917 return (_cyb_memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(CUfileStatsLevel1_t)) == 0) 

1918  

1919 def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): 

1920 _cyb___getbuffer(self, buffer, <void *>self._ptr, sizeof(CUfileStatsLevel1_t), self._readonly) 

1921  

1922 def __releasebuffer__(self, Py_buffer *buffer): 

1923 pass 

1924  

1925 def __setitem__(self, key, val): 

1926 cdef _cyb_Py_buffer view 

1927 if key == 0: 

1928 if self._readonly: 

1929 raise ValueError("This StatsLevel1 instance is read-only") 

1930 _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) 

1931 try: 

1932 if <size_t>view.len < sizeof(CUfileStatsLevel1_t): 

1933 raise ValueError( 

1934 "source buffer too small: expected at least %d bytes, got %d" % (sizeof(CUfileStatsLevel1_t), view.len) 

1935 ) 

1936 _cyb_memmove(<void*>self._ptr, view.buf, sizeof(CUfileStatsLevel1_t)) 

1937 self._readonly = view.readonly != 0 

1938 finally: 

1939 _cyb_PyBuffer_Release(&view) 

1940 else: 

1941 setattr(self, key, val) 

1942  

1943 @property 

1944 def read_ops(self): 

1945 """OpCounter: """ 

1946 return OpCounter.from_ptr( 1fbgc

1947 <intptr_t>&(self._ptr[0].read_ops), 1fbgc

1948 readonly=self._readonly, 1fbgc

1949 owner=self, 1fbgc

1950 ) 

1951  

1952 @read_ops.setter 

1953 def read_ops(self, val): 

1954 if self._readonly: 

1955 raise ValueError("This StatsLevel1 instance is read-only") 

1956 cdef OpCounter val_ = val 

1957 _cyb_memcpy(<void *>&(self._ptr[0].read_ops), <void *>(val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) 

1958  

1959 @property 

1960 def write_ops(self): 

1961 """OpCounter: """ 

1962 return OpCounter.from_ptr( 1fbgc

1963 <intptr_t>&(self._ptr[0].write_ops), 1fbgc

1964 readonly=self._readonly, 1fbgc

1965 owner=self, 1fbgc

1966 ) 

1967  

1968 @write_ops.setter 

1969 def write_ops(self, val): 

1970 if self._readonly: 

1971 raise ValueError("This StatsLevel1 instance is read-only") 

1972 cdef OpCounter val_ = val 

1973 _cyb_memcpy(<void *>&(self._ptr[0].write_ops), <void *>(val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) 

1974  

1975 @property 

1976 def hdl_register_ops(self): 

1977 """OpCounter: """ 

1978 return OpCounter.from_ptr( 

1979 <intptr_t>&(self._ptr[0].hdl_register_ops), 

1980 readonly=self._readonly, 

1981 owner=self, 

1982 ) 

1983  

1984 @hdl_register_ops.setter 

1985 def hdl_register_ops(self, val): 

1986 if self._readonly: 

1987 raise ValueError("This StatsLevel1 instance is read-only") 

1988 cdef OpCounter val_ = val 

1989 _cyb_memcpy(<void *>&(self._ptr[0].hdl_register_ops), <void *>(val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) 

1990  

1991 @property 

1992 def hdl_deregister_ops(self): 

1993 """OpCounter: """ 

1994 return OpCounter.from_ptr( 

1995 <intptr_t>&(self._ptr[0].hdl_deregister_ops), 

1996 readonly=self._readonly, 

1997 owner=self, 

1998 ) 

1999  

2000 @hdl_deregister_ops.setter 

2001 def hdl_deregister_ops(self, val): 

2002 if self._readonly: 

2003 raise ValueError("This StatsLevel1 instance is read-only") 

2004 cdef OpCounter val_ = val 

2005 _cyb_memcpy(<void *>&(self._ptr[0].hdl_deregister_ops), <void *>(val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) 

2006  

2007 @property 

2008 def buf_register_ops(self): 

2009 """OpCounter: """ 

2010 return OpCounter.from_ptr( 

2011 <intptr_t>&(self._ptr[0].buf_register_ops), 

2012 readonly=self._readonly, 

2013 owner=self, 

2014 ) 

2015  

2016 @buf_register_ops.setter 

2017 def buf_register_ops(self, val): 

2018 if self._readonly: 

2019 raise ValueError("This StatsLevel1 instance is read-only") 

2020 cdef OpCounter val_ = val 

2021 _cyb_memcpy(<void *>&(self._ptr[0].buf_register_ops), <void *>(val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) 

2022  

2023 @property 

2024 def buf_deregister_ops(self): 

2025 """OpCounter: """ 

2026 return OpCounter.from_ptr( 

2027 <intptr_t>&(self._ptr[0].buf_deregister_ops), 

2028 readonly=self._readonly, 

2029 owner=self, 

2030 ) 

2031  

2032 @buf_deregister_ops.setter 

2033 def buf_deregister_ops(self, val): 

2034 if self._readonly: 

2035 raise ValueError("This StatsLevel1 instance is read-only") 

2036 cdef OpCounter val_ = val 

2037 _cyb_memcpy(<void *>&(self._ptr[0].buf_deregister_ops), <void *>(val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) 

2038  

2039 @property 

2040 def batch_submit_ops(self): 

2041 """OpCounter: """ 

2042 return OpCounter.from_ptr( 

2043 <intptr_t>&(self._ptr[0].batch_submit_ops), 

2044 readonly=self._readonly, 

2045 owner=self, 

2046 ) 

2047  

2048 @batch_submit_ops.setter 

2049 def batch_submit_ops(self, val): 

2050 if self._readonly: 

2051 raise ValueError("This StatsLevel1 instance is read-only") 

2052 cdef OpCounter val_ = val 

2053 _cyb_memcpy(<void *>&(self._ptr[0].batch_submit_ops), <void *>(val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) 

2054  

2055 @property 

2056 def batch_complete_ops(self): 

2057 """OpCounter: """ 

2058 return OpCounter.from_ptr( 

2059 <intptr_t>&(self._ptr[0].batch_complete_ops), 

2060 readonly=self._readonly, 

2061 owner=self, 

2062 ) 

2063  

2064 @batch_complete_ops.setter 

2065 def batch_complete_ops(self, val): 

2066 if self._readonly: 

2067 raise ValueError("This StatsLevel1 instance is read-only") 

2068 cdef OpCounter val_ = val 

2069 _cyb_memcpy(<void *>&(self._ptr[0].batch_complete_ops), <void *>(val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) 

2070  

2071 @property 

2072 def batch_setup_ops(self): 

2073 """OpCounter: """ 

2074 return OpCounter.from_ptr( 

2075 <intptr_t>&(self._ptr[0].batch_setup_ops), 

2076 readonly=self._readonly, 

2077 owner=self, 

2078 ) 

2079  

2080 @batch_setup_ops.setter 

2081 def batch_setup_ops(self, val): 

2082 if self._readonly: 

2083 raise ValueError("This StatsLevel1 instance is read-only") 

2084 cdef OpCounter val_ = val 

2085 _cyb_memcpy(<void *>&(self._ptr[0].batch_setup_ops), <void *>(val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) 

2086  

2087 @property 

2088 def batch_cancel_ops(self): 

2089 """OpCounter: """ 

2090 return OpCounter.from_ptr( 

2091 <intptr_t>&(self._ptr[0].batch_cancel_ops), 

2092 readonly=self._readonly, 

2093 owner=self, 

2094 ) 

2095  

2096 @batch_cancel_ops.setter 

2097 def batch_cancel_ops(self, val): 

2098 if self._readonly: 

2099 raise ValueError("This StatsLevel1 instance is read-only") 

2100 cdef OpCounter val_ = val 

2101 _cyb_memcpy(<void *>&(self._ptr[0].batch_cancel_ops), <void *>(val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) 

2102  

2103 @property 

2104 def batch_destroy_ops(self): 

2105 """OpCounter: """ 

2106 return OpCounter.from_ptr( 

2107 <intptr_t>&(self._ptr[0].batch_destroy_ops), 

2108 readonly=self._readonly, 

2109 owner=self, 

2110 ) 

2111  

2112 @batch_destroy_ops.setter 

2113 def batch_destroy_ops(self, val): 

2114 if self._readonly: 

2115 raise ValueError("This StatsLevel1 instance is read-only") 

2116 cdef OpCounter val_ = val 

2117 _cyb_memcpy(<void *>&(self._ptr[0].batch_destroy_ops), <void *>(val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) 

2118  

2119 @property 

2120 def batch_enqueued_ops(self): 

2121 """OpCounter: """ 

2122 return OpCounter.from_ptr( 

2123 <intptr_t>&(self._ptr[0].batch_enqueued_ops), 

2124 readonly=self._readonly, 

2125 owner=self, 

2126 ) 

2127  

2128 @batch_enqueued_ops.setter 

2129 def batch_enqueued_ops(self, val): 

2130 if self._readonly: 

2131 raise ValueError("This StatsLevel1 instance is read-only") 

2132 cdef OpCounter val_ = val 

2133 _cyb_memcpy(<void *>&(self._ptr[0].batch_enqueued_ops), <void *>(val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) 

2134  

2135 @property 

2136 def batch_posix_enqueued_ops(self): 

2137 """OpCounter: """ 

2138 return OpCounter.from_ptr( 

2139 <intptr_t>&(self._ptr[0].batch_posix_enqueued_ops), 

2140 readonly=self._readonly, 

2141 owner=self, 

2142 ) 

2143  

2144 @batch_posix_enqueued_ops.setter 

2145 def batch_posix_enqueued_ops(self, val): 

2146 if self._readonly: 

2147 raise ValueError("This StatsLevel1 instance is read-only") 

2148 cdef OpCounter val_ = val 

2149 _cyb_memcpy(<void *>&(self._ptr[0].batch_posix_enqueued_ops), <void *>(val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) 

2150  

2151 @property 

2152 def batch_processed_ops(self): 

2153 """OpCounter: """ 

2154 return OpCounter.from_ptr( 

2155 <intptr_t>&(self._ptr[0].batch_processed_ops), 

2156 readonly=self._readonly, 

2157 owner=self, 

2158 ) 

2159  

2160 @batch_processed_ops.setter 

2161 def batch_processed_ops(self, val): 

2162 if self._readonly: 

2163 raise ValueError("This StatsLevel1 instance is read-only") 

2164 cdef OpCounter val_ = val 

2165 _cyb_memcpy(<void *>&(self._ptr[0].batch_processed_ops), <void *>(val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) 

2166  

2167 @property 

2168 def batch_posix_processed_ops(self): 

2169 """OpCounter: """ 

2170 return OpCounter.from_ptr( 

2171 <intptr_t>&(self._ptr[0].batch_posix_processed_ops), 

2172 readonly=self._readonly, 

2173 owner=self, 

2174 ) 

2175  

2176 @batch_posix_processed_ops.setter 

2177 def batch_posix_processed_ops(self, val): 

2178 if self._readonly: 

2179 raise ValueError("This StatsLevel1 instance is read-only") 

2180 cdef OpCounter val_ = val 

2181 _cyb_memcpy(<void *>&(self._ptr[0].batch_posix_processed_ops), <void *>(val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) 

2182  

2183 @property 

2184 def batch_nvfs_submit_ops(self): 

2185 """OpCounter: """ 

2186 return OpCounter.from_ptr( 

2187 <intptr_t>&(self._ptr[0].batch_nvfs_submit_ops), 

2188 readonly=self._readonly, 

2189 owner=self, 

2190 ) 

2191  

2192 @batch_nvfs_submit_ops.setter 

2193 def batch_nvfs_submit_ops(self, val): 

2194 if self._readonly: 

2195 raise ValueError("This StatsLevel1 instance is read-only") 

2196 cdef OpCounter val_ = val 

2197 _cyb_memcpy(<void *>&(self._ptr[0].batch_nvfs_submit_ops), <void *>(val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) 

2198  

2199 @property 

2200 def batch_p2p_submit_ops(self): 

2201 """OpCounter: """ 

2202 return OpCounter.from_ptr( 

2203 <intptr_t>&(self._ptr[0].batch_p2p_submit_ops), 

2204 readonly=self._readonly, 

2205 owner=self, 

2206 ) 

2207  

2208 @batch_p2p_submit_ops.setter 

2209 def batch_p2p_submit_ops(self, val): 

2210 if self._readonly: 

2211 raise ValueError("This StatsLevel1 instance is read-only") 

2212 cdef OpCounter val_ = val 

2213 _cyb_memcpy(<void *>&(self._ptr[0].batch_p2p_submit_ops), <void *>(val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) 

2214  

2215 @property 

2216 def batch_aio_submit_ops(self): 

2217 """OpCounter: """ 

2218 return OpCounter.from_ptr( 

2219 <intptr_t>&(self._ptr[0].batch_aio_submit_ops), 

2220 readonly=self._readonly, 

2221 owner=self, 

2222 ) 

2223  

2224 @batch_aio_submit_ops.setter 

2225 def batch_aio_submit_ops(self, val): 

2226 if self._readonly: 

2227 raise ValueError("This StatsLevel1 instance is read-only") 

2228 cdef OpCounter val_ = val 

2229 _cyb_memcpy(<void *>&(self._ptr[0].batch_aio_submit_ops), <void *>(val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) 

2230  

2231 @property 

2232 def batch_iouring_submit_ops(self): 

2233 """OpCounter: """ 

2234 return OpCounter.from_ptr( 

2235 <intptr_t>&(self._ptr[0].batch_iouring_submit_ops), 

2236 readonly=self._readonly, 

2237 owner=self, 

2238 ) 

2239  

2240 @batch_iouring_submit_ops.setter 

2241 def batch_iouring_submit_ops(self, val): 

2242 if self._readonly: 

2243 raise ValueError("This StatsLevel1 instance is read-only") 

2244 cdef OpCounter val_ = val 

2245 _cyb_memcpy(<void *>&(self._ptr[0].batch_iouring_submit_ops), <void *>(val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) 

2246  

2247 @property 

2248 def batch_mixed_io_submit_ops(self): 

2249 """OpCounter: """ 

2250 return OpCounter.from_ptr( 

2251 <intptr_t>&(self._ptr[0].batch_mixed_io_submit_ops), 

2252 readonly=self._readonly, 

2253 owner=self, 

2254 ) 

2255  

2256 @batch_mixed_io_submit_ops.setter 

2257 def batch_mixed_io_submit_ops(self, val): 

2258 if self._readonly: 

2259 raise ValueError("This StatsLevel1 instance is read-only") 

2260 cdef OpCounter val_ = val 

2261 _cyb_memcpy(<void *>&(self._ptr[0].batch_mixed_io_submit_ops), <void *>(val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) 

2262  

2263 @property 

2264 def batch_total_submit_ops(self): 

2265 """OpCounter: """ 

2266 return OpCounter.from_ptr( 

2267 <intptr_t>&(self._ptr[0].batch_total_submit_ops), 

2268 readonly=self._readonly, 

2269 owner=self, 

2270 ) 

2271  

2272 @batch_total_submit_ops.setter 

2273 def batch_total_submit_ops(self, val): 

2274 if self._readonly: 

2275 raise ValueError("This StatsLevel1 instance is read-only") 

2276 cdef OpCounter val_ = val 

2277 _cyb_memcpy(<void *>&(self._ptr[0].batch_total_submit_ops), <void *>(val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) 

2278  

2279 @property 

2280 def readv_ops(self): 

2281 """OpCounter: """ 

2282 return OpCounter.from_ptr( 

2283 <intptr_t>&(self._ptr[0].readv_ops), 

2284 readonly=self._readonly, 

2285 owner=self, 

2286 ) 

2287  

2288 @readv_ops.setter 

2289 def readv_ops(self, val): 

2290 if self._readonly: 

2291 raise ValueError("This StatsLevel1 instance is read-only") 

2292 cdef OpCounter val_ = val 

2293 _cyb_memcpy(<void *>&(self._ptr[0].readv_ops), <void *>(val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) 

2294  

2295 @property 

2296 def writev_ops(self): 

2297 """OpCounter: """ 

2298 return OpCounter.from_ptr( 

2299 <intptr_t>&(self._ptr[0].writev_ops), 

2300 readonly=self._readonly, 

2301 owner=self, 

2302 ) 

2303  

2304 @writev_ops.setter 

2305 def writev_ops(self, val): 

2306 if self._readonly: 

2307 raise ValueError("This StatsLevel1 instance is read-only") 

2308 cdef OpCounter val_ = val 

2309 _cyb_memcpy(<void *>&(self._ptr[0].writev_ops), <void *>(val_._get_ptr()), sizeof(CUfileOpCounter_t) * 1) 

2310  

2311 @property 

2312 def read_bytes(self): 

2313 """int: """ 

2314 return self._ptr[0].read_bytes 1fg

2315  

2316 @read_bytes.setter 

2317 def read_bytes(self, val): 

2318 if self._readonly: 

2319 raise ValueError("This StatsLevel1 instance is read-only") 

2320 self._ptr[0].read_bytes = val 

2321  

2322 @property 

2323 def write_bytes(self): 

2324 """int: """ 

2325 return self._ptr[0].write_bytes 1fg

2326  

2327 @write_bytes.setter 

2328 def write_bytes(self, val): 

2329 if self._readonly: 

2330 raise ValueError("This StatsLevel1 instance is read-only") 

2331 self._ptr[0].write_bytes = val 

2332  

2333 @property 

2334 def read_bw_bytes_per_sec(self): 

2335 """int: """ 

2336 return self._ptr[0].read_bw_bytes_per_sec 

2337  

2338 @read_bw_bytes_per_sec.setter 

2339 def read_bw_bytes_per_sec(self, val): 

2340 if self._readonly: 

2341 raise ValueError("This StatsLevel1 instance is read-only") 

2342 self._ptr[0].read_bw_bytes_per_sec = val 

2343  

2344 @property 

2345 def write_bw_bytes_per_sec(self): 

2346 """int: """ 

2347 return self._ptr[0].write_bw_bytes_per_sec 

2348  

2349 @write_bw_bytes_per_sec.setter 

2350 def write_bw_bytes_per_sec(self, val): 

2351 if self._readonly: 

2352 raise ValueError("This StatsLevel1 instance is read-only") 

2353 self._ptr[0].write_bw_bytes_per_sec = val 

2354  

2355 @property 

2356 def read_lat_avg_us(self): 

2357 """int: """ 

2358 return self._ptr[0].read_lat_avg_us 

2359  

2360 @read_lat_avg_us.setter 

2361 def read_lat_avg_us(self, val): 

2362 if self._readonly: 

2363 raise ValueError("This StatsLevel1 instance is read-only") 

2364 self._ptr[0].read_lat_avg_us = val 

2365  

2366 @property 

2367 def write_lat_avg_us(self): 

2368 """int: """ 

2369 return self._ptr[0].write_lat_avg_us 

2370  

2371 @write_lat_avg_us.setter 

2372 def write_lat_avg_us(self, val): 

2373 if self._readonly: 

2374 raise ValueError("This StatsLevel1 instance is read-only") 

2375 self._ptr[0].write_lat_avg_us = val 

2376  

2377 @property 

2378 def read_ops_per_sec(self): 

2379 """int: """ 

2380 return self._ptr[0].read_ops_per_sec 

2381  

2382 @read_ops_per_sec.setter 

2383 def read_ops_per_sec(self, val): 

2384 if self._readonly: 

2385 raise ValueError("This StatsLevel1 instance is read-only") 

2386 self._ptr[0].read_ops_per_sec = val 

2387  

2388 @property 

2389 def write_ops_per_sec(self): 

2390 """int: """ 

2391 return self._ptr[0].write_ops_per_sec 

2392  

2393 @write_ops_per_sec.setter 

2394 def write_ops_per_sec(self, val): 

2395 if self._readonly: 

2396 raise ValueError("This StatsLevel1 instance is read-only") 

2397 self._ptr[0].write_ops_per_sec = val 

2398  

2399 @property 

2400 def read_lat_sum_us(self): 

2401 """int: """ 

2402 return self._ptr[0].read_lat_sum_us 

2403  

2404 @read_lat_sum_us.setter 

2405 def read_lat_sum_us(self, val): 

2406 if self._readonly: 

2407 raise ValueError("This StatsLevel1 instance is read-only") 

2408 self._ptr[0].read_lat_sum_us = val 

2409  

2410 @property 

2411 def write_lat_sum_us(self): 

2412 """int: """ 

2413 return self._ptr[0].write_lat_sum_us 

2414  

2415 @write_lat_sum_us.setter 

2416 def write_lat_sum_us(self, val): 

2417 if self._readonly: 

2418 raise ValueError("This StatsLevel1 instance is read-only") 

2419 self._ptr[0].write_lat_sum_us = val 

2420  

2421 @property 

2422 def batch_read_bytes(self): 

2423 """int: """ 

2424 return self._ptr[0].batch_read_bytes 

2425  

2426 @batch_read_bytes.setter 

2427 def batch_read_bytes(self, val): 

2428 if self._readonly: 

2429 raise ValueError("This StatsLevel1 instance is read-only") 

2430 self._ptr[0].batch_read_bytes = val 

2431  

2432 @property 

2433 def batch_write_bytes(self): 

2434 """int: """ 

2435 return self._ptr[0].batch_write_bytes 

2436  

2437 @batch_write_bytes.setter 

2438 def batch_write_bytes(self, val): 

2439 if self._readonly: 

2440 raise ValueError("This StatsLevel1 instance is read-only") 

2441 self._ptr[0].batch_write_bytes = val 

2442  

2443 @property 

2444 def batch_read_bw_bytes(self): 

2445 """int: """ 

2446 return self._ptr[0].batch_read_bw_bytes 

2447  

2448 @batch_read_bw_bytes.setter 

2449 def batch_read_bw_bytes(self, val): 

2450 if self._readonly: 

2451 raise ValueError("This StatsLevel1 instance is read-only") 

2452 self._ptr[0].batch_read_bw_bytes = val 

2453  

2454 @property 

2455 def batch_write_bw_bytes(self): 

2456 """int: """ 

2457 return self._ptr[0].batch_write_bw_bytes 

2458  

2459 @batch_write_bw_bytes.setter 

2460 def batch_write_bw_bytes(self, val): 

2461 if self._readonly: 

2462 raise ValueError("This StatsLevel1 instance is read-only") 

2463 self._ptr[0].batch_write_bw_bytes = val 

2464  

2465 @property 

2466 def batch_submit_lat_avg_us(self): 

2467 """int: """ 

2468 return self._ptr[0].batch_submit_lat_avg_us 

2469  

2470 @batch_submit_lat_avg_us.setter 

2471 def batch_submit_lat_avg_us(self, val): 

2472 if self._readonly: 

2473 raise ValueError("This StatsLevel1 instance is read-only") 

2474 self._ptr[0].batch_submit_lat_avg_us = val 

2475  

2476 @property 

2477 def batch_completion_lat_avg_us(self): 

2478 """int: """ 

2479 return self._ptr[0].batch_completion_lat_avg_us 

2480  

2481 @batch_completion_lat_avg_us.setter 

2482 def batch_completion_lat_avg_us(self, val): 

2483 if self._readonly: 

2484 raise ValueError("This StatsLevel1 instance is read-only") 

2485 self._ptr[0].batch_completion_lat_avg_us = val 

2486  

2487 @property 

2488 def batch_submit_ops_per_sec(self): 

2489 """int: """ 

2490 return self._ptr[0].batch_submit_ops_per_sec 

2491  

2492 @batch_submit_ops_per_sec.setter 

2493 def batch_submit_ops_per_sec(self, val): 

2494 if self._readonly: 

2495 raise ValueError("This StatsLevel1 instance is read-only") 

2496 self._ptr[0].batch_submit_ops_per_sec = val 

2497  

2498 @property 

2499 def batch_complete_ops_per_sec(self): 

2500 """int: """ 

2501 return self._ptr[0].batch_complete_ops_per_sec 

2502  

2503 @batch_complete_ops_per_sec.setter 

2504 def batch_complete_ops_per_sec(self, val): 

2505 if self._readonly: 

2506 raise ValueError("This StatsLevel1 instance is read-only") 

2507 self._ptr[0].batch_complete_ops_per_sec = val 

2508  

2509 @property 

2510 def batch_submit_lat_sum_us(self): 

2511 """int: """ 

2512 return self._ptr[0].batch_submit_lat_sum_us 

2513  

2514 @batch_submit_lat_sum_us.setter 

2515 def batch_submit_lat_sum_us(self, val): 

2516 if self._readonly: 

2517 raise ValueError("This StatsLevel1 instance is read-only") 

2518 self._ptr[0].batch_submit_lat_sum_us = val 

2519  

2520 @property 

2521 def batch_completion_lat_sum_us(self): 

2522 """int: """ 

2523 return self._ptr[0].batch_completion_lat_sum_us 

2524  

2525 @batch_completion_lat_sum_us.setter 

2526 def batch_completion_lat_sum_us(self, val): 

2527 if self._readonly: 

2528 raise ValueError("This StatsLevel1 instance is read-only") 

2529 self._ptr[0].batch_completion_lat_sum_us = val 

2530  

2531 @property 

2532 def last_batch_read_bytes(self): 

2533 """int: """ 

2534 return self._ptr[0].last_batch_read_bytes 

2535  

2536 @last_batch_read_bytes.setter 

2537 def last_batch_read_bytes(self, val): 

2538 if self._readonly: 

2539 raise ValueError("This StatsLevel1 instance is read-only") 

2540 self._ptr[0].last_batch_read_bytes = val 

2541  

2542 @property 

2543 def last_batch_write_bytes(self): 

2544 """int: """ 

2545 return self._ptr[0].last_batch_write_bytes 

2546  

2547 @last_batch_write_bytes.setter 

2548 def last_batch_write_bytes(self, val): 

2549 if self._readonly: 

2550 raise ValueError("This StatsLevel1 instance is read-only") 

2551 self._ptr[0].last_batch_write_bytes = val 

2552  

2553 @property 

2554 def readv_bytes(self): 

2555 """int: """ 

2556 return self._ptr[0].readv_bytes 

2557  

2558 @readv_bytes.setter 

2559 def readv_bytes(self, val): 

2560 if self._readonly: 

2561 raise ValueError("This StatsLevel1 instance is read-only") 

2562 self._ptr[0].readv_bytes = val 

2563  

2564 @property 

2565 def writev_bytes(self): 

2566 """int: """ 

2567 return self._ptr[0].writev_bytes 

2568  

2569 @writev_bytes.setter 

2570 def writev_bytes(self, val): 

2571 if self._readonly: 

2572 raise ValueError("This StatsLevel1 instance is read-only") 

2573 self._ptr[0].writev_bytes = val 

2574  

2575 @property 

2576 def readv_bw_bytes_per_sec(self): 

2577 """int: """ 

2578 return self._ptr[0].readv_bw_bytes_per_sec 

2579  

2580 @readv_bw_bytes_per_sec.setter 

2581 def readv_bw_bytes_per_sec(self, val): 

2582 if self._readonly: 

2583 raise ValueError("This StatsLevel1 instance is read-only") 

2584 self._ptr[0].readv_bw_bytes_per_sec = val 

2585  

2586 @property 

2587 def writev_bw_bytes_per_sec(self): 

2588 """int: """ 

2589 return self._ptr[0].writev_bw_bytes_per_sec 

2590  

2591 @writev_bw_bytes_per_sec.setter 

2592 def writev_bw_bytes_per_sec(self, val): 

2593 if self._readonly: 

2594 raise ValueError("This StatsLevel1 instance is read-only") 

2595 self._ptr[0].writev_bw_bytes_per_sec = val 

2596  

2597 @property 

2598 def readv_lat_avg_us(self): 

2599 """int: """ 

2600 return self._ptr[0].readv_lat_avg_us 

2601  

2602 @readv_lat_avg_us.setter 

2603 def readv_lat_avg_us(self, val): 

2604 if self._readonly: 

2605 raise ValueError("This StatsLevel1 instance is read-only") 

2606 self._ptr[0].readv_lat_avg_us = val 

2607  

2608 @property 

2609 def writev_lat_avg_us(self): 

2610 """int: """ 

2611 return self._ptr[0].writev_lat_avg_us 

2612  

2613 @writev_lat_avg_us.setter 

2614 def writev_lat_avg_us(self, val): 

2615 if self._readonly: 

2616 raise ValueError("This StatsLevel1 instance is read-only") 

2617 self._ptr[0].writev_lat_avg_us = val 

2618  

2619 @property 

2620 def readv_ops_per_sec(self): 

2621 """int: """ 

2622 return self._ptr[0].readv_ops_per_sec 

2623  

2624 @readv_ops_per_sec.setter 

2625 def readv_ops_per_sec(self, val): 

2626 if self._readonly: 

2627 raise ValueError("This StatsLevel1 instance is read-only") 

2628 self._ptr[0].readv_ops_per_sec = val 

2629  

2630 @property 

2631 def writev_ops_per_sec(self): 

2632 """int: """ 

2633 return self._ptr[0].writev_ops_per_sec 

2634  

2635 @writev_ops_per_sec.setter 

2636 def writev_ops_per_sec(self, val): 

2637 if self._readonly: 

2638 raise ValueError("This StatsLevel1 instance is read-only") 

2639 self._ptr[0].writev_ops_per_sec = val 

2640  

2641 @property 

2642 def readv_lat_sum_us(self): 

2643 """int: """ 

2644 return self._ptr[0].readv_lat_sum_us 

2645  

2646 @readv_lat_sum_us.setter 

2647 def readv_lat_sum_us(self, val): 

2648 if self._readonly: 

2649 raise ValueError("This StatsLevel1 instance is read-only") 

2650 self._ptr[0].readv_lat_sum_us = val 

2651  

2652 @property 

2653 def writev_lat_sum_us(self): 

2654 """int: """ 

2655 return self._ptr[0].writev_lat_sum_us 

2656  

2657 @writev_lat_sum_us.setter 

2658 def writev_lat_sum_us(self, val): 

2659 if self._readonly: 

2660 raise ValueError("This StatsLevel1 instance is read-only") 

2661 self._ptr[0].writev_lat_sum_us = val 

2662  

2663 @staticmethod 

2664 def from_buffer(buffer): 

2665 """Create an StatsLevel1 instance with the memory from the given buffer.""" 

2666 return _cyb_from_buffer(buffer, sizeof(CUfileStatsLevel1_t), StatsLevel1) 

2667  

2668 @staticmethod 

2669 def from_data(data): 

2670 """Create an StatsLevel1 instance wrapping the given NumPy array. 

2671  

2672 Args: 

2673 data (_numpy.ndarray): a single-element array of dtype `stats_level1_dtype` holding the data. 

2674 """ 

2675 return _cyb_from_data(data, "stats_level1_dtype", stats_level1_dtype, StatsLevel1) 1bc

2676  

2677 @staticmethod 

2678 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): 

2679 """Create an StatsLevel1 instance wrapping the given pointer. 

2680  

2681 Args: 

2682 ptr (intptr_t): pointer address as Python :class:`int` to the data. 

2683 owner (object): The Python object that owns the pointer. If not provided, data will be copied. 

2684 readonly (bool): whether the data is read-only (to the user). default is `False`. 

2685 """ 

2686 if ptr == 0: 1bc

2687 raise ValueError("ptr must not be null (0)") 

2688 cdef StatsLevel1 obj = StatsLevel1.__new__(StatsLevel1) 1bc

2689 if owner is None: 1bc

2690 obj._ptr = <CUfileStatsLevel1_t *>_cyb_malloc(sizeof(CUfileStatsLevel1_t)) 

2691 if obj._ptr == NULL: 

2692 raise MemoryError("Error allocating StatsLevel1") 

2693 _cyb_memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(CUfileStatsLevel1_t)) 

2694 obj._owns_ptr = True 

2695 obj._owner = None 

2696 else: 

2697 obj._ptr = <CUfileStatsLevel1_t *>ptr 1bc

2698 obj._owns_ptr = False 1bc

2699 obj._owner = owner 1bc

2700 obj._readonly = readonly 1bc

2701 return obj 1bc

2702  

2703  

2704cdef _get_io_params_dtype_offsets(): 

2705 cdef CUfileIOParams_t pod 

2706 return _numpy.dtype({ 

2707 'names': ['mode', 'u', 'fh', 'opcode', 'cookie'], 

2708 'formats': [_numpy.int32, _py_anon_pod2_dtype, _numpy.intp, _numpy.int32, _numpy.intp], 

2709 'offsets': [ 

2710 (<intptr_t>&(pod.mode)) - (<intptr_t>&pod), 

2711 (<intptr_t>&(pod.u)) - (<intptr_t>&pod), 

2712 (<intptr_t>&(pod.fh)) - (<intptr_t>&pod), 

2713 (<intptr_t>&(pod.opcode)) - (<intptr_t>&pod), 

2714 (<intptr_t>&(pod.cookie)) - (<intptr_t>&pod), 

2715 ], 

2716 'itemsize': sizeof(CUfileIOParams_t), 

2717 }) 

2718  

2719io_params_dtype = _get_io_params_dtype_offsets() 

2720cdef object io_params_dtype_record = _numpy.dtype((_numpy.record, io_params_dtype)) 

2721  

2722cdef class IOParams: 

2723 """Empty-initialize an array of `CUfileIOParams_t`. 

2724 The resulting object is of length `size` and of dtype `io_params_dtype`. 

2725 If default-constructed, the instance represents a single struct. 

2726  

2727 Args: 

2728 size (int): number of structs, default=1. 

2729  

2730 .. seealso:: `CUfileIOParams_t` 

2731 """ 

2732 cdef: 

2733 readonly object _data 

2734 object _owner 

2735  

2736 def __init__(self, size=1): 

2737 self._data = _numpy.zeros(size, dtype=io_params_dtype_record) 1hljimk

2738 assert self._data.itemsize == sizeof(CUfileIOParams_t), \ 1hljimk

2739 f"itemsize {self._data.itemsize} mismatches struct size { sizeof(CUfileIOParams_t) }" 

2740  

2741 def __repr__(self): 

2742 if self._data.size > 1: 

2743 return f"<{__name__}.IOParams_Array_{self._data.size} object at {hex(id(self))}>" 

2744 else: 

2745 return f"<{__name__}.IOParams object at {hex(id(self))}>" 

2746  

2747 @property 

2748 def ptr(self): 

2749 """Get the pointer address to the data as Python :class:`int`.""" 

2750 return _cyb_array_ptr(self._data) 1hljimk

2751  

2752 cdef intptr_t _get_ptr(self): 

2753 return _cyb_array_ptr(self._data) 

2754  

2755 def __int__(self): 

2756 if self._data.size > 1 and not self._data.flags["C_CONTIGUOUS"]: 

2757 raise TypeError("int() argument must be a bytes-like object of size 1, or a " 

2758 "C-contiguous array. To get the pointer address of a " 

2759 "non-contiguous array, use .ptr") 

2760 return _cyb_array_ptr(self._data) 

2761  

2762 def __len__(self): 

2763 return self._data.size 

2764  

2765 def __eq__(self, other): 

2766 cdef object self_data = self._data 

2767 if (not isinstance(other, IOParams)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype: 

2768 return False 

2769 return bool((self_data == other._data).all()) 

2770  

2771 def __getbuffer__(self, Py_buffer *buffer, int flags): 

2772 _cyb_cpython.PyObject_GetBuffer(self._data, buffer, flags) 

2773  

2774 def __releasebuffer__(self, Py_buffer *buffer): 

2775 _cyb_cpython.PyBuffer_Release(buffer) 

2776  

2777 @property 

2778 def mode(self): 

2779 """Union[~_numpy.int32, int]: """ 

2780 if self._data.size == 1: 

2781 return int(self._data["mode"][0]) 

2782 return self._data["mode"] 

2783  

2784 @mode.setter 

2785 def mode(self, val): 

2786 if not self._data.flags.writeable: 1hljimk

2787 raise ValueError("This IOParams instance is read-only") 

2788 self._data["mode"] = val 1hljimk

2789  

2790 @property 

2791 def u(self): 

2792 """_py_anon_pod2_dtype: """ 

2793 return self._data["u"].view(_numpy.recarray) 1hljimk

2794  

2795 @u.setter 

2796 def u(self, val): 

2797 if not self._data.flags.writeable: 

2798 raise ValueError("This IOParams instance is read-only") 

2799 self._data["u"] = val 

2800  

2801 @property 

2802 def fh(self): 

2803 """Union[~_numpy.intp, int]: """ 

2804 if self._data.size == 1: 

2805 return int(self._data["fh"][0]) 

2806 return self._data["fh"] 

2807  

2808 @fh.setter 

2809 def fh(self, val): 

2810 if not self._data.flags.writeable: 1hljimk

2811 raise ValueError("This IOParams instance is read-only") 

2812 self._data["fh"] = val 1hljimk

2813  

2814 @property 

2815 def opcode(self): 

2816 """Union[~_numpy.int32, int]: """ 

2817 if self._data.size == 1: 

2818 return int(self._data["opcode"][0]) 

2819 return self._data["opcode"] 

2820  

2821 @opcode.setter 

2822 def opcode(self, val): 

2823 if not self._data.flags.writeable: 1hljimk

2824 raise ValueError("This IOParams instance is read-only") 

2825 self._data["opcode"] = val 1hljimk

2826  

2827 @property 

2828 def cookie(self): 

2829 """Union[~_numpy.intp, int]: """ 

2830 if self._data.size == 1: 

2831 return int(self._data["cookie"][0]) 

2832 return self._data["cookie"] 

2833  

2834 @cookie.setter 

2835 def cookie(self, val): 

2836 if not self._data.flags.writeable: 1hljimk

2837 raise ValueError("This IOParams instance is read-only") 

2838 self._data["cookie"] = val 1hljimk

2839  

2840 def __getitem__(self, key): 

2841 cdef ssize_t key_ 

2842 cdef ssize_t size 

2843 cdef IOParams obj 

2844 if isinstance(key, int): 1hljimk

2845 key_ = key 1hljimk

2846 size = self._data.size 1hljimk

2847 if key_ >= size or key_ <= -(size+1): 1hljimk

2848 raise IndexError("index is out of bounds") 

2849 if key_ < 0: 1hljimk

2850 key_ += size 

2851 obj = IOParams.__new__(IOParams) 1hljimk

2852 obj._data = self._data[key_:key_+1] 1hljimk

2853 obj._owner = self._owner 1hljimk

2854 return obj 1hljimk

2855 out = self._data[key] 

2856 if isinstance(out, _numpy.ndarray): 

2857 if out.dtype == io_params_dtype: 

2858 obj = IOParams.from_data(out) 

2859 obj._owner = self._owner 

2860 return obj 

2861 if out.dtype.names is not None: 

2862 return out.view(_numpy.recarray) 

2863 return out 

2864  

2865 def __setitem__(self, key, val): 

2866 self._data[key] = val 

2867  

2868 @staticmethod 

2869 def from_buffer(buffer): 

2870 """Create an IOParams instance with the memory from the given buffer.""" 

2871 return IOParams.from_data(_numpy.frombuffer(buffer, dtype=io_params_dtype)) 

2872  

2873 @staticmethod 

2874 def from_data(data): 

2875 """Create an IOParams instance wrapping the given NumPy array. 

2876  

2877 Args: 

2878 data (_numpy.ndarray): a 1D array of dtype `io_params_dtype` holding the data. 

2879 """ 

2880 cdef IOParams obj = IOParams.__new__(IOParams) 

2881 if not isinstance(data, _numpy.ndarray): 

2882 raise TypeError("data argument must be a NumPy ndarray") 

2883 if data.ndim != 1: 

2884 raise ValueError("data array must be 1D") 

2885 if data.dtype != io_params_dtype: 

2886 raise ValueError("data array must be of dtype io_params_dtype") 

2887 obj._data = data.view(dtype=io_params_dtype_record, type=_numpy.ndarray) 

2888 return obj 

2889  

2890 @staticmethod 

2891 def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False, object owner=None): 

2892 """Create an IOParams instance wrapping the given pointer. 

2893  

2894 Args: 

2895 ptr (intptr_t): pointer address as Python :class:`int` to the data. 

2896 size (int): number of structs, default=1. 

2897 readonly (bool): whether the data is read-only (to the user). default is `False`. 

2898 owner (object): object that owns the memory at *ptr*. A strong reference is 

2899 kept so the backing storage outlives this wrapper. 

2900 """ 

2901 if ptr == 0: 

2902 raise ValueError("ptr must not be null (0)") 

2903 cdef IOParams obj = IOParams.__new__(IOParams) 

2904 cdef flag = _cyb_cpython_buffer.PyBUF_READ if readonly else _cyb_cpython_buffer.PyBUF_WRITE 

2905 cdef object buf = _cyb_cpython_memoryview.PyMemoryView_FromMemory( 

2906 <char*>ptr, sizeof(CUfileIOParams_t) * size, flag) 

2907 obj._data = _numpy.ndarray(size, buffer=buf, dtype=io_params_dtype_record) 

2908 obj._owner = owner 

2909 return obj 

2910  

2911  

2912cdef _get_stats_level2_dtype_offsets(): 

2913 cdef CUfileStatsLevel2_t pod 

2914 return _numpy.dtype({ 

2915 'names': ['basic', 'read_size_kb_hist', 'write_size_kb_hist'], 

2916 'formats': [stats_level1_dtype, (_numpy.uint64, 32), (_numpy.uint64, 32)], 

2917 'offsets': [ 

2918 (<intptr_t>&(pod.basic)) - (<intptr_t>&pod), 

2919 (<intptr_t>&(pod.read_size_kb_hist)) - (<intptr_t>&pod), 

2920 (<intptr_t>&(pod.write_size_kb_hist)) - (<intptr_t>&pod), 

2921 ], 

2922 'itemsize': sizeof(CUfileStatsLevel2_t), 

2923 }) 

2924  

2925stats_level2_dtype = _get_stats_level2_dtype_offsets() 

2926  

2927cdef class StatsLevel2: 

2928 """Empty-initialize an instance of `CUfileStatsLevel2_t`. 

2929  

2930  

2931 .. seealso:: `CUfileStatsLevel2_t` 

2932 """ 

2933 cdef: 

2934 CUfileStatsLevel2_t *_ptr 

2935 object _owner 

2936 bint _owns_ptr 

2937 bint _readonly 

2938  

2939 def __init__(self): 

2940 self._ptr = <CUfileStatsLevel2_t *>_cyb_calloc(1, sizeof(CUfileStatsLevel2_t)) 1bc

2941 if self._ptr == NULL: 1bc

2942 raise MemoryError("Error allocating StatsLevel2") 

2943 self._owns_ptr = True 1bc

2944 self._owner = None 1bc

2945 self._readonly = False 1bc

2946  

2947 def __dealloc__(self): 

2948 cdef CUfileStatsLevel2_t *ptr 

2949 if self._owns_ptr and self._ptr != NULL: 1bdce

2950 ptr = self._ptr 1bc

2951 self._ptr = NULL 1bc

2952 _cyb_free(ptr) 1bc

2953  

2954 def __repr__(self): 

2955 return f"<{__name__}.StatsLevel2 object at {hex(id(self))}>" 

2956  

2957 @property 

2958 def ptr(self): 

2959 """Get the pointer address to the data as Python :class:`int`.""" 

2960 return <intptr_t>(self._ptr) 1bc

2961  

2962 cdef intptr_t _get_ptr(self): 

2963 return <intptr_t>(self._ptr) 

2964  

2965 def __int__(self): 

2966 return <intptr_t>(self._ptr) 

2967  

2968 def __eq__(self, other): 

2969 cdef StatsLevel2 other_ 

2970 if not isinstance(other, StatsLevel2): 

2971 return False 

2972 other_ = other 

2973 return (_cyb_memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(CUfileStatsLevel2_t)) == 0) 

2974  

2975 def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): 

2976 _cyb___getbuffer(self, buffer, <void *>self._ptr, sizeof(CUfileStatsLevel2_t), self._readonly) 

2977  

2978 def __releasebuffer__(self, Py_buffer *buffer): 

2979 pass 

2980  

2981 def __setitem__(self, key, val): 

2982 cdef _cyb_Py_buffer view 

2983 if key == 0: 

2984 if self._readonly: 

2985 raise ValueError("This StatsLevel2 instance is read-only") 

2986 _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) 

2987 try: 

2988 if <size_t>view.len < sizeof(CUfileStatsLevel2_t): 

2989 raise ValueError( 

2990 "source buffer too small: expected at least %d bytes, got %d" % (sizeof(CUfileStatsLevel2_t), view.len) 

2991 ) 

2992 _cyb_memmove(<void*>self._ptr, view.buf, sizeof(CUfileStatsLevel2_t)) 

2993 self._readonly = view.readonly != 0 

2994 finally: 

2995 _cyb_PyBuffer_Release(&view) 

2996 else: 

2997 setattr(self, key, val) 

2998  

2999 @property 

3000 def basic(self): 

3001 """StatsLevel1: """ 

3002 return StatsLevel1.from_ptr( 1bc

3003 <intptr_t>&(self._ptr[0].basic), 1bc

3004 readonly=self._readonly, 1bc

3005 owner=self, 1bc

3006 ) 

3007  

3008 @basic.setter 

3009 def basic(self, val): 

3010 if self._readonly: 

3011 raise ValueError("This StatsLevel2 instance is read-only") 

3012 cdef StatsLevel1 val_ = val 

3013 _cyb_memcpy(<void *>&(self._ptr[0].basic), <void *>(val_._get_ptr()), sizeof(CUfileStatsLevel1_t) * 1) 

3014  

3015 @property 

3016 def read_size_kb_hist(self): 

3017 """~_numpy.uint64: (array of length 32).""" 

3018 cdef _cyb_view.array arr = _cyb_view.array(shape=(32,), itemsize=sizeof(uint64_t), format="Q", mode="c", allocate_buffer=False) 1bdce

3019 arr.data = <char *>(&(self._ptr[0].read_size_kb_hist)) 1bdce

3020 return _numpy.asarray(arr) 1bdce

3021  

3022 @read_size_kb_hist.setter 

3023 def read_size_kb_hist(self, val): 

3024 if self._readonly: 

3025 raise ValueError("This StatsLevel2 instance is read-only") 

3026 if len(val) != 32: 

3027 raise ValueError(f"Expected length { 32 } for field read_size_kb_hist, got {len(val)}") 

3028 cdef _cyb_view.array arr = _cyb_view.array(shape=(32,), itemsize=sizeof(uint64_t), format="Q", mode="c") 

3029 arr[:] = _numpy.asarray(val, dtype=_numpy.uint64) 

3030 _cyb_memcpy(<void *>(&(self._ptr[0].read_size_kb_hist)), <void *>(arr.data), sizeof(uint64_t) * len(val)) 

3031  

3032 @property 

3033 def write_size_kb_hist(self): 

3034 """~_numpy.uint64: (array of length 32).""" 

3035 cdef _cyb_view.array arr = _cyb_view.array(shape=(32,), itemsize=sizeof(uint64_t), format="Q", mode="c", allocate_buffer=False) 1bc

3036 arr.data = <char *>(&(self._ptr[0].write_size_kb_hist)) 1bc

3037 return _numpy.asarray(arr) 1bc

3038  

3039 @write_size_kb_hist.setter 

3040 def write_size_kb_hist(self, val): 

3041 if self._readonly: 

3042 raise ValueError("This StatsLevel2 instance is read-only") 

3043 if len(val) != 32: 

3044 raise ValueError(f"Expected length { 32 } for field write_size_kb_hist, got {len(val)}") 

3045 cdef _cyb_view.array arr = _cyb_view.array(shape=(32,), itemsize=sizeof(uint64_t), format="Q", mode="c") 

3046 arr[:] = _numpy.asarray(val, dtype=_numpy.uint64) 

3047 _cyb_memcpy(<void *>(&(self._ptr[0].write_size_kb_hist)), <void *>(arr.data), sizeof(uint64_t) * len(val)) 

3048  

3049 @staticmethod 

3050 def from_buffer(buffer): 

3051 """Create an StatsLevel2 instance with the memory from the given buffer.""" 

3052 return _cyb_from_buffer(buffer, sizeof(CUfileStatsLevel2_t), StatsLevel2) 

3053  

3054 @staticmethod 

3055 def from_data(data): 

3056 """Create an StatsLevel2 instance wrapping the given NumPy array. 

3057  

3058 Args: 

3059 data (_numpy.ndarray): a single-element array of dtype `stats_level2_dtype` holding the data. 

3060 """ 

3061 return _cyb_from_data(data, "stats_level2_dtype", stats_level2_dtype, StatsLevel2) 1de

3062  

3063 @staticmethod 

3064 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): 

3065 """Create an StatsLevel2 instance wrapping the given pointer. 

3066  

3067 Args: 

3068 ptr (intptr_t): pointer address as Python :class:`int` to the data. 

3069 owner (object): The Python object that owns the pointer. If not provided, data will be copied. 

3070 readonly (bool): whether the data is read-only (to the user). default is `False`. 

3071 """ 

3072 if ptr == 0: 1de

3073 raise ValueError("ptr must not be null (0)") 

3074 cdef StatsLevel2 obj = StatsLevel2.__new__(StatsLevel2) 1de

3075 if owner is None: 1de

3076 obj._ptr = <CUfileStatsLevel2_t *>_cyb_malloc(sizeof(CUfileStatsLevel2_t)) 

3077 if obj._ptr == NULL: 

3078 raise MemoryError("Error allocating StatsLevel2") 

3079 _cyb_memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(CUfileStatsLevel2_t)) 

3080 obj._owns_ptr = True 

3081 obj._owner = None 

3082 else: 

3083 obj._ptr = <CUfileStatsLevel2_t *>ptr 1de

3084 obj._owns_ptr = False 1de

3085 obj._owner = owner 1de

3086 obj._readonly = readonly 1de

3087 return obj 1de

3088  

3089  

3090cdef _get_stats_level3_dtype_offsets(): 

3091 cdef CUfileStatsLevel3_t pod 

3092 return _numpy.dtype({ 

3093 'names': ['detailed', 'num_gpus', 'per_gpu_stats'], 

3094 'formats': [stats_level2_dtype, _numpy.uint32, (per_gpu_stats_dtype, 16)], 

3095 'offsets': [ 

3096 (<intptr_t>&(pod.detailed)) - (<intptr_t>&pod), 

3097 (<intptr_t>&(pod.num_gpus)) - (<intptr_t>&pod), 

3098 (<intptr_t>&(pod.per_gpu_stats)) - (<intptr_t>&pod), 

3099 ], 

3100 'itemsize': sizeof(CUfileStatsLevel3_t), 

3101 }) 

3102  

3103stats_level3_dtype = _get_stats_level3_dtype_offsets() 

3104  

3105cdef class StatsLevel3: 

3106 """Empty-initialize an instance of `CUfileStatsLevel3_t`. 

3107  

3108  

3109 .. seealso:: `CUfileStatsLevel3_t` 

3110 """ 

3111 cdef: 

3112 CUfileStatsLevel3_t _data 

3113 CUfileStatsLevel3_t *_ptr 

3114 object _owner 

3115 bint _readonly 

3116  

3117 def __init__(self): 

3118 self._ptr = &self._data 1de

3119 self._owner = None 1de

3120 self._readonly = False 1de

3121  

3122 def __repr__(self): 

3123 return f"<{__name__}.StatsLevel3 object at {hex(id(self))}>" 

3124  

3125 @property 

3126 def ptr(self): 

3127 """Get the pointer address to the data as Python :class:`int`.""" 

3128 return <intptr_t>(self._ptr) 1de

3129  

3130 cdef intptr_t _get_ptr(self): 

3131 return <intptr_t>(self._ptr) 

3132  

3133 def __int__(self): 

3134 return <intptr_t>(self._ptr) 

3135  

3136 def __eq__(self, other): 

3137 cdef StatsLevel3 other_ 

3138 if not isinstance(other, StatsLevel3): 

3139 return False 

3140 other_ = other 

3141 return (_cyb_memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(CUfileStatsLevel3_t)) == 0) 

3142  

3143 def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): 

3144 _cyb___getbuffer(self, buffer, <void *>self._ptr, sizeof(CUfileStatsLevel3_t), self._readonly) 

3145  

3146 def __releasebuffer__(self, Py_buffer *buffer): 

3147 pass 

3148  

3149 def __setitem__(self, key, val): 

3150 cdef _cyb_Py_buffer view 

3151 if key == 0: 

3152 if self._readonly: 

3153 raise ValueError("This StatsLevel3 instance is read-only") 

3154 _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) 

3155 try: 

3156 if <size_t>view.len < sizeof(CUfileStatsLevel3_t): 

3157 raise ValueError( 

3158 "source buffer too small: expected at least %d bytes, got %d" % (sizeof(CUfileStatsLevel3_t), view.len) 

3159 ) 

3160 _cyb_memmove(<void*>&self._data, view.buf, sizeof(CUfileStatsLevel3_t)) 

3161 self._ptr = &self._data 

3162 self._owner = None 

3163 self._readonly = view.readonly != 0 

3164 finally: 

3165 _cyb_PyBuffer_Release(&view) 

3166 else: 

3167 setattr(self, key, val) 

3168  

3169 @property 

3170 def detailed(self): 

3171 """StatsLevel2: """ 

3172 return StatsLevel2.from_ptr( 1de

3173 <intptr_t>&(self._ptr[0].detailed), 1de

3174 readonly=self._readonly, 1de

3175 owner=self, 1de

3176 ) 

3177  

3178 @detailed.setter 

3179 def detailed(self, val): 

3180 if self._readonly: 

3181 raise ValueError("This StatsLevel3 instance is read-only") 

3182 cdef StatsLevel2 val_ = val 

3183 _cyb_memcpy(<void *>&(self._ptr[0].detailed), <void *>(val_._get_ptr()), sizeof(CUfileStatsLevel2_t) * 1) 

3184  

3185 @property 

3186 def per_gpu_stats(self): 

3187 """PerGpuStats: """ 

3188 return PerGpuStats.from_ptr( 1de

3189 <intptr_t>&(self._ptr[0].per_gpu_stats), 1de

3190 16, 

3191 readonly=self._readonly, 1de

3192 owner=self, 1de

3193 ) 

3194  

3195 @per_gpu_stats.setter 

3196 def per_gpu_stats(self, val): 

3197 if self._readonly: 

3198 raise ValueError("This StatsLevel3 instance is read-only") 

3199 cdef PerGpuStats val_ = val 

3200 if len(val) != 16: 

3201 raise ValueError(f"Expected length { 16 } for field per_gpu_stats, got {len(val)}") 

3202 _cyb_memcpy(<void *>&(self._ptr[0].per_gpu_stats), <void *>(val_._get_ptr()), sizeof(CUfilePerGpuStats_t) * 16) 

3203  

3204 @property 

3205 def num_gpus(self): 

3206 """int: """ 

3207 return self._ptr[0].num_gpus 1de

3208  

3209 @num_gpus.setter 

3210 def num_gpus(self, val): 

3211 if self._readonly: 

3212 raise ValueError("This StatsLevel3 instance is read-only") 

3213 self._ptr[0].num_gpus = val 

3214  

3215 @staticmethod 

3216 def from_buffer(buffer): 

3217 """Create an StatsLevel3 instance with the memory from the given buffer.""" 

3218 return _cyb_from_buffer(buffer, sizeof(CUfileStatsLevel3_t), StatsLevel3) 

3219  

3220 @staticmethod 

3221 def from_data(data): 

3222 """Create an StatsLevel3 instance wrapping the given NumPy array. 

3223  

3224 Args: 

3225 data (_numpy.ndarray): a single-element array of dtype `stats_level3_dtype` holding the data. 

3226 """ 

3227 return _cyb_from_data(data, "stats_level3_dtype", stats_level3_dtype, StatsLevel3) 

3228  

3229 @staticmethod 

3230 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): 

3231 """Create an StatsLevel3 instance wrapping the given pointer. 

3232  

3233 Args: 

3234 ptr (intptr_t): pointer address as Python :class:`int` to the data. 

3235 owner (object): The Python object that owns the pointer. If not provided, data will be copied. 

3236 readonly (bool): whether the data is read-only (to the user). default is `False`. 

3237 """ 

3238 if ptr == 0: 

3239 raise ValueError("ptr must not be null (0)") 

3240 cdef StatsLevel3 obj = StatsLevel3.__new__(StatsLevel3) 

3241 if owner is None: 

3242 _cyb_memcpy(<void*>&obj._data, <void*>ptr, sizeof(CUfileStatsLevel3_t)) 

3243 obj._ptr = &obj._data 

3244 obj._owner = None 

3245 else: 

3246 obj._ptr = <CUfileStatsLevel3_t *>ptr 

3247 obj._owner = owner 

3248 obj._readonly = readonly 

3249 return obj 

3250  

3251  

3252############################################################################### 

3253# Enum 

3254############################################################################### 

3255  

3256class OpError(_cyb_FastEnum): 

3257 """ 

3258 See `CUfileOpError`. 

3259 """ 

3260 SUCCESS = CU_FILE_SUCCESS 

3261 DRIVER_NOT_INITIALIZED = CU_FILE_DRIVER_NOT_INITIALIZED 

3262 DRIVER_INVALID_PROPS = CU_FILE_DRIVER_INVALID_PROPS 

3263 DRIVER_UNSUPPORTED_LIMIT = CU_FILE_DRIVER_UNSUPPORTED_LIMIT 

3264 DRIVER_VERSION_MISMATCH = CU_FILE_DRIVER_VERSION_MISMATCH 

3265 DRIVER_VERSION_READ_ERROR = CU_FILE_DRIVER_VERSION_READ_ERROR 

3266 DRIVER_CLOSING = CU_FILE_DRIVER_CLOSING 

3267 PLATFORM_NOT_SUPPORTED = CU_FILE_PLATFORM_NOT_SUPPORTED 

3268 IO_NOT_SUPPORTED = CU_FILE_IO_NOT_SUPPORTED 

3269 DEVICE_NOT_SUPPORTED = CU_FILE_DEVICE_NOT_SUPPORTED 

3270 NVFS_DRIVER_ERROR = CU_FILE_NVFS_DRIVER_ERROR 

3271 CUDA_DRIVER_ERROR = CU_FILE_CUDA_DRIVER_ERROR 

3272 CUDA_POINTER_INVALID = CU_FILE_CUDA_POINTER_INVALID 

3273 CUDA_MEMORY_TYPE_INVALID = CU_FILE_CUDA_MEMORY_TYPE_INVALID 

3274 CUDA_POINTER_RANGE_ERROR = CU_FILE_CUDA_POINTER_RANGE_ERROR 

3275 CUDA_CONTEXT_MISMATCH = CU_FILE_CUDA_CONTEXT_MISMATCH 

3276 INVALID_MAPPING_SIZE = CU_FILE_INVALID_MAPPING_SIZE 

3277 INVALID_MAPPING_RANGE = CU_FILE_INVALID_MAPPING_RANGE 

3278 INVALID_FILE_TYPE = CU_FILE_INVALID_FILE_TYPE 

3279 INVALID_FILE_OPEN_FLAG = CU_FILE_INVALID_FILE_OPEN_FLAG 

3280 DIO_NOT_SET = CU_FILE_DIO_NOT_SET 

3281 INVALID_VALUE = CU_FILE_INVALID_VALUE 

3282 MEMORY_ALREADY_REGISTERED = CU_FILE_MEMORY_ALREADY_REGISTERED 

3283 MEMORY_NOT_REGISTERED = CU_FILE_MEMORY_NOT_REGISTERED 

3284 PERMISSION_DENIED = CU_FILE_PERMISSION_DENIED 

3285 DRIVER_ALREADY_OPEN = CU_FILE_DRIVER_ALREADY_OPEN 

3286 HANDLE_NOT_REGISTERED = CU_FILE_HANDLE_NOT_REGISTERED 

3287 HANDLE_ALREADY_REGISTERED = CU_FILE_HANDLE_ALREADY_REGISTERED 

3288 DEVICE_NOT_FOUND = CU_FILE_DEVICE_NOT_FOUND 

3289 INTERNAL_ERROR = CU_FILE_INTERNAL_ERROR 

3290 GETNEWFD_FAILED = CU_FILE_GETNEWFD_FAILED 

3291 NVFS_SETUP_ERROR = CU_FILE_NVFS_SETUP_ERROR 

3292 IO_DISABLED = CU_FILE_IO_DISABLED 

3293 BATCH_SUBMIT_FAILED = CU_FILE_BATCH_SUBMIT_FAILED 

3294 GPU_MEMORY_PINNING_FAILED = CU_FILE_GPU_MEMORY_PINNING_FAILED 

3295 BATCH_FULL = CU_FILE_BATCH_FULL 

3296 ASYNC_NOT_SUPPORTED = CU_FILE_ASYNC_NOT_SUPPORTED 

3297 INTERNAL_BATCH_SETUP_ERROR = CU_FILE_INTERNAL_BATCH_SETUP_ERROR 

3298 INTERNAL_BATCH_SUBMIT_ERROR = CU_FILE_INTERNAL_BATCH_SUBMIT_ERROR 

3299 INTERNAL_BATCH_GETSTATUS_ERROR = CU_FILE_INTERNAL_BATCH_GETSTATUS_ERROR 

3300 INTERNAL_BATCH_CANCEL_ERROR = CU_FILE_INTERNAL_BATCH_CANCEL_ERROR 

3301 NOMEM_ERROR = CU_FILE_NOMEM_ERROR 

3302 IO_ERROR = CU_FILE_IO_ERROR 

3303 INTERNAL_BUF_REGISTER_ERROR = CU_FILE_INTERNAL_BUF_REGISTER_ERROR 

3304 HASH_OPR_ERROR = CU_FILE_HASH_OPR_ERROR 

3305 INVALID_CONTEXT_ERROR = CU_FILE_INVALID_CONTEXT_ERROR 

3306 NVFS_INTERNAL_DRIVER_ERROR = CU_FILE_NVFS_INTERNAL_DRIVER_ERROR 

3307 BATCH_NOCOMPAT_ERROR = CU_FILE_BATCH_NOCOMPAT_ERROR 

3308 IO_MAX_ERROR = CU_FILE_IO_MAX_ERROR 

3309  

3310class DriverStatusFlags(_cyb_FastEnum): 

3311 """ 

3312 See `CUfileDriverStatusFlags_t`. 

3313 """ 

3314 LUSTRE_SUPPORTED = (CU_FILE_LUSTRE_SUPPORTED, 'Support for DDN LUSTRE') 

3315 WEKAFS_SUPPORTED = (CU_FILE_WEKAFS_SUPPORTED, 'Support for WEKAFS') 

3316 NFS_SUPPORTED = (CU_FILE_NFS_SUPPORTED, 'Support for NFS') 

3317 GPFS_SUPPORTED = CU_FILE_GPFS_SUPPORTED 

3318 NVME_SUPPORTED = (CU_FILE_NVME_SUPPORTED, '< Support for GPFS Support for NVMe') 

3319 NVMEOF_SUPPORTED = (CU_FILE_NVMEOF_SUPPORTED, 'Support for NVMeOF') 

3320 SCSI_SUPPORTED = (CU_FILE_SCSI_SUPPORTED, 'Support for SCSI') 

3321 SCALEFLUX_CSD_SUPPORTED = (CU_FILE_SCALEFLUX_CSD_SUPPORTED, 'Support for Scaleflux CSD') 

3322 NVMESH_SUPPORTED = (CU_FILE_NVMESH_SUPPORTED, 'Support for NVMesh Block Dev') 

3323 BEEGFS_SUPPORTED = (CU_FILE_BEEGFS_SUPPORTED, 'Support for BeeGFS') 

3324 NVME_P2P_SUPPORTED = (CU_FILE_NVME_P2P_SUPPORTED, 'Do not use this macro. This is deprecated now') 

3325 SCATEFS_SUPPORTED = (CU_FILE_SCATEFS_SUPPORTED, 'Support for ScateFS') 

3326 VIRTIOFS_SUPPORTED = (CU_FILE_VIRTIOFS_SUPPORTED, 'Support for VirtioFS') 

3327 MAX_TARGET_TYPES = (CU_FILE_MAX_TARGET_TYPES, 'Maximum FS supported') 

3328  

3329class DriverControlFlags(_cyb_FastEnum): 

3330 """ 

3331 See `CUfileDriverControlFlags_t`. 

3332 """ 

3333 USE_POLL_MODE = (CU_FILE_USE_POLL_MODE, 'use POLL mode. properties.use_poll_mode') 

3334 ALLOW_COMPAT_MODE = (CU_FILE_ALLOW_COMPAT_MODE, 'allow COMPATIBILITY mode. properties.allow_compat_mode') 

3335 VANILLA_POSIX_IO_MODE = (CU_FILE_VANILLA_POSIX_IO_MODE, 'Vanilla posix io mode. properties.vanilla_posix_io_mode') 

3336 POSIX_IO_MODE = (CU_FILE_POSIX_IO_MODE, 'alias for backward compatibility') 

3337 FALLBACK_IO_MODE = (CU_FILE_FALLBACK_IO_MODE, 'Fallback io mode. properties.gds_fallback_io') 

3338  

3339class FeatureFlags(_cyb_FastEnum): 

3340 """ 

3341 See `CUfileFeatureFlags_t`. 

3342 """ 

3343 DYN_ROUTING_SUPPORTED = (CU_FILE_DYN_ROUTING_SUPPORTED, 'Support for Dynamic routing to handle devices across the PCIe bridges') 

3344 BATCH_IO_SUPPORTED = (CU_FILE_BATCH_IO_SUPPORTED, 'Supported') 

3345 STREAMS_SUPPORTED = (CU_FILE_STREAMS_SUPPORTED, 'Supported') 

3346 PARALLEL_IO_SUPPORTED = (CU_FILE_PARALLEL_IO_SUPPORTED, 'Supported') 

3347 P2P_SUPPORTED = (CU_FILE_P2P_SUPPORTED, 'Support for PCI P2PDMA') 

3348  

3349class FileHandleType(_cyb_FastEnum): 

3350 """ 

3351 See `CUfileFileHandleType`. 

3352 """ 

3353 OPAQUE_FD = (CU_FILE_HANDLE_TYPE_OPAQUE_FD, 'Linux based fd') 

3354 OPAQUE_WIN32 = (CU_FILE_HANDLE_TYPE_OPAQUE_WIN32, 'Windows based handle (unsupported)') 

3355 USERSPACE_FS = CU_FILE_HANDLE_TYPE_USERSPACE_FS 

3356  

3357class Opcode(_cyb_FastEnum): 

3358 """ 

3359 See `CUfileOpcode_t`. 

3360 """ 

3361 READ = CUFILE_READ 

3362 WRITE = CUFILE_WRITE 

3363  

3364class Status(_cyb_FastEnum): 

3365 """ 

3366 See `CUfileStatus_t`. 

3367 """ 

3368 WAITING = CUFILE_WAITING 

3369 PENDING = CUFILE_PENDING 

3370 INVALID = CUFILE_INVALID 

3371 CANCELED = CUFILE_CANCELED 

3372 COMPLETE = CUFILE_COMPLETE 

3373 TIMEOUT = CUFILE_TIMEOUT 

3374 FAILED = CUFILE_FAILED 

3375  

3376class BatchMode(_cyb_FastEnum): 

3377 """ 

3378 See `CUfileBatchMode_t`. 

3379 """ 

3380 BATCH = CUFILE_BATCH 

3381  

3382class SizeTConfigParameter(_cyb_FastEnum): 

3383 """ 

3384 See `CUFileSizeTConfigParameter_t`. 

3385 """ 

3386 PROFILE_STATS = CUFILE_PARAM_PROFILE_STATS 

3387 EXECUTION_MAX_IO_QUEUE_DEPTH = CUFILE_PARAM_EXECUTION_MAX_IO_QUEUE_DEPTH 

3388 EXECUTION_MAX_IO_THREADS = CUFILE_PARAM_EXECUTION_MAX_IO_THREADS 

3389 EXECUTION_MIN_IO_THRESHOLD_SIZE_KB = CUFILE_PARAM_EXECUTION_MIN_IO_THRESHOLD_SIZE_KB 

3390 EXECUTION_MAX_REQUEST_PARALLELISM = CUFILE_PARAM_EXECUTION_MAX_REQUEST_PARALLELISM 

3391 PROPERTIES_MAX_DIRECT_IO_SIZE_KB = CUFILE_PARAM_PROPERTIES_MAX_DIRECT_IO_SIZE_KB 

3392 PROPERTIES_MAX_DEVICE_CACHE_SIZE_KB = CUFILE_PARAM_PROPERTIES_MAX_DEVICE_CACHE_SIZE_KB 

3393 PROPERTIES_PER_BUFFER_CACHE_SIZE_KB = CUFILE_PARAM_PROPERTIES_PER_BUFFER_CACHE_SIZE_KB 

3394 PROPERTIES_MAX_DEVICE_PINNED_MEM_SIZE_KB = CUFILE_PARAM_PROPERTIES_MAX_DEVICE_PINNED_MEM_SIZE_KB 

3395 PROPERTIES_IO_BATCHSIZE = CUFILE_PARAM_PROPERTIES_IO_BATCHSIZE 

3396 POLLTHRESHOLD_SIZE_KB = CUFILE_PARAM_POLLTHRESHOLD_SIZE_KB 

3397 PROPERTIES_BATCH_IO_TIMEOUT_MS = CUFILE_PARAM_PROPERTIES_BATCH_IO_TIMEOUT_MS 

3398  

3399class BoolConfigParameter(_cyb_FastEnum): 

3400 """ 

3401 See `CUFileBoolConfigParameter_t`. 

3402 """ 

3403 PROPERTIES_USE_POLL_MODE = CUFILE_PARAM_PROPERTIES_USE_POLL_MODE 

3404 PROPERTIES_ALLOW_COMPAT_MODE = CUFILE_PARAM_PROPERTIES_ALLOW_COMPAT_MODE 

3405 FORCE_COMPAT_MODE = CUFILE_PARAM_FORCE_COMPAT_MODE 

3406 FS_MISC_API_CHECK_AGGRESSIVE = CUFILE_PARAM_FS_MISC_API_CHECK_AGGRESSIVE 

3407 EXECUTION_PARALLEL_IO = CUFILE_PARAM_EXECUTION_PARALLEL_IO 

3408 PROFILE_NVTX = CUFILE_PARAM_PROFILE_NVTX 

3409 PROPERTIES_ALLOW_SYSTEM_MEMORY = CUFILE_PARAM_PROPERTIES_ALLOW_SYSTEM_MEMORY 

3410 USE_PCIP2PDMA = CUFILE_PARAM_USE_PCIP2PDMA 

3411 PREFER_IO_URING = CUFILE_PARAM_PREFER_IO_URING 

3412 FORCE_ODIRECT_MODE = CUFILE_PARAM_FORCE_ODIRECT_MODE 

3413 SKIP_TOPOLOGY_DETECTION = CUFILE_PARAM_SKIP_TOPOLOGY_DETECTION 

3414 STREAM_MEMOPS_BYPASS = CUFILE_PARAM_STREAM_MEMOPS_BYPASS 

3415 PROPERTIES_POSIX_IO_MODE = CUFILE_PARAM_PROPERTIES_POSIX_IO_MODE 

3416 GDS_FALLBACK_IO = CUFILE_PARAM_GDS_FALLBACK_IO 

3417  

3418class StringConfigParameter(_cyb_FastEnum): 

3419 """ 

3420 See `CUFileStringConfigParameter_t`. 

3421 """ 

3422 LOGGING_LEVEL = CUFILE_PARAM_LOGGING_LEVEL 

3423 ENV_LOGFILE_PATH = CUFILE_PARAM_ENV_LOGFILE_PATH 

3424 LOG_DIR = CUFILE_PARAM_LOG_DIR 

3425 RDMA_TRANSPORT = CUFILE_PARAM_RDMA_TRANSPORT 

3426  

3427class ArrayConfigParameter(_cyb_FastEnum): 

3428 """ 

3429 See `CUFileArrayConfigParameter_t`. 

3430 """ 

3431 POSIX_POOL_SLAB_SIZE_KB = CUFILE_PARAM_POSIX_POOL_SLAB_SIZE_KB 

3432 POSIX_POOL_SLAB_COUNT = CUFILE_PARAM_POSIX_POOL_SLAB_COUNT 

3433 GPU_BOUNCE_BUFFER_SLAB_SIZE_KB = CUFILE_PARAM_GPU_BOUNCE_BUFFER_SLAB_SIZE_KB 

3434 GPU_BOUNCE_BUFFER_SLAB_COUNT = CUFILE_PARAM_GPU_BOUNCE_BUFFER_SLAB_COUNT 

3435  

3436class P2PFlags(_cyb_FastEnum): 

3437 """ 

3438 See `CUfileP2PFlags_t`. 

3439 """ 

3440 P2PDMA = (CUFILE_P2PDMA, 'Support for PCI P2PDMA') 

3441 NVFS = (CUFILE_NVFS, 'Support for nvidia-fs') 

3442 DMABUF = (CUFILE_DMABUF, 'Support for DMA Buffer') 

3443 C2C = (CUFILE_C2C, 'Support for Chip-to-Chip (Grace-based systems)') 

3444 NVIDIA_PEERMEM = (CUFILE_NVIDIA_PEERMEM, 'Only for IBM Spectrum Scale and WekaFS') 

3445  

3446  

3447############################################################################### 

3448# Error handling 

3449############################################################################### 

3450  

3451ctypedef fused ReturnT: 

3452 CUfileError_t 

3453 ssize_t 

3454  

3455  

3456class cuFileError(Exception): 

3457  

3458 def __init__(self, status, cu_err=None): 

3459 self.status = status 1HzDIAE

3460 self.cuda_error = cu_err 1HzDIAE

3461 s = OpError(status) 1HzDIAE

3462 cdef str err = f"{s.name} ({s.value}): {op_status_error(status)}" 1HzDIAE

3463 if cu_err is not None: 1HzDIAE

3464 e = pyCUresult(cu_err) 

3465 err += f"; CUDA status: {e.name} ({e.value})" 

3466 super(cuFileError, self).__init__(err) 1HzDIAE

3467  

3468 def __reduce__(self): 

3469 return (type(self), (self.status, self.cuda_error)) 

3470  

3471  

3472@cython.profile(False) 

3473cdef int check_status(ReturnT status) except 1 nogil: 

3474 if ReturnT is CUfileError_t: 

3475 if IS_CUDA_ERR(status): 2a h @ [ l ] ^ j _ ` H { | 9 } ~ ! abbb# cbdb$ ebfb% gbhbn ibjbp kblbq mbnbr obpbs qbrbt sbtb: ubvb; wbxbf Z L b 0 M d 1 N B ybzbF J z ' O ( AbD 2 P Q 3 R i BbCbm DbEbk FbGbI HbIb) JbKb* LbMb+ NbOb, - Pb. QbRbo SbTbu UbVbv WbXbw YbZbx 0b1by 2b3b= 4b5b? 6b7bg 4 S c 5 T e 6 U C 8b9bG K A V / !bE 7 W X 8 Y

3476 with gil: 

3477 raise cuFileError(status.err, status.cu_err) 

3478 elif IS_CUFILE_ERR(status.err): 2a h @ [ l ] ^ j _ ` H { | 9 } ~ ! abbb# cbdb$ ebfb% gbhbn ibjbp kblbq mbnbr obpbs qbrbt sbtb: ubvb; wbxbf Z L b 0 M d 1 N B ybzbF J z ' O ( AbD 2 P Q 3 R i BbCbm DbEbk FbGbI HbIb) JbKb* LbMb+ NbOb, - Pb. QbRbo SbTbu UbVbv WbXbw YbZbx 0b1by 2b3b= 4b5b? 6b7bg 4 S c 5 T e 6 U C 8b9bG K A V / !bE 7 W X 8 Y

3479 with gil: 1HzDIAE

3480 raise cuFileError(status.err) 1HzDIAE

3481 elif ReturnT is ssize_t: 

3482 if status == -1: 1qrsfbdvwxgce

3483 # note: this assumes cuFile already properly resets errno in each API 

3484 with gil: 

3485 raise cuFileError(errno.errno) 

3486 return 0 2a h @ [ l ] ^ j _ ` H { | 9 } ~ ! abbb# cbdb$ ebfb% gbhbn ibjbp kblbq mbnbr obpbs qbrbt sbtb: ubvb; wbxbf Z L b 0 M d 1 N B ybzbF J z ' O ( AbD 2 P Q 3 R i BbCbm DbEbk FbGbI HbIb) JbKb* LbMb+ NbOb, - Pb. QbRbo SbTbu UbVbv WbXbw YbZbx 0b1by 2b3b= 4b5b? 6b7bg 4 S c 5 T e 6 U C 8b9bG K A V / !bE 7 W X 8 Y

3487  

3488  

3489############################################################################### 

3490# Wrapper functions 

3491############################################################################### 

3492  

3493cpdef intptr_t handle_register(descr) except? 0: 

3494 """cuFileHandleRegister is required, and performs extra checking that is memoized to provide increased performance on later cuFile operations. 

3495  

3496 Description cuFileHandleRegister registers the open file descriptor for use 

3497 with cuFile IO operations. 

3498 This API will ensure that the file's descriptor is checked for GPUDirect 

3499 Storage support and returns a valid file handle on CU_FILE_SUCCESS. 

3500  

3501 Args: 

3502 descr (intptr_t): ``CUfileDescr_t`` file descriptor (OS agnostic). 

3503  

3504 Returns: 

3505 intptr_t: ``CUfileHandle_t`` opaque file handle for IO operations. 

3506  

3507 .. note:: 

3508 the file needs to be opened in O_DIRECT mode to support GPUDirect Storage. 

3509 .. seealso:: `cuFileHandleRegister` 

3510 """ 

3511 cdef intptr_t _descr_ptr_ = 0 if descr is None else int(descr) 1hljnpqrstfbdBimkouvwxygceC

3512 cdef Handle fh 

3513 with nogil: 1hljnpqrstfbdBimkouvwxygceC

3514 __status__ = cuFileHandleRegister(&fh, <CUfileDescr_t*>_descr_ptr_) 1hljnpqrstfbdBimkouvwxygceC

3515 check_status(__status__) 1hljnpqrstfbdBimkouvwxygceC

3516 return <intptr_t>fh 1hljnpqrstfbdBimkouvwxygceC

3517  

3518  

3519cpdef void handle_deregister(intptr_t fh) except*: 

3520 """releases a registered filehandle from cuFile. 

3521  

3522  

3523 Args: 

3524 fh (intptr_t): ``CUfileHandle_t`` file handle. 

3525  

3526 .. seealso:: `cuFileHandleDeregister` 

3527 """ 

3528 with nogil: 1hljnpqrstfbdBimkouvwxygceC

3529 cuFileHandleDeregister(<Handle>fh) 1hljnpqrstfbdBimkouvwxygceC

3530  

3531  

3532cpdef buf_register(intptr_t buf_ptr_base, size_t length, int flags): 

3533 """register an existing cudaMalloced memory with cuFile to pin for GPUDirect Storage access or register host allocated memory with cuFile. 

3534  

3535  

3536 Args: 

3537 buf_ptr_base (intptr_t): buffer pointer allocated. 

3538 length (size_t): size of memory region from the above specified 

3539 bufPtr. 

3540 flags (int): CU_FILE_RDMA_REGISTER. 

3541  

3542 .. note:: 

3543 This memory will be use to perform GPU direct DMA from the supported storage. 

3544 .. note:: 

3545 This API is intended for usecases where the memory is used as streaming buffer 

3546 that is reused across multiple cuFile IO operations before calling 

3547 ``cuFileBufDeregister``. 

3548 .. seealso:: `cuFileBufRegister` 

3549 """ 

3550 with nogil: 1hljH9!#$%npqrstfbdimkI)*+,.ouvwxygce

3551 __status__ = cuFileBufRegister(<const void*>buf_ptr_base, length, flags) 1hljH9!#$%npqrstfbdimkI)*+,.ouvwxygce

3552 check_status(__status__) 1hljH9!#$%npqrstfbdimkI)*+,.ouvwxygce

3553  

3554  

3555cpdef buf_deregister(intptr_t buf_ptr_base): 

3556 """deregister an already registered device or host memory from cuFile. 

3557  

3558  

3559 Args: 

3560 buf_ptr_base (intptr_t): buffer pointer to deregister. 

3561  

3562 .. seealso:: `cuFileBufDeregister` 

3563 """ 

3564 with nogil: 1hljH9!#$%npqrstfbdimkI)*+,.ouvwxygce

3565 __status__ = cuFileBufDeregister(<const void*>buf_ptr_base) 1hljH9!#$%npqrstfbdimkI)*+,.ouvwxygce

3566 check_status(__status__) 1hljH9!#$%npqrstfbdimkI)*+,.ouvwxygce

3567  

3568  

3569cpdef driver_open(): 

3570 """Initialize the cuFile library and open the nvidia-fs driver. 

3571  

3572  

3573 .. seealso:: `cuFileDriverOpen` 

3574 """ 

3575 with nogil: 2@ ] _ { } abcbebgbibkbmbobqbsbubwbZ 0 1 ybF J z ' O ( 2 3 BbDbFbHbJbLbNb- QbSbUbWbYb0b2b4b6b4 5 6 8bG K A V / 7 8

3576 __status__ = cuFileDriverOpen() 2@ ] _ { } abcbebgbibkbmbobqbsbubwbZ 0 1 ybF J z ' O ( 2 3 BbDbFbHbJbLbNb- QbSbUbWbYb0b2b4b6b4 5 6 8bG K A V / 7 8

3577 check_status(__status__) 2@ ] _ { } abcbebgbibkbmbobqbsbubwbZ 0 1 ybF J z ' O ( 2 3 BbDbFbHbJbLbNb- QbSbUbWbYb0b2b4b6b4 5 6 8bG K A V / 7 8

3578  

3579  

3580cpdef use_count(): 

3581 """returns use count of cufile drivers at that moment by the process. 

3582  

3583  

3584 .. seealso:: `cuFileUseCount` 

3585 """ 

3586 with nogil: 

3587 __status__ = cuFileUseCount() 

3588 check_status(__status__) 

3589  

3590  

3591cpdef driver_get_properties(intptr_t props): 

3592 """Gets the Driver session properties If the driver is not opened, it will return the staged/default properties If the driver is opened, it will return the current properties. 

3593  

3594  

3595 Args: 

3596 props (intptr_t): Properties to get. 

3597  

3598 .. seealso:: `cuFileDriverGetProperties` 

3599 """ 

3600 with nogil: 

3601 __status__ = cuFileDriverGetProperties(<CUfileDrvProps_t*>props) 

3602 check_status(__status__) 

3603  

3604  

3605cpdef driver_set_poll_mode(bint poll, size_t poll_threshold_size): 

3606 """Sets whether the Read/Write APIs use polling to do IO operations This takes place before the driver is opened. No-op if driver is already open. 

3607  

3608  

3609 Args: 

3610 poll (bint): boolean to indicate whether to use poll mode or not. 

3611 poll_threshold_size (size_t): max IO size to use for POLLING mode 

3612 in KB. 

3613  

3614 .. note:: 

3615 This is an advanced command and should be tuned based on available system 

3616 memory. 

3617 .. seealso:: `cuFileDriverSetPollMode` 

3618 """ 

3619 with nogil: 

3620 __status__ = cuFileDriverSetPollMode(<_cyb_bool>poll, poll_threshold_size) 

3621 check_status(__status__) 

3622  

3623  

3624cpdef driver_set_max_direct_io_size(size_t max_direct_io_size): 

3625 """Control parameter to set max IO size(KB) used by the library to talk to nvidia-fs driver This takes place before the driver is opened. No-op if driver is already open. 

3626  

3627  

3628 Args: 

3629 max_direct_io_size (size_t): maximum allowed direct io size in KB. 

3630  

3631 .. note:: 

3632 This is an advanced command and should be tuned based on available system 

3633 memory. 

3634 .. seealso:: `cuFileDriverSetMaxDirectIOSize` 

3635 """ 

3636 with nogil: 

3637 __status__ = cuFileDriverSetMaxDirectIOSize(max_direct_io_size) 

3638 check_status(__status__) 

3639  

3640  

3641cpdef driver_set_max_cache_size(size_t max_cache_size): 

3642 """Control parameter to set maximum GPU memory reserved per device by the library for internal buffering This takes place before the driver is opened. No-op if driver is already open. 

3643  

3644  

3645 Args: 

3646 max_cache_size (size_t): The maximum GPU buffer space per device 

3647 used for internal use in KB. 

3648  

3649 .. note:: 

3650 This is an advanced command and should be tuned based on supported GPU memory. 

3651 .. seealso:: `cuFileDriverSetMaxCacheSize` 

3652 """ 

3653 with nogil: 

3654 __status__ = cuFileDriverSetMaxCacheSize(max_cache_size) 

3655 check_status(__status__) 

3656  

3657  

3658cpdef driver_set_max_pinned_mem_size(size_t max_pinned_size): 

3659 """Sets maximum buffer space that is pinned in KB for use by ``cuFileBufRegister`` This takes place before the driver is opened. No-op if driver is already open. 

3660  

3661  

3662 Args: 

3663 max_pinned_size (size_t): maximum buffer space that is pinned in 

3664 KB. 

3665  

3666 .. note:: 

3667 This is an advanced command and should be tuned based on supported GPU memory. 

3668 .. seealso:: `cuFileDriverSetMaxPinnedMemSize` 

3669 """ 

3670 with nogil: 

3671 __status__ = cuFileDriverSetMaxPinnedMemSize(max_pinned_size) 

3672 check_status(__status__) 

3673  

3674  

3675cpdef intptr_t batch_io_set_up(unsigned nr) except? 0: 

3676 cdef BatchHandle batch_idp 

3677 with nogil: 1hljimk

3678 __status__ = cuFileBatchIOSetUp(&batch_idp, nr) 1hljimk

3679 check_status(__status__) 1hljimk

3680 return <intptr_t>batch_idp 1hljimk

3681  

3682  

3683cpdef batch_io_submit(intptr_t batch_idp, unsigned nr, iocbp, unsigned int flags): 

3684 cdef intptr_t _iocbp_ptr_ = 0 if iocbp is None else int(iocbp) 1hljimk

3685 with nogil: 1hljimk

3686 __status__ = cuFileBatchIOSubmit(<BatchHandle>batch_idp, nr, <CUfileIOParams_t*>_iocbp_ptr_, flags) 1hljimk

3687 check_status(__status__) 1hljimk

3688  

3689  

3690cpdef batch_io_get_status(intptr_t batch_idp, unsigned min_nr, intptr_t nr, iocbp, intptr_t timeout): 

3691 cdef intptr_t _iocbp_ptr_ = 0 if iocbp is None else int(iocbp) 1hjik

3692 with nogil: 1hjik

3693 __status__ = cuFileBatchIOGetStatus(<BatchHandle>batch_idp, min_nr, <unsigned*>nr, <CUfileIOEvents_t*>_iocbp_ptr_, <timespec*>timeout) 1hjik

3694 check_status(__status__) 1hjik

3695  

3696  

3697cpdef batch_io_cancel(intptr_t batch_idp): 

3698 with nogil: 1lm

3699 __status__ = cuFileBatchIOCancel(<BatchHandle>batch_idp) 1lm

3700 check_status(__status__) 1lm

3701  

3702  

3703cpdef void batch_io_destroy(intptr_t batch_idp) except*: 

3704 with nogil: 1hljimk

3705 cuFileBatchIODestroy(<BatchHandle>batch_idp) 1hljimk

3706  

3707  

3708cpdef read_async(intptr_t fh, intptr_t buf_ptr_base, intptr_t size_p, intptr_t file_offset_p, intptr_t buf_ptr_offset_p, intptr_t bytes_read_p, intptr_t stream): 

3709 with nogil: 1npou

3710 __status__ = cuFileReadAsync(<Handle>fh, <void*>buf_ptr_base, <size_t*>size_p, <off_t*>file_offset_p, <off_t*>buf_ptr_offset_p, <ssize_t*>bytes_read_p, <CUstream>stream) 1npou

3711 check_status(__status__) 1npou

3712  

3713  

3714cpdef write_async(intptr_t fh, intptr_t buf_ptr_base, intptr_t size_p, intptr_t file_offset_p, intptr_t buf_ptr_offset_p, intptr_t bytes_written_p, intptr_t stream): 

3715 with nogil: 1ntoy

3716 __status__ = cuFileWriteAsync(<Handle>fh, <void*>buf_ptr_base, <size_t*>size_p, <off_t*>file_offset_p, <off_t*>buf_ptr_offset_p, <ssize_t*>bytes_written_p, <CUstream>stream) 1ntoy

3717 check_status(__status__) 1ntoy

3718  

3719  

3720cpdef stream_register(intptr_t stream, unsigned flags): 

3721 with nogil: 1nptouy

3722 __status__ = cuFileStreamRegister(<CUstream>stream, flags) 1nptouy

3723 check_status(__status__) 1nptouy

3724  

3725  

3726cpdef stream_deregister(intptr_t stream): 

3727 with nogil: 1nptouy

3728 __status__ = cuFileStreamDeregister(<CUstream>stream) 1nptouy

3729 check_status(__status__) 1nptouy

3730  

3731  

3732cpdef int get_version() except? 0: 

3733 """Get the cuFile library version. 

3734  

3735 The version is returned as (1000 major + 10 minor). For example, CUFILE 1.7.0 

3736 would be represented by 1070. 

3737  

3738 Returns: 

3739 int: Pointer to an integer where the version will be stored. 

3740  

3741 .. note:: 

3742 This is useful for applications that need to inquire the library. 

3743 .. seealso:: `cuFileGetVersion` 

3744 """ 

3745 cdef int version 

3746 with nogil: 1aFG

3747 __status__ = cuFileGetVersion(&version) 1aFG

3748 check_status(__status__) 1aFG

3749 return version 1aFG

3750  

3751  

3752cpdef size_t get_parameter_size_t(int param) except? 0: 

3753 cdef size_t value 

3754 with nogil: 1JK

3755 __status__ = cuFileGetParameterSizeT(<_SizeTConfigParameter>param, &value) 1JK

3756 check_status(__status__) 1JK

3757 return value 1JK

3758  

3759  

3760cpdef bint get_parameter_bool(int param) except? 0: 

3761 cdef _cyb_bool value 

3762 with nogil: 1FG

3763 __status__ = cuFileGetParameterBool(<_BoolConfigParameter>param, &value) 1FG

3764 check_status(__status__) 1FG

3765 return <bint>value 1FG

3766  

3767  

3768cpdef str get_parameter_string(int param, int len): 

3769 cdef bytes _desc_str_ = bytes(len) 1zA

3770 cdef char* desc_str = _desc_str_ 1zA

3771 with nogil: 1zA

3772 __status__ = cuFileGetParameterString(<_StringConfigParameter>param, desc_str, len) 1zA

3773 check_status(__status__) 1zA

3774 return _cyb_cpython.PyUnicode_FromString(desc_str) 1zA

3775  

3776  

3777cpdef set_parameter_size_t(int param, size_t value): 

3778 with nogil: 1JK

3779 __status__ = cuFileSetParameterSizeT(<_SizeTConfigParameter>param, value) 1JK

3780 check_status(__status__) 1JK

3781  

3782  

3783cpdef set_parameter_bool(int param, bint value): 

3784 with nogil: 1FG

3785 __status__ = cuFileSetParameterBool(<_BoolConfigParameter>param, <_cyb_bool>value) 1FG

3786 check_status(__status__) 1FG

3787  

3788  

3789cpdef set_parameter_string(int param, intptr_t desc_str): 

3790 with nogil: 1zA

3791 __status__ = cuFileSetParameterString(<_StringConfigParameter>param, <const char*>desc_str) 1zA

3792 check_status(__status__) 1zA

3793  

3794  

3795cpdef tuple get_parameter_min_max_value(int param): 

3796 """Get both the minimum and maximum settable values for a given size_t parameter in a single call. 

3797  

3798  

3799 Args: 

3800 param (SizeTConfigParameter): CUfile SizeT configuration 

3801 parameter. 

3802  

3803 Returns: 

3804 A 2-tuple containing: 

3805 - size_t: Pointer to store the minimum value. 

3806 - size_t: Pointer to store the maximum value. 

3807  

3808 .. seealso:: `cuFileGetParameterMinMaxValue` 

3809 """ 

3810 cdef size_t min_value 

3811 cdef size_t max_value 

3812 with nogil: 1;?

3813 __status__ = cuFileGetParameterMinMaxValue(<_SizeTConfigParameter>param, &min_value, &max_value) 1;?

3814 check_status(__status__) 1;?

3815 return (min_value, max_value) 1;?

3816  

3817  

3818cpdef set_stats_level(int level): 

3819 """Set the level of statistics collection for cuFile operations. This will override the cufile.json settings for stats. 

3820  

3821  

3822 Args: 

3823 level (int): Statistics level (0 = disabled, 1 = basic, 2 = 

3824 detailed, 3 = verbose). 

3825  

3826 .. note:: 

3827 Higher stats levels may impact performance. Level 0 disables statistics. 

3828 .. note:: 

3829 Changes to stats level take effect for future operations. 

3830 .. seealso:: `cuFileSetStatsLevel` 

3831 """ 

3832 with nogil: 1fLbMdNDPQRgScTeUEWXY

3833 __status__ = cuFileSetStatsLevel(level) 1fLbMdNDPQRgScTeUEWXY

3834 check_status(__status__) 1fLbMdNDPQRgScTeUEWXY

3835  

3836  

3837cpdef int get_stats_level() except? 0: 

3838 """Get the current level of statistics collection for cuFile operations. 

3839  

3840  

3841 Returns: 

3842 int: Pointer to store the current statistics level. 

3843  

3844 .. seealso:: `cuFileGetStatsLevel` 

3845 """ 

3846 cdef int level 

3847 with nogil: 1Z01D23456E78

3848 __status__ = cuFileGetStatsLevel(&level) 1Z01D23456E78

3849 check_status(__status__) 1Z01D23456E78

3850 return level 1Z01D23456E78

3851  

3852  

3853cpdef stats_start(): 

3854 """Start collecting cuFile statistics. 

3855  

3856  

3857 .. note:: 

3858 Statistics level must be set using cuFileSetStatsLevel before calling this 

3859 function. 

3860 .. seealso:: `cuFileStatsStart` 

3861 """ 

3862 with nogil: 1fbdQgceX

3863 __status__ = cuFileStatsStart() 1fbdQgceX

3864 check_status(__status__) 1fbdQgceX

3865  

3866  

3867cpdef stats_stop(): 

3868 """Stop collecting cuFile statistics. 

3869  

3870  

3871 .. seealso:: `cuFileStatsStop` 

3872 """ 

3873 with nogil: 1fbdQgceX

3874 __status__ = cuFileStatsStop() 1fbdQgceX

3875 check_status(__status__) 1fbdQgceX

3876  

3877  

3878cpdef stats_reset(): 

3879 """Reset all cuFile statistics counters. 

3880  

3881  

3882 .. seealso:: `cuFileStatsReset` 

3883 """ 

3884 with nogil: 1LMNPRSTUWY

3885 __status__ = cuFileStatsReset() 1LMNPRSTUWY

3886 check_status(__status__) 1LMNPRSTUWY

3887  

3888  

3889cpdef get_stats_l1(stats): 

3890 """Get Level 1 cuFile statistics. 

3891  

3892  

3893 Args: 

3894 stats (intptr_t): Pointer to ``CUfileStatsLevel1_t`` structure to 

3895 be filled. 

3896  

3897 .. seealso:: `cuFileGetStatsL1` 

3898 """ 

3899 cdef intptr_t _stats_ptr_ = 0 if stats is None else int(stats) 1fg

3900 with nogil: 1fg

3901 __status__ = cuFileGetStatsL1(<CUfileStatsLevel1_t*>_stats_ptr_) 1fg

3902 check_status(__status__) 1fg

3903  

3904  

3905cpdef get_stats_l2(stats): 

3906 """Get Level 2 cuFile statistics. 

3907  

3908  

3909 Args: 

3910 stats (intptr_t): Pointer to ``CUfileStatsLevel2_t`` structure to 

3911 be filled. 

3912  

3913 .. seealso:: `cuFileGetStatsL2` 

3914 """ 

3915 cdef intptr_t _stats_ptr_ = 0 if stats is None else int(stats) 1bc

3916 with nogil: 1bc

3917 __status__ = cuFileGetStatsL2(<CUfileStatsLevel2_t*>_stats_ptr_) 1bc

3918 check_status(__status__) 1bc

3919  

3920  

3921cpdef get_stats_l3(stats): 

3922 """Get Level 3 cuFile statistics. 

3923  

3924  

3925 Args: 

3926 stats (intptr_t): Pointer to ``CUfileStatsLevel3_t`` structure to 

3927 be filled. 

3928  

3929 .. seealso:: `cuFileGetStatsL3` 

3930 """ 

3931 cdef intptr_t _stats_ptr_ = 0 if stats is None else int(stats) 1de

3932 with nogil: 1de

3933 __status__ = cuFileGetStatsL3(<CUfileStatsLevel3_t*>_stats_ptr_) 1de

3934 check_status(__status__) 1de

3935  

3936  

3937cpdef size_t get_bar_size_in_kb(int gpu_index) except? 0: 

3938 cdef size_t bar_size 

3939 with nogil: 1:=

3940 __status__ = cuFileGetBARSizeInKB(gpu_index, &bar_size) 1:=

3941 check_status(__status__) 1:=

3942 return bar_size 1:=

3943  

3944  

3945cpdef set_parameter_posix_pool_slab_array(intptr_t size_values, intptr_t count_values, int len): 

3946 """Set both POSIX pool slab size and count parameters as a pair. 

3947  

3948  

3949 Args: 

3950 size_values (intptr_t): Array of slab sizes in KB. 

3951 count_values (intptr_t): Array of slab counts. 

3952 len (int): Length of both arrays (must be the same). 

3953  

3954 .. seealso:: `cuFileSetParameterPosixPoolSlabArray` 

3955 """ 

3956 with nogil: 1(/

3957 __status__ = cuFileSetParameterPosixPoolSlabArray(<const size_t*>size_values, <const size_t*>count_values, len) 1(/

3958 check_status(__status__) 1(/

3959  

3960  

3961cpdef get_parameter_posix_pool_slab_array(intptr_t size_values, intptr_t count_values, int len): 

3962 """Get both POSIX pool slab size and count parameters as a pair. 

3963  

3964  

3965 Args: 

3966 size_values (intptr_t): Buffer to receive slab sizes in KB. 

3967 count_values (intptr_t): Buffer to receive slab counts. 

3968 len (int): Buffer size (must match the actual parameter length). 

3969  

3970 .. seealso:: `cuFileGetParameterPosixPoolSlabArray` 

3971 """ 

3972 with nogil: 1OV

3973 __status__ = cuFileGetParameterPosixPoolSlabArray(<size_t*>size_values, <size_t*>count_values, len) 1OV

3974 check_status(__status__) 1OV

3975  

3976  

3977  

3978  

3979cpdef str op_status_error(int status): 

3980 """cufileop status string. 

3981  

3982 Args: 

3983 status (OpError): the error status to query. 

3984  

3985 .. seealso:: `cufileop_status_error` 

3986 """ 

3987 cdef bytes _output_ 

3988 _output_ = cufileop_status_error(<_OpError>status) 1HzDIAE

3989 return _output_.decode() 1HzDIAE

3990  

3991  

3992cpdef driver_close(): 

3993 """reset the cuFile library and release the nvidia-fs driver 

3994 """ 

3995 with nogil: 2[ ^ ` | ~ bbdbfbhbjblbnbpbrbtbvbxbL M N zbF J z ' O AbP R CbEbGbIbKbMbOb- PbRbTbVbXbZb1b3b5b7bS T U 9bG K A V !bW Y

3996 status = cuFileDriverClose_v2() 2[ ^ ` | ~ bbdbfbhbjblbnbpbrbtbvbxbL M N zbF J z ' O AbP R CbEbGbIbKbMbOb- PbRbTbVbXbZb1b3b5b7bS T U 9bG K A V !bW Y

3997 check_status(status) 2[ ^ ` | ~ bbdbfbhbjblbnbpbrbtbvbxbL M N zbF J z ' O AbP R CbEbGbIbKbMbOb- PbRbTbVbXbZb1b3b5b7bS T U 9bG K A V !bW Y

3998  

3999cpdef read(intptr_t fh, intptr_t buf_ptr_base, size_t size, off_t file_offset, off_t buf_ptr_offset): 

4000 """read data from a registered file handle to a specified device or host memory. 

4001  

4002 Args: 

4003 fh (intptr_t): ``CUfileHandle_t`` opaque file handle. 

4004 buf_ptr_base (intptr_t): base address of buffer in device or host memory. 

4005 size (size_t): size bytes to read. 

4006 file_offset (off_t): file-offset from begining of the file. 

4007 buf_ptr_offset (off_t): offset relative to the buf_ptr_base pointer to read into. 

4008  

4009 Returns: 

4010 ssize_t: number of bytes read on success. 

4011  

4012 .. seealso:: `cuFileRead` 

4013 """ 

4014 with nogil: 1qrsfbdvwxgce

4015 status = cuFileRead(<Handle>fh, <void*>buf_ptr_base, size, file_offset, buf_ptr_offset) 1qrsfbdvwxgce

4016 check_status(status) 1qrsfbdvwxgce

4017 return status 1qrsfbdvwxgce

4018  

4019  

4020cpdef write(intptr_t fh, intptr_t buf_ptr_base, size_t size, off_t file_offset, off_t buf_ptr_offset): 

4021 """write data from a specified device or host memory to a registered file handle. 

4022  

4023 Args: 

4024 fh (intptr_t): ``CUfileHandle_t`` opaque file handle. 

4025 buf_ptr_base (intptr_t): base address of buffer in device or host memory. 

4026 size (size_t): size bytes to write. 

4027 file_offset (off_t): file-offset from begining of the file. 

4028 buf_ptr_offset (off_t): offset relative to the buf_ptr_base pointer to write from. 

4029  

4030 Returns: 

4031 ssize_t: number of bytes written on success. 

4032  

4033 .. seealso:: `cuFileWrite` 

4034 """ 

4035 with nogil: 1qrsfbdvwxgce

4036 status = cuFileWrite(<Handle>fh, <const void*>buf_ptr_base, size, file_offset, buf_ptr_offset) 1qrsfbdvwxgce

4037 check_status(status) 1qrsfbdvwxgce

4038 return status 1qrsfbdvwxgce

4039  

4040  

4041cpdef readv(intptr_t fh, IOVec iov, off_t file_offset, unsigned int flags=0): 

4042 """Read data from a registered file handle into a scatter list of device or host buffers. 

4043  

4044 Args: 

4045 fh (intptr_t): ``CUfileHandle_t`` opaque file handle. 

4046 iov (IOVec): scatter/gather descriptor array; each element specifies a 

4047 base pointer (device or host) and a byte length. 

4048 file_offset (off_t): file offset from the beginning of the file. 

4049 flags (unsigned int): reserved; must be 0. 

4050  

4051 Returns: 

4052 ssize_t: number of bytes read on success. 

4053  

4054 .. seealso:: `cuFileReadv` 

4055 """ 

4056 cdef intptr_t iov_ptr = (<IOVec>iov)._get_ptr() 

4057 cdef size_t iovcnt = len(iov) 

4058 with nogil: 

4059 status = cuFileReadv(<Handle>fh, <const CUfileIOVec_t*>iov_ptr, iovcnt, file_offset, flags) 

4060 check_status(status) 

4061 return status 

4062  

4063  

4064cpdef writev(intptr_t fh, IOVec iov, off_t file_offset, unsigned int flags=0): 

4065 """Write data to a registered file handle from a gather list of device or host buffers. 

4066  

4067 Args: 

4068 fh (intptr_t): ``CUfileHandle_t`` opaque file handle. 

4069 iov (IOVec): scatter/gather descriptor array; each element specifies a 

4070 base pointer (device or host) and a byte length. 

4071 file_offset (off_t): file offset from the beginning of the file. 

4072 flags (unsigned int): reserved; must be 0. 

4073  

4074 Returns: 

4075 ssize_t: number of bytes written on success. 

4076  

4077 .. seealso:: `cuFileWritev` 

4078 """ 

4079 cdef intptr_t iov_ptr = (<IOVec>iov)._get_ptr() 

4080 cdef size_t iovcnt = len(iov) 

4081 with nogil: 

4082 status = cuFileWritev(<Handle>fh, <const CUfileIOVec_t*>iov_ptr, iovcnt, file_offset, flags) 

4083 check_status(status) 

4084 return status 

4085del _cyb_FastEnum