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

Handle of an cuFile batch using semantic. More...

#include <batch.hpp>

Public Member Functions

 BatchHandle (int max_num_events)
 Construct a batch handle. More...
 
 BatchHandle (BatchHandle const &)=delete
 BatchHandle support move semantic but isn't copyable.
 
BatchHandleoperator= (BatchHandle const &)=delete
 
 BatchHandle (BatchHandle &&o) noexcept
 
bool closed () const noexcept
 
void close () noexcept
 Destroy the batch handle and free up resources.
 
void submit (std::vector< BatchOp > const &operations)
 Submit a vector of batch operations. More...
 
std::vector< CUfileIOEvents_t > status (unsigned min_nr, unsigned max_nr, struct timespec *timeout=nullptr)
 Get status of submitted operations. More...
 
void cancel ()
 

Detailed Description

Handle of an cuFile batch using semantic.

The workflow is as follows: 1) Create a batch with a large enough max_num_events. 2) Call .submit() with a vector of operations (vector.size() <= max_num_events). 3) Call .status() to wait on the operations to finish, or 3) Call .cancel() to cancel the operations. 4) Go to step 2 or call .close() to free up resources.

Notice, a batch handle can only handle one "submit" at a time and is closed in the destructor automatically.

Definition at line 49 of file batch.hpp.

Constructor & Destructor Documentation

◆ BatchHandle()

kvikio::BatchHandle::BatchHandle ( int  max_num_events)

Construct a batch handle.

Parameters
max_num_eventsThe maximum number of operations supported by this instance.

Member Function Documentation

◆ status()

std::vector<CUfileIOEvents_t> kvikio::BatchHandle::status ( unsigned  min_nr,
unsigned  max_nr,
struct timespec *  timeout = nullptr 
)

Get status of submitted operations.

Parameters
min_nrThe minimum number of IO entries for which status is requested.
max_nrThe maximum number of IO requests to poll for.
timeoutThis parameter is used to specify the amount of time to wait for in this API, even if the minimum number of requests have not completed. If the timeout hits, it is possible that the number of returned IOs can be less than min_nr
Returns
Vector of the status of the completed I/Os in the batch.

◆ submit()

void kvikio::BatchHandle::submit ( std::vector< BatchOp > const &  operations)

Submit a vector of batch operations.

Parameters
operationsThe vector of batch operations, which must not exceed the max_num_events.

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