@@ -2281,40 +2281,6 @@ cpdef buf_deregister(intptr_t buf_ptr_base):
22812281 check_status(__status__)
22822282
22832283
2284- cpdef read(intptr_t fh, intptr_t buf_ptr_base, size_t size, off_t file_offset, off_t buf_ptr_offset):
2285- """ read data from a registered file handle to a specified device or host memory.
2286-
2287- Args:
2288- fh (intptr_t): ``CUfileHandle_t`` opaque file handle.
2289- buf_ptr_base (intptr_t): base address of buffer in device or host memory.
2290- size (size_t): size bytes to read.
2291- file_offset (off_t): file-offset from begining of the file.
2292- buf_ptr_offset (off_t): offset relative to the buf_ptr_base pointer to read into.
2293-
2294- .. seealso:: `cuFileRead`
2295- """
2296- with nogil:
2297- __status__ = cuFileRead(< Handle> fh, < void * > buf_ptr_base, size, file_offset, buf_ptr_offset)
2298- check_status(__status__)
2299-
2300-
2301- cpdef write(intptr_t fh, intptr_t buf_ptr_base, size_t size, off_t file_offset, off_t buf_ptr_offset):
2302- """ write data from a specified device or host memory to a registered file handle.
2303-
2304- Args:
2305- fh (intptr_t): ``CUfileHandle_t`` opaque file handle.
2306- buf_ptr_base (intptr_t): base address of buffer in device or host memory.
2307- size (size_t): size bytes to write.
2308- file_offset (off_t): file-offset from begining of the file.
2309- buf_ptr_offset (off_t): offset relative to the buf_ptr_base pointer to write from.
2310-
2311- .. seealso:: `cuFileWrite`
2312- """
2313- with nogil:
2314- __status__ = cuFileWrite(< Handle> fh, < const void * > buf_ptr_base, size, file_offset, buf_ptr_offset)
2315- check_status(__status__)
2316-
2317-
23182284cpdef driver_open():
23192285 """ Initialize the cuFile library and open the nvidia-fs driver.
23202286
@@ -2689,3 +2655,44 @@ cpdef driver_close():
26892655 with nogil:
26902656 status = cuFileDriverClose_v2()
26912657 check_status(status)
2658+
2659+ cpdef read(intptr_t fh, intptr_t buf_ptr_base, size_t size, off_t file_offset, off_t buf_ptr_offset):
2660+ """ read data from a registered file handle to a specified device or host memory.
2661+
2662+ Args:
2663+ fh (intptr_t): ``CUfileHandle_t`` opaque file handle.
2664+ buf_ptr_base (intptr_t): base address of buffer in device or host memory.
2665+ size (size_t): size bytes to read.
2666+ file_offset (off_t): file-offset from begining of the file.
2667+ buf_ptr_offset (off_t): offset relative to the buf_ptr_base pointer to read into.
2668+
2669+ Returns:
2670+ ssize_t: number of bytes read on success.
2671+
2672+ .. seealso:: `cuFileRead`
2673+ """
2674+ with nogil:
2675+ status = cuFileRead(< Handle> fh, < void * > buf_ptr_base, size, file_offset, buf_ptr_offset)
2676+ check_status(status)
2677+ return status
2678+
2679+
2680+ cpdef write(intptr_t fh, intptr_t buf_ptr_base, size_t size, off_t file_offset, off_t buf_ptr_offset):
2681+ """ write data from a specified device or host memory to a registered file handle.
2682+
2683+ Args:
2684+ fh (intptr_t): ``CUfileHandle_t`` opaque file handle.
2685+ buf_ptr_base (intptr_t): base address of buffer in device or host memory.
2686+ size (size_t): size bytes to write.
2687+ file_offset (off_t): file-offset from begining of the file.
2688+ buf_ptr_offset (off_t): offset relative to the buf_ptr_base pointer to write from.
2689+
2690+ Returns:
2691+ ssize_t: number of bytes written on success.
2692+
2693+ .. seealso:: `cuFileWrite`
2694+ """
2695+ with nogil:
2696+ status = cuFileWrite(< Handle> fh, < const void * > buf_ptr_base, size, file_offset, buf_ptr_offset)
2697+ check_status(status)
2698+ return status
0 commit comments