Putting everything in namespace eo::mpi
This commit is contained in:
parent
b9a2246f82
commit
b291e56e03
12 changed files with 492 additions and 466 deletions
|
|
@ -1,4 +1,4 @@
|
|||
# include <mpi/eompi.h>
|
||||
# include <mpi/eoMpi.h>
|
||||
# include <mpi/eoParallelApply.h>
|
||||
|
||||
# include <boost/serialization/vector.hpp>
|
||||
|
|
@ -8,6 +8,8 @@
|
|||
# include <vector>
|
||||
using namespace std;
|
||||
|
||||
using namespace eo::mpi;
|
||||
|
||||
// Role map
|
||||
// 0 : general master
|
||||
// 1, 2 : worker of general job, master of subjob
|
||||
|
|
@ -38,7 +40,7 @@ struct Work: public eoUF< vector<int>&, void >
|
|||
void operator() ( vector<int>& v )
|
||||
{
|
||||
cout << "Work phase..." << endl;
|
||||
subtask( v, MpiNode::comm().rank() );
|
||||
subtask( v, Node::comm().rank() );
|
||||
for( int i = 0; i < v.size(); ++i )
|
||||
{
|
||||
v[i] *= 2;
|
||||
|
|
@ -49,7 +51,7 @@ struct Work: public eoUF< vector<int>&, void >
|
|||
int main(int argc, char** argv)
|
||||
{
|
||||
// eo::log << eo::setlevel( eo::debug );
|
||||
MpiNode::init( argc, argv );
|
||||
Node::init( argc, argv );
|
||||
vector<int> v;
|
||||
|
||||
v.push_back(1);
|
||||
|
|
@ -62,7 +64,7 @@ int main(int argc, char** argv)
|
|||
metaV.push_back( v );
|
||||
metaV.push_back( v );
|
||||
|
||||
switch( MpiNode::comm().rank() )
|
||||
switch( Node::comm().rank() )
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
|
|
@ -88,7 +90,7 @@ int main(int argc, char** argv)
|
|||
default:
|
||||
{
|
||||
// all the other nodes are sub workers
|
||||
int rank = MpiNode::comm().rank();
|
||||
int rank = Node::comm().rank();
|
||||
if ( rank == 3 or rank == 5 )
|
||||
{
|
||||
subtask( v, 1 );
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# include <mpi/eompi.h>
|
||||
# include <mpi/eoMpi.h>
|
||||
# include <mpi/eoParallelApply.h>
|
||||
|
||||
# include <iostream>
|
||||
|
|
@ -6,6 +6,8 @@
|
|||
# include <vector>
|
||||
using namespace std;
|
||||
|
||||
using namespace eo::mpi;
|
||||
|
||||
struct plusOne : public eoUF< int&, void >
|
||||
{
|
||||
void operator() ( int & x )
|
||||
|
|
@ -27,7 +29,7 @@ int main(int argc, char** argv)
|
|||
// eo::log << eo::setlevel( eo::debug );
|
||||
bool launchOnlyOne = false; // Set this to true if you wanna launch only the first test.
|
||||
|
||||
MpiNode::init( argc, argv );
|
||||
Node::init( argc, argv );
|
||||
|
||||
srand( time(0) );
|
||||
vector<int> v;
|
||||
|
|
@ -43,10 +45,10 @@ int main(int argc, char** argv)
|
|||
|
||||
vector< Test > tests;
|
||||
|
||||
const int ALL = MpiNode::comm().size();
|
||||
const int ALL = Node::comm().size();
|
||||
|
||||
Test tIntervalStatic;
|
||||
tIntervalStatic.assign = new StaticAssignmentAlgorithm( 1, eo::REST_OF_THE_WORLD, v.size() );
|
||||
tIntervalStatic.assign = new StaticAssignmentAlgorithm( 1, REST_OF_THE_WORLD, v.size() );
|
||||
tIntervalStatic.description = "Correct static assignment with interval.";
|
||||
tIntervalStatic.requiredNodesNumber = ALL;
|
||||
tests.push_back( tIntervalStatic );
|
||||
|
|
@ -81,7 +83,7 @@ int main(int argc, char** argv)
|
|||
tests.push_back( tVectorStatic );
|
||||
|
||||
Test tIntervalDynamic;
|
||||
tIntervalDynamic.assign = new DynamicAssignmentAlgorithm( 1, eo::REST_OF_THE_WORLD );
|
||||
tIntervalDynamic.assign = new DynamicAssignmentAlgorithm( 1, REST_OF_THE_WORLD );
|
||||
tIntervalDynamic.description = "Dynamic assignment with interval.";
|
||||
tIntervalDynamic.requiredNodesNumber = ALL;
|
||||
tests.push_back( tIntervalDynamic );
|
||||
|
|
@ -114,7 +116,7 @@ int main(int argc, char** argv)
|
|||
cout << "Test : " << tests[i].description << endl;
|
||||
}
|
||||
|
||||
if( MpiNode::comm().rank() < tests[i].requiredNodesNumber )
|
||||
if( Node::comm().rank() < tests[i].requiredNodesNumber )
|
||||
{
|
||||
job.run();
|
||||
}
|
||||
|
|
@ -134,7 +136,7 @@ int main(int argc, char** argv)
|
|||
cout << endl;
|
||||
}
|
||||
|
||||
MpiNode::comm().barrier();
|
||||
Node::comm().barrier();
|
||||
|
||||
delete tests[i].assign;
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue