pub struct FileHandle { /* private fields */ }Expand description
A registered file descriptor.
Implementations§
Source§impl FileHandle
impl FileHandle
Sourcepub unsafe fn register(fd: i32) -> Result<Self>
pub unsafe fn register(fd: i32) -> Result<Self>
Register an open file descriptor with cuFile. fd is typically
obtained from std::fs::File::as_raw_fd() on Linux.
§Safety
fd must stay open for the lifetime of the returned handle.
pub fn as_raw(&self) -> CUfileHandle_t
Sourcepub unsafe fn read(
&self,
dev_buf: *mut c_void,
size: usize,
file_offset: i64,
buf_offset: i64,
) -> Result<usize>
pub unsafe fn read( &self, dev_buf: *mut c_void, size: usize, file_offset: i64, buf_offset: i64, ) -> Result<usize>
Read size bytes from file_offset into dev_buf + buf_offset.
Returns the number of bytes actually read (negative on failure;
we map negatives to Err).
§Safety
dev_buf must be a device pointer with at least size bytes
live starting at buf_offset.
Source§impl FileHandle
impl FileHandle
Sourcepub unsafe fn read_async(
&self,
dev_buf: *mut c_void,
size_p: *mut usize,
file_offset_p: *mut i64,
buf_offset_p: *mut i64,
bytes_read: *mut isize,
stream: *mut c_void,
) -> Result<()>
pub unsafe fn read_async( &self, dev_buf: *mut c_void, size_p: *mut usize, file_offset_p: *mut i64, buf_offset_p: *mut i64, bytes_read: *mut isize, stream: *mut c_void, ) -> Result<()>
Queue a stream-ordered read. All parameters point at device /
pinned-host memory that cuFile reads when the stream reaches
this op (not at call time). bytes_read is written when the
op completes.
§Safety
All pointers must stay live until the stream reports completion.
stream must be previously registered via StreamRegistration::register.