REST_OF_THE_WORLD constant in assignmentAlgorithm.
This commit is contained in:
parent
f3cb5eec20
commit
ac13550faa
3 changed files with 24 additions and 7 deletions
|
|
@ -3,6 +3,12 @@
|
|||
|
||||
# include <vector>
|
||||
# include "MpiNode.h"
|
||||
|
||||
namespace eo
|
||||
{
|
||||
const int REST_OF_THE_WORLD = -1;
|
||||
}
|
||||
|
||||
struct AssignmentAlgorithm
|
||||
{
|
||||
virtual int get( ) = 0;
|
||||
|
|
@ -35,6 +41,11 @@ struct DynamicAssignmentAlgorithm : public AssignmentAlgorithm
|
|||
|
||||
DynamicAssignmentAlgorithm( int first, int last )
|
||||
{
|
||||
if( last == eo::REST_OF_THE_WORLD )
|
||||
{
|
||||
last = MpiNode::comm().size() - 1;
|
||||
}
|
||||
|
||||
for( int i = first; i <= last; ++i)
|
||||
{
|
||||
availableWrk.push_back( i );
|
||||
|
|
@ -82,6 +93,12 @@ struct StaticAssignmentAlgorithm : public AssignmentAlgorithm
|
|||
StaticAssignmentAlgorithm( int first, int last, int runs )
|
||||
{
|
||||
std::vector<int> workers;
|
||||
|
||||
if( last == eo::REST_OF_THE_WORLD )
|
||||
{
|
||||
last = MpiNode::comm().size() - 1;
|
||||
}
|
||||
|
||||
for(int i = first; i <= last; ++i)
|
||||
{
|
||||
workers.push_back( i );
|
||||
|
|
|
|||
Reference in a new issue