EvolvingObjects
eo::mpi::AssignmentAlgorithm Struct Reference

Contains informations on the available workers and allows to find assignees for jobs. More...

#include <eoMpiAssignmentAlgorithm.h>

Inheritance diagram for eo::mpi::AssignmentAlgorithm:
eo::mpi::DynamicAssignmentAlgorithm eo::mpi::StaticAssignmentAlgorithm

List of all members.

Public Member Functions

virtual int get ()=0
 Gets the rank of an available worker, so as to send it a task.
virtual int availableWorkers ()=0
 Gets the number of total available workers.
virtual void confirm (int wrkRank)=0
 Reinject the worker of indicated rank in the available state.
virtual std::vector< int > idles ()=0
 Indicates who are the workers which do nothing.
virtual void reinit (int runs)=0
 Reinitializes the assignment algorithm with the right number of runs.

Detailed Description

Contains informations on the available workers and allows to find assignees for jobs.

Available workers are workers who aren't processing anything. When they've received an order, workers switch from the state "available" to the state "busy", and the master has to wait for their response for considering them available again.

Examples:
t-mpi-parallelApply.cpp.

Definition at line 49 of file eoMpiAssignmentAlgorithm.h.


Member Function Documentation

virtual int eo::mpi::AssignmentAlgorithm::get ( ) [pure virtual]

Gets the rank of an available worker, so as to send it a task.

Returns:
The MPI rank of an available worker, or -1 if there is no available worker.

Implemented in eo::mpi::StaticAssignmentAlgorithm, and eo::mpi::DynamicAssignmentAlgorithm.

Referenced by eo::mpi::Job< void >::master().

virtual int eo::mpi::AssignmentAlgorithm::availableWorkers ( ) [pure virtual]

Gets the number of total available workers.

Before the first call, it is equal to the total number of present workers, as specified in the specific assignment algorithm constructor. It allows the Job class to know when all the responses have been received, by comparing this number to the total number of workers.

Returns:
Integer indicating how many workers are available.

Implemented in eo::mpi::StaticAssignmentAlgorithm, and eo::mpi::DynamicAssignmentAlgorithm.

Referenced by eo::mpi::Job< void >::master().

virtual void eo::mpi::AssignmentAlgorithm::confirm ( int  wrkRank) [pure virtual]

Reinject the worker of indicated rank in the available state.

Parameters:
wrkRankThe MPI rank of the worker who has finished its job.

Implemented in eo::mpi::StaticAssignmentAlgorithm, and eo::mpi::DynamicAssignmentAlgorithm.

Referenced by eo::mpi::Job< void >::master().

virtual std::vector<int> eo::mpi::AssignmentAlgorithm::idles ( ) [pure virtual]

Indicates who are the workers which do nothing.

At the end of the algorithm, the master has to warn all the workers that it's done. All the workers mean, the workers which are currently processing data, and the other ones who could be waiting : the idles. This function indicates to the master which worker aren't doing anything.

Returns:
A std::vector containing all the MPI ranks of the idles workers.

Implemented in eo::mpi::StaticAssignmentAlgorithm, and eo::mpi::DynamicAssignmentAlgorithm.

virtual void eo::mpi::AssignmentAlgorithm::reinit ( int  runs) [pure virtual]

Reinitializes the assignment algorithm with the right number of runs.

In fact, this is only useful for static assignment algorithm, which has to be reinitialized every time it's used, in the case of a Multi Job. It's the user's responsability to call this function.

Todo:
Not really clean. Find a better way to do it.

Implemented in eo::mpi::StaticAssignmentAlgorithm, and eo::mpi::DynamicAssignmentAlgorithm.


The documentation for this struct was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Friends