Handle of remote file. More...
#include <remote_handle.hpp>
Public Member Functions | |
| RemoteHandle (std::unique_ptr< RemoteEndpoint > endpoint, std::size_t nbytes) | |
| Create a new remote handle from an endpoint and a file size. More... | |
| RemoteHandle (std::unique_ptr< RemoteEndpoint > endpoint) | |
| Create a new remote handle from an endpoint (infers the file size). More... | |
| RemoteHandle (RemoteHandle &&o)=default | |
| RemoteHandle & | operator= (RemoteHandle &&o)=default |
| RemoteHandle (RemoteHandle const &)=delete | |
| RemoteHandle & | operator= (RemoteHandle const &)=delete |
| std::size_t | nbytes () const noexcept |
| Get the file size. More... | |
| RemoteEndpoint const & | endpoint () const noexcept |
| Get a const reference to the underlying remote endpoint. More... | |
| std::size_t | read (void *buf, std::size_t size, std::size_t file_offset=0) |
| Read from remote source into buffer (host or device memory). More... | |
| std::future< std::size_t > | pread (void *buf, std::size_t size, std::size_t file_offset=0, std::size_t task_size=defaults::task_size()) |
| Read from remote source into buffer (host or device memory) in parallel. More... | |
Handle of remote file.
Definition at line 200 of file remote_handle.hpp.
| kvikio::RemoteHandle::RemoteHandle | ( | std::unique_ptr< RemoteEndpoint > | endpoint, |
| std::size_t | nbytes | ||
| ) |
Create a new remote handle from an endpoint and a file size.
| endpoint | Remote endpoint used for subsequent IO. |
| nbytes | The size of the remote file (in bytes). |
| kvikio::RemoteHandle::RemoteHandle | ( | std::unique_ptr< RemoteEndpoint > | endpoint | ) |
Create a new remote handle from an endpoint (infers the file size).
The file size is received from the remote server using endpoint.
| endpoint | Remote endpoint used for subsequently IO. |
|
noexcept |
Get a const reference to the underlying remote endpoint.
|
noexcept |
Get the file size.
Note, this is very fast, no communication needed.
| std::future<std::size_t> kvikio::RemoteHandle::pread | ( | void * | buf, |
| std::size_t | size, | ||
| std::size_t | file_offset = 0, |
||
| std::size_t | task_size = defaults::task_size() |
||
| ) |
Read from remote source into buffer (host or device memory) in parallel.
This API is a parallel async version of .read() that partitions the operation into tasks of size task_size for execution in the default thread pool.
| buf | Pointer to host or device memory. |
| size | Number of bytes to read. |
| file_offset | File offset in bytes. |
| task_size | Size of each task in bytes. |
size. | std::size_t kvikio::RemoteHandle::read | ( | void * | buf, |
| std::size_t | size, | ||
| std::size_t | file_offset = 0 |
||
| ) |
Read from remote source into buffer (host or device memory).
When reading into device memory, a bounce buffer is used to avoid many small memory copies to device. Use kvikio::default::bounce_buffer_size_reset() to set the size of this bounce buffer (default 16 MiB).
| buf | Pointer to host or device memory. |
| size | Number of bytes to read. |
| file_offset | File offset in bytes. |
size.