28#include <condition_variable>
30#include "neml2/base/NEML2Object.h"
31#include "neml2/misc/types.h"
32#include "neml2/base/TracingInterface.h"
77 virtual std::vector<Device>
devices()
const {
return std::vector<Device>(); }
The base class of all "manufacturable" objects in the NEML2 library.
Definition NEML2Object.h:51
A custom map-like data structure. The keys are strings, and the values can be nonhomogeneously typed.
Definition OptionSet.h:51
Definition TracingInterface.h:112
Scheduler for work dispatching.
Definition WorkScheduler.h:48
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:117
void dispatched_work(Device, std::size_t)
Update the scheduler with the dispatch of the last batch.
Definition WorkScheduler.cxx:88
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:105
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:41
static OptionSet expected_options()
Options for the scheduler.
Definition WorkScheduler.cxx:32
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:93
virtual std::vector< Device > devices() const
Device options.
Definition WorkScheduler.h:77
void schedule_work(Device &, std::size_t &)
Determine the device and batch size for the next dispatch.
Definition WorkScheduler.cxx:59
Definition DiagnosticsInterface.cxx:30
c10::Device Device
Definition types.h:63