SG++
sgpp::datadriven::RoundRobinScheduler Class Reference

#include <RoundRobinScheduler.hpp>

Inheritance diagram for sgpp::datadriven::RoundRobinScheduler:
sgpp::datadriven::MPITaskScheduler

Public Member Functions

void assignTaskStaticTaskSize (TaskType taskType, AssignTaskResult &result) override
 Assign a task of static size to the next worker in the queue. More...
 
void assignTaskVariableTaskSize (TaskType taskType, AssignTaskResult &result) override
 Assign a task of variable size equal to the batch size to the next worker in the queue. More...
 
bool isReadyForRefinement () override
 Check whether the master can start to refine. More...
 
void onMergeRequestIncoming (size_t batchOffset, size_t batchSize, size_t remoteGridVersion, size_t localGridVersion) override
 Update the number of outstanding requests when a request is completed by a worker. More...
 
void onRefinementStarted () override
 Move the number of current outstanding requests into the number of previous outstanding requests. More...
 
 RoundRobinScheduler (size_t batchSize)
 Create a Round-Robin-Scheduler that will distribute tasks to all workers fairly with specified batch size. More...
 
- Public Member Functions inherited from sgpp::datadriven::MPITaskScheduler
void setLearnerInstance (LearnerSGDEOnOffParallel *instance)
 Set the learner instance for which to task schedule. More...
 
virtual ~MPITaskScheduler ()=default
 Default destructor to override if necessary. More...
 

Protected Attributes

size_t batchSize
 The batch size to use for all workers. More...
 
unsigned int lastWorkerID
 Keeps track of the last worker that had work assigned to it. More...
 
size_t numOutstandingRequestsCurrentRefinement
 Track how many outstanding requests (batch*class) are pending for the current refinement cycle. More...
 
size_t numOutstandingRequestsLastRefinement
 Track how many outstanding requests (batch*class) are pending for the previous refinement cycle. More...
 
- Protected Attributes inherited from sgpp::datadriven::MPITaskScheduler
LearnerSGDEOnOffParallellearnerInstance {}
 The learner instance used to interrogate system state if necessary. More...
 

Constructor & Destructor Documentation

sgpp::datadriven::RoundRobinScheduler::RoundRobinScheduler ( size_t  batchSize)
explicit

Create a Round-Robin-Scheduler that will distribute tasks to all workers fairly with specified batch size.

Parameters
batchSizeThe size of one training batch to distribute.

References batchSize, lastWorkerID, sgpp::datadriven::MPITaskScheduler::learnerInstance, numOutstandingRequestsCurrentRefinement, and numOutstandingRequestsLastRefinement.

Member Function Documentation

void sgpp::datadriven::RoundRobinScheduler::assignTaskStaticTaskSize ( TaskType  taskType,
AssignTaskResult result 
)
overridevirtual
void sgpp::datadriven::RoundRobinScheduler::assignTaskVariableTaskSize ( TaskType  taskType,
AssignTaskResult result 
)
overridevirtual

Assign a task of variable size equal to the batch size to the next worker in the queue.

Parameters
taskTypeType of task to assign to a worker.
resultThe result of determining assignment.

Implements sgpp::datadriven::MPITaskScheduler.

References assignTaskStaticTaskSize(), batchSize, and sgpp::datadriven::AssignTaskResult::taskSize.

bool sgpp::datadriven::RoundRobinScheduler::isReadyForRefinement ( )
overridevirtual

Check whether the master can start to refine.

This can only happen if all requests from one cycle ago have successfully completed.

Returns
Whether to start refining.

Implements sgpp::datadriven::MPITaskScheduler.

References numOutstandingRequestsLastRefinement.

void sgpp::datadriven::RoundRobinScheduler::onMergeRequestIncoming ( size_t  batchOffset,
size_t  batchSize,
size_t  remoteGridVersion,
size_t  localGridVersion 
)
overridevirtual

Update the number of outstanding requests when a request is completed by a worker.

The difference in grid versions is used to determine whether to update the current number of outstanding requests or the previous number of outstanding requests.

Parameters
batchOffsetNot used.
batchSizeNot used.
remoteGridVersionThe grid version that was used to train the batch.
localGridVersionThe current grid version on the master.

Implements sgpp::datadriven::MPITaskScheduler.

References numOutstandingRequestsCurrentRefinement, and numOutstandingRequestsLastRefinement.

void sgpp::datadriven::RoundRobinScheduler::onRefinementStarted ( )
overridevirtual

Move the number of current outstanding requests into the number of previous outstanding requests.

Implements sgpp::datadriven::MPITaskScheduler.

References numOutstandingRequestsCurrentRefinement, and numOutstandingRequestsLastRefinement.

Member Data Documentation

size_t sgpp::datadriven::RoundRobinScheduler::batchSize
protected

The batch size to use for all workers.

Referenced by assignTaskVariableTaskSize(), and RoundRobinScheduler().

unsigned int sgpp::datadriven::RoundRobinScheduler::lastWorkerID
protected

Keeps track of the last worker that had work assigned to it.

The next assignment will go to a worker with an index of one higher.

Referenced by assignTaskStaticTaskSize(), and RoundRobinScheduler().

size_t sgpp::datadriven::RoundRobinScheduler::numOutstandingRequestsCurrentRefinement
protected

Track how many outstanding requests (batch*class) are pending for the current refinement cycle.

Referenced by assignTaskStaticTaskSize(), onMergeRequestIncoming(), onRefinementStarted(), and RoundRobinScheduler().

size_t sgpp::datadriven::RoundRobinScheduler::numOutstandingRequestsLastRefinement
protected

Track how many outstanding requests (batch*class) are pending for the previous refinement cycle.

Referenced by isReadyForRefinement(), onMergeRequestIncoming(), onRefinementStarted(), and RoundRobinScheduler().


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