Classes | Public Member Functions | List of all members
kvikio::StreamFuture Class Reference

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.
 
StreamFutureoperator= (StreamFuture &o)=delete
 
 StreamFuture (StreamFuture &&o) noexcept
 
StreamFutureoperator= (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.
 

Detailed Description

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:

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.

Member Function Documentation

◆ check_bytes_done()

std::size_t kvikio::StreamFuture::check_bytes_done ( )
inline

Return the number of bytes read or written by the future operation.

Synchronize the associated CUDA stream.

Returns
Number of bytes read or written by the future operation.

Definition at line 124 of file stream.hpp.

◆ get_args()

std::tuple<void*, std::size_t*, off_t*, off_t*, ssize_t*, CUstream> kvikio::StreamFuture::get_args ( ) const
inline

Return the arguments of the future call.

Returns
Tuple of the arguments in the order matching FileHandle.read() and FileHandle.write()

Definition at line 104 of file stream.hpp.


The documentation for this class was generated from the following file: