Updated tests: multipleRoles compiles again and parallelApply tries all kinds of assignments algorithms.
This commit is contained in:
parent
cf5317f614
commit
aec5236eb1
2 changed files with 45 additions and 19 deletions
|
|
@ -27,8 +27,7 @@ void subtask( vector<int>& v )
|
||||||
DynamicAssignmentAlgorithm algo( 2, MpiNode::comm().size()-1 );
|
DynamicAssignmentAlgorithm algo( 2, MpiNode::comm().size()-1 );
|
||||||
plusOne plusOneInstance;
|
plusOne plusOneInstance;
|
||||||
ParallelApply<int> job( plusOneInstance, v, algo, 1 );
|
ParallelApply<int> job( plusOneInstance, v, algo, 1 );
|
||||||
Role node( job );
|
job.run();
|
||||||
node.run();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct transmit : public eoUF< vector<int>&, void >
|
struct transmit : public eoUF< vector<int>&, void >
|
||||||
|
|
@ -37,7 +36,7 @@ struct transmit : public eoUF< vector<int>&, void >
|
||||||
{
|
{
|
||||||
cout << "Into the master subjob..." << endl;
|
cout << "Into the master subjob..." << endl;
|
||||||
subtask( v );
|
subtask( v );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
|
|
@ -64,9 +63,8 @@ int main(int argc, char** argv)
|
||||||
// only one node is assigned to subjob mastering
|
// only one node is assigned to subjob mastering
|
||||||
DynamicAssignmentAlgorithm algo( 1, 1 );
|
DynamicAssignmentAlgorithm algo( 1, 1 );
|
||||||
ParallelApply< vector<int> > job( transmitInstance, metaV, algo, 0 );
|
ParallelApply< vector<int> > job( transmitInstance, metaV, algo, 0 );
|
||||||
Role node( job );
|
job.run();
|
||||||
node.run();
|
if( job.isMaster() )
|
||||||
if( node.master() )
|
|
||||||
{
|
{
|
||||||
v = metaV[0];
|
v = metaV[0];
|
||||||
cout << "Results : " << endl;
|
cout << "Results : " << endl;
|
||||||
|
|
|
||||||
|
|
@ -14,16 +14,18 @@ struct plusOne : public eoUF< int&, void >
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct Test
|
||||||
|
{
|
||||||
|
AssignmentAlgorithm * assign;
|
||||||
|
string description;
|
||||||
|
};
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
eo::log << eo::setlevel( eo::debug );
|
// eo::log << eo::setlevel( eo::debug );
|
||||||
cout << "Appel à init... " << endl;
|
|
||||||
MpiNode::init( argc, argv );
|
MpiNode::init( argc, argv );
|
||||||
DynamicAssignmentAlgorithm assign( 1, MpiNode::comm().size()-1 );
|
|
||||||
|
|
||||||
cout << "Création des données... " << endl;
|
|
||||||
vector<int> v;
|
vector<int> v;
|
||||||
|
|
||||||
v.push_back(1);
|
v.push_back(1);
|
||||||
v.push_back(3);
|
v.push_back(3);
|
||||||
v.push_back(3);
|
v.push_back(3);
|
||||||
|
|
@ -32,18 +34,44 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
plusOne plusOneInstance;
|
plusOne plusOneInstance;
|
||||||
|
|
||||||
cout << "Création du job..." << endl;
|
vector< Test > tests;
|
||||||
ParallelApply<int> job( plusOneInstance, v, assign, 0 );
|
|
||||||
job.run();
|
|
||||||
|
|
||||||
if( job.isMaster() )
|
Test tStatic;
|
||||||
|
tStatic.assign = new StaticAssignmentAlgorithm( 1, MpiNode::comm().size()-1, v.size() );
|
||||||
|
tStatic.description = "Correct static assignment.";
|
||||||
|
tests.push_back( tStatic );
|
||||||
|
|
||||||
|
Test tStaticOverload;
|
||||||
|
tStaticOverload.assign = new StaticAssignmentAlgorithm( 1, MpiNode::comm().size()-1, v.size()+100 );
|
||||||
|
tStaticOverload.description = "Static assignment with too many runs.";
|
||||||
|
tests.push_back( tStaticOverload );
|
||||||
|
|
||||||
|
Test tDynamic;
|
||||||
|
tDynamic.assign = new DynamicAssignmentAlgorithm( 1, MpiNode::comm().size()-1 );
|
||||||
|
tDynamic.description = "Dynamic assignment.";
|
||||||
|
tests.push_back( tDynamic );
|
||||||
|
|
||||||
|
for( unsigned int i = 0; i < tests.size(); ++i )
|
||||||
{
|
{
|
||||||
for(int i = 0; i < v.size(); ++i)
|
ParallelApply<int> job( plusOneInstance, v, *(tests[i].assign), 0 );
|
||||||
{
|
|
||||||
cout << v[i] << ' ';
|
|
||||||
}
|
|
||||||
cout << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if( job.isMaster() )
|
||||||
|
{
|
||||||
|
cout << "Test : " << tests[i].description << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
job.run();
|
||||||
|
|
||||||
|
if( job.isMaster() )
|
||||||
|
{
|
||||||
|
for(int i = 0; i < v.size(); ++i)
|
||||||
|
{
|
||||||
|
cout << v[i] << ' ';
|
||||||
|
}
|
||||||
|
cout << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
delete tests[i].assign;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Reference in a new issue