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. | |
| BatchHandle & | operator= (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 () |
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.
| kvikio::BatchHandle::BatchHandle | ( | int | max_num_events | ) |
Construct a batch handle.
| max_num_events | The maximum number of operations supported by this instance. |
| std::vector<CUfileIOEvents_t> kvikio::BatchHandle::status | ( | unsigned | min_nr, |
| unsigned | max_nr, | ||
| struct timespec * | timeout = nullptr |
||
| ) |
Get status of submitted operations.
| min_nr | The minimum number of IO entries for which status is requested. |
| max_nr | The maximum number of IO requests to poll for. |
| timeout | This 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 |
| void kvikio::BatchHandle::submit | ( | std::vector< BatchOp > const & | operations | ) |
Submit a vector of batch operations.
| operations | The vector of batch operations, which must not exceed the max_num_events. |