-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Convert sizes to `Py_ssize_t`, which Python uses for this info * Type file offsets with `off_t` * Update default values to work with typing * Simplify and optimize `parse_buffer_argument` * Add `.pxd` file for `RemoteHandle` to allow leveraging it in Cython
- Loading branch information
Showing
7 changed files
with
148 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Copyright (c) 2021-2024, NVIDIA CORPORATION. All rights reserved. | ||
# See file LICENSE for terms. | ||
|
||
# distutils: language = c++ | ||
# cython: language_level=3 | ||
|
||
from posix cimport fcntl | ||
|
||
from libc.stdint cimport uintptr_t | ||
from libcpp cimport bool | ||
|
||
from kvikio._lib import defaults | ||
from kvikio._lib.future cimport IOFuture, IOFutureStream | ||
|
||
ctypedef int c_int | ||
|
||
|
||
cdef extern from "<kvikio/file_handle.hpp>" namespace "kvikio" nogil: | ||
cdef cppclass FileHandle: | ||
pass | ||
|
||
|
||
cdef class CuFile: | ||
"""File handle for GPUDirect Storage (GDS)""" | ||
cdef FileHandle _handle | ||
|
||
cpdef close(self) | ||
cpdef bint closed(self) | ||
cpdef c_int fileno(self) | ||
cpdef c_int open_flags(self) | ||
cpdef IOFuture pread(self, buf, Py_ssize_t size=*, Py_ssize_t file_offset=*, | ||
Py_ssize_t task_size=*) | ||
cpdef IOFuture pwrite(self, buf, Py_ssize_t size=*, Py_ssize_t file_offset=*, | ||
Py_ssize_t task_size=*) | ||
cpdef Py_ssize_t read(self, buf, Py_ssize_t size=*, Py_ssize_t file_offset=*, | ||
Py_ssize_t dev_offset=*) | ||
cpdef Py_ssize_t write(self, buf, Py_ssize_t size=*, Py_ssize_t file_offset=*, | ||
Py_ssize_t dev_offset=*) | ||
cpdef IOFutureStream read_async(self, buf, Py_ssize_t size=*, | ||
Py_ssize_t file_offset=*, Py_ssize_t dev_offset=*, | ||
uintptr_t stream=*) | ||
cpdef IOFutureStream write_async(self, buf, Py_ssize_t size=*, | ||
Py_ssize_t file_offset=*, Py_ssize_t dev_offset=*, | ||
uintptr_t stream=*) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Copyright (c) 2024, NVIDIA CORPORATION. All rights reserved. | ||
# See file LICENSE for terms. | ||
|
||
# distutils: language = c++ | ||
# cython: language_level=3 | ||
|
||
from libcpp.memory cimport unique_ptr | ||
|
||
from kvikio._lib.future cimport IOFuture | ||
|
||
|
||
cdef extern from "<kvikio/remote_handle.hpp>" nogil: | ||
cdef cppclass cpp_RemoteEndpoint "kvikio::RemoteEndpoint": | ||
pass | ||
|
||
|
||
cdef class RemoteFile: | ||
cdef unique_ptr[cpp_RemoteHandle] _handle | ||
|
||
@classmethod | ||
cpdef RemoteFile open_http(cls, str url, Py_ssize_t nbytes=*) | ||
|
||
cpdef Py_ssize_t nbytes(self) | ||
|
||
cpdef Py_ssize_t read(self, buf, Py_ssize_t size=*, Py_ssize_t file_offset=*) | ||
cpdef IOFuture pread(self, buf, Py_ssize_t size=*, Py_ssize_t file_offset=*) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters