libkvikio
24.02.00
|
Future of an asynchronous IO operation. More...
#include <stream.hpp>
Public Member Functions | |
StreamFuture (void *devPtr_base, std::size_t size, off_t file_offset, off_t devPtr_offset, CUstream stream) | |
StreamFuture (const StreamFuture &)=delete | |
StreamFuture support move semantic but isn't copyable. | |
StreamFuture & | operator= (StreamFuture &o)=delete |
StreamFuture (StreamFuture &&o) noexcept | |
StreamFuture & | operator= (StreamFuture &&o) noexcept |
std::tuple< void *, std::size_t *, off_t *, off_t *, ssize_t *, CUstream > | get_args () const |
Return the arguments of the future call. More... | |
std::size_t | check_bytes_done () |
Return the number of bytes read or written by the future operation. More... | |
~StreamFuture () noexcept | |
Free the by-value arguments and make sure the associated CUDA stream has been synchronized. | |
Future of an asynchronous IO operation.
This class shouldn't be used directly, instead some stream operations such as FileHandle.read_async
and FileHandle.write_async
returns an instance of this class. Use .check_bytes_done()
to synchronize the associated CUDA stream and return the number of bytes read or written by the operation.
The goal of this class is twofold:
read_async
and write_async
return an object that clearly associates the function arguments with the CUDA stream used. This is useful because the current validity of the arguments depends on the stream.read_async
and write_async
like most other asynchronous CUDA functions that take by-value arguments.To support by-value arguments, we allocate the arguments on the heap (malloc ArgByVal
) and have the by-reference arguments points into ArgByVal
. This way, the read_async
and write_async
can call .get_args()
to get the by-reference arguments required by cuFile's stream API.
Definition at line 47 of file stream.hpp.
|
inline |
Return the number of bytes read or written by the future operation.
Synchronize the associated CUDA stream.
Definition at line 124 of file stream.hpp.
|
inline |
Return the arguments of the future call.
FileHandle.read()
and FileHandle.write()
Definition at line 104 of file stream.hpp.