Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
ph::WorkScheduler Class Referenceabstract

A manager that distributes a fixed amount of work to workers. More...

#include <WorkScheduler.h>

Inheritance diagram for ph::WorkScheduler:
ph::IWorkDispatcher ph::GridScheduler ph::PlateScheduler ph::SpiralGridScheduler ph::SpiralScheduler ph::StripeScheduler ph::TileScheduler

Public Member Functions

 WorkScheduler ()
 A scheduler with no work load.
 
 WorkScheduler (std::size_t numWorkers, const WorkUnit &totalWorkUnit)
 A scheduler with specific number of workers and work load.
 
bool dispatch (WorkUnit *out_workUnit) override
 Get some amount of work.
 
bool schedule (WorkUnit *out_workUnit)
 Get some amount of work.
 
void scheduleAll (std::vector< WorkUnit > &out_workUnits)
 
void submit (const WorkUnit &workUnit)
 
float getScheduledFraction () const
 
float getSubmittedFraction () const
 
bool isExhausted () const
 Checks if all works had been scheduled.
 
- Public Member Functions inherited from ph::IWorkDispatcher
virtual ~IWorkDispatcher ()=default
 

Protected Attributes

std::size_t m_numWorkers
 
WorkUnit m_totalWorkUnit
 
std::size_t m_totalVolume
 
std::size_t m_scheduledVolume
 
std::size_t m_submittedVolume
 

Detailed Description

A manager that distributes a fixed amount of work to workers.

The scheduler will deliver some amount of work on demand, where the total amount of work is fixed. The sizes of each delivered work is implementation defined.

Constructor & Destructor Documentation

◆ WorkScheduler() [1/2]

ph::WorkScheduler::WorkScheduler ( )
inline

A scheduler with no work load.

◆ WorkScheduler() [2/2]

ph::WorkScheduler::WorkScheduler ( std::size_t numWorkers,
const WorkUnit & totalWorkUnit )
inline

A scheduler with specific number of workers and work load.

Member Function Documentation

◆ dispatch()

bool ph::WorkScheduler::dispatch ( WorkUnit * out_workUnit)
inlineoverridevirtual

Get some amount of work.

The meaning of the work dimensions is depending on the use case.

Returns
True if work has been dispatched.

Implements ph::IWorkDispatcher.

◆ getScheduledFraction()

float ph::WorkScheduler::getScheduledFraction ( ) const
inline

◆ getSubmittedFraction()

float ph::WorkScheduler::getSubmittedFraction ( ) const
inline

◆ isExhausted()

bool ph::WorkScheduler::isExhausted ( ) const
inline

Checks if all works had been scheduled.

Returns
True if there is no more work.

◆ schedule()

bool ph::WorkScheduler::schedule ( WorkUnit * out_workUnit)
inline

Get some amount of work.

Returns
True when non-zero amount of work has been scheduled; otherwise, no work has been scheduled and no more is yet to be scheduled (the scheduler is exhausted).

◆ scheduleAll()

void ph::WorkScheduler::scheduleAll ( std::vector< WorkUnit > & out_workUnits)
inline

◆ submit()

void ph::WorkScheduler::submit ( const WorkUnit & workUnit)
inline

Member Data Documentation

◆ m_numWorkers

std::size_t ph::WorkScheduler::m_numWorkers
protected

◆ m_scheduledVolume

std::size_t ph::WorkScheduler::m_scheduledVolume
protected

◆ m_submittedVolume

std::size_t ph::WorkScheduler::m_submittedVolume
protected

◆ m_totalVolume

std::size_t ph::WorkScheduler::m_totalVolume
protected

◆ m_totalWorkUnit

WorkUnit ph::WorkScheduler::m_totalWorkUnit
protected

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