28#include <condition_variable>
30#include "neml2/base/NEML2Object.h"
31#include "neml2/misc/types.h"
76 virtual std::vector<Device>
devices()
const {
return std::vector<Device>(); }
A custom map-like data structure. The keys are strings, and the values can be nonhomogeneously typed.
Definition OptionSet.h:52
virtual bool all_work_completed() const =0
Check if all work has been completed.
void wait_for_completion()
Wait for all work to complete.
Definition WorkScheduler.cxx:70
void dispatched_work(Device, std::size_t)
Update the scheduler with the dispatch of the last batch.
Definition WorkScheduler.cxx:55
virtual bool schedule_work_impl(Device &, std::size_t &) const =0
Implementation of the work scheduling.
void completed_work(Device, std::size_t)
Update the scheduler with the completion of the last batch.
Definition WorkScheduler.cxx:62
virtual void dispatched_work_impl(Device, std::size_t)=0
Update the scheduler with the dispatch of the last batch.
WorkScheduler(const OptionSet &options)
Construct a new WorkScheduler object.
Definition WorkScheduler.cxx:39
static OptionSet expected_options()
Options for the scheduler.
Definition WorkScheduler.cxx:31
virtual void completed_work_impl(Device, std::size_t)=0
Update the scheduler with the completion of the last batch.
std::condition_variable _condition
Condition variable for the scheduling thread.
Definition WorkScheduler.h:92
virtual std::vector< Device > devices() const
Device options.
Definition WorkScheduler.h:76
void schedule_work(Device &, std::size_t &)
Determine the device and batch size for the next dispatch.
Definition WorkScheduler.cxx:45
Definition DiagnosticsInterface.cxx:30
c10::Device Device
Definition types.h:66