Add the SMP module
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@2714 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
409a1b21b8
commit
0890c67d31
43 changed files with 4030 additions and 41 deletions
40
trunk/smp/test/t-smpScheduler.cpp
Normal file
40
trunk/smp/test/t-smpScheduler.cpp
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
#include <cassert>
|
||||
#include <vector>
|
||||
#include <cstdlib>
|
||||
|
||||
#include <smp>
|
||||
#include <eo>
|
||||
|
||||
#include "smpTestClass.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace paradiseo::smp;
|
||||
|
||||
int main(void)
|
||||
{
|
||||
srand(time(NULL));
|
||||
|
||||
loadInstances("t-data.dat", n, bkv, a, b);
|
||||
// Evaluation function
|
||||
IndiEvalFunc plainEval;
|
||||
// Init a solution
|
||||
IndiInit chromInit;
|
||||
|
||||
eoPop<Indi> pop(100, chromInit);
|
||||
|
||||
|
||||
int nbWorkers = 4;
|
||||
|
||||
|
||||
Scheduler<Indi> sched(nbWorkers);
|
||||
|
||||
sched(plainEval, pop);
|
||||
|
||||
std::cout << pop << std::endl;
|
||||
|
||||
// All indi would be evaluate once
|
||||
for( unsigned i = 0; i < pop.size(); i++)
|
||||
assert(pop[i].evalNb == 1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue