Updating MPI tests.

This commit is contained in:
Benjamin Bouvier 2012-07-11 12:00:36 +02:00
commit 12560899ae
4 changed files with 18 additions and 10 deletions

View file

@ -11,8 +11,6 @@
#include <mpi/eoMpi.h>
#include <mpi/eoTerminateJob.h>
#include <boost/mpi.hpp>
#include <vector>
@ -144,10 +142,10 @@ int main(int ac, char** av)
eo::log << "Size of population : " << popSize << std::endl;
eo::mpi::ParallelEvalStore< EOT > store( eval, eo::mpi::DEFAULT_MASTER );
eo::mpi::ParallelApplyStore< EOT > store( eval, eo::mpi::DEFAULT_MASTER );
store.wrapHandleResponse( new CatBestAnswers );
eoParallelPopLoopEval< EOT > popEval( eval, assign, &store, eo::mpi::DEFAULT_MASTER, 3 );
eoParallelPopLoopEval< EOT > popEval( assign, eo::mpi::DEFAULT_MASTER, &store );
eo::log << eo::quiet << "Before first evaluation." << std::endl;
popEval( pop, pop );
eo::log << eo::quiet << "After first evaluation." << std::endl;
@ -160,7 +158,7 @@ int main(int ac, char** av)
} else
{
eoPop< EOT > pop( popSize, init );
eoParallelPopLoopEval< EOT > popEval( eval, assign, eo::mpi::DEFAULT_MASTER, 3 );
eoParallelPopLoopEval< EOT > popEval( assign, eo::mpi::DEFAULT_MASTER, eval );
popEval( pop, pop );
}

View file

@ -1,5 +1,6 @@
# include <mpi/eoMpi.h>
# include <mpi/eoParallelApply.h>
# include <mpi/eoTerminateJob.h>
# include <boost/serialization/vector.hpp>
@ -32,9 +33,11 @@ void subtask( vector<int>& v, int rank )
DynamicAssignmentAlgorithm algo( workers );
SubWork sw;
ParallelApplyStore<int> store( sw, v, rank );
ParallelApplyStore<int> store( sw, rank );
store.data( v );
ParallelApply<int> job( algo, rank, store );
job.run();
EmptyJob stop( algo, rank );
}
struct Work: public eoUF< vector<int>&, void >
@ -74,11 +77,13 @@ int main(int argc, char** argv)
{
Work w;
DynamicAssignmentAlgorithm algo( 1, 2 );
ParallelApplyStore< vector<int> > store( w, metaV, 0 );
ParallelApplyStore< vector<int> > store( w, 0 );
store.data( metaV );
ParallelApply< vector<int> > job( algo, 0, store );
job.run();
if( job.isMaster() )
{
EmptyJob stop( algo, 0 );
v = metaV[0];
cout << "Results : " << endl;
for(int i = 0; i < v.size(); ++i)

View file

@ -1,5 +1,6 @@
# include <mpi/eoMpi.h>
# include <mpi/eoParallelApply.h>
# include <mpi/eoTerminateJob.h>
# include <iostream>
@ -110,8 +111,8 @@ int main(int argc, char** argv)
for( unsigned int i = 0; i < tests.size(); ++i )
{
ParallelApplyStore< int > store( plusOneInstance, v, eo::mpi::DEFAULT_MASTER, 3 );
// Job< JobData<int> > job( *(tests[i].assign), eo::mpi::DEFAULT_MASTER, store );
ParallelApplyStore< int > store( plusOneInstance, eo::mpi::DEFAULT_MASTER, 3 );
store.data( v );
ParallelApply< int > job( *(tests[i].assign), eo::mpi::DEFAULT_MASTER, store );
if( job.isMaster() )
@ -126,6 +127,7 @@ int main(int argc, char** argv)
if( job.isMaster() )
{
EmptyJob stop( *(tests[i].assign), eo::mpi::DEFAULT_MASTER );
++offset;
for(int i = 0; i < v.size(); ++i)
{

View file

@ -1,5 +1,6 @@
# include <mpi/eoMpi.h>
# include <mpi/eoParallelApply.h>
# include <mpi/eoTerminateJob.h>
# include <iostream>
@ -60,13 +61,15 @@ int main(int argc, char** argv)
StaticAssignmentAlgorithm assign( v.size() );
ParallelApplyStore< int > store( plusOneInstance, v, eo::mpi::DEFAULT_MASTER, 1 );
ParallelApplyStore< int > store( plusOneInstance, eo::mpi::DEFAULT_MASTER, 1 );
store.data( v );
store.wrapIsFinished( new ShowWrappedResult<int> );
ParallelApply<int> job( assign, eo::mpi::DEFAULT_MASTER, store );
// Equivalent to:
// Job< ParallelApplyData<int> > job( assign, 0, store );
job.run();
EmptyJob stop( assign, eo::mpi::DEFAULT_MASTER );
if( job.isMaster() )
{