1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-09-20 09:15:38 +01:00

Hadrons: exposing scheduler settings

This commit is contained in:
Antonin Portelli 2016-12-06 12:12:05 +09:00
parent a683a0f55a
commit 646b11f5c2
2 changed files with 18 additions and 4 deletions

View File

@ -76,6 +76,7 @@ Application::Application(const std::string parameterFileName)
void Application::setPar(const Application::GlobalPar &par)
{
par_ = par;
LOG(Message) << par_.seed << std::endl;
env_.setSeed(strToVec<int>(par_.seed));
}
@ -144,15 +145,14 @@ void Application::schedule(void)
// constrained topological sort using a genetic algorithm
LOG(Message) << "Scheduling computation..." << std::endl;
constexpr unsigned int maxGen = 200, maxCstGen = 50;
unsigned int k = 0, gen, prevPeak, nCstPeak = 0;
auto graph = env_.makeModuleGraph();
auto con = graph.getConnectedComponents();
std::random_device rd;
GeneticScheduler<unsigned int>::Parameters par;
par.popSize = 10;
par.mutationRate = .1;
par.popSize = par_.genetic.popSize;
par.mutationRate = par_.genetic.mutationRate;
par.seed = rd();
CartesianCommunicator::BroadcastWorld(0, &(par.seed), sizeof(par.seed));
for (unsigned int i = 0; i < con.size(); ++i)
@ -182,7 +182,8 @@ void Application::schedule(void)
<< MEM_MSG(scheduler.getMinValue()) << std::endl;
}
gen++;
} while ((gen < maxGen) and (nCstPeak < maxCstGen));
} while ((gen < par_.genetic.maxGen)
and (nCstPeak < par_.genetic.maxCstGen));
auto &t = scheduler.getMinSchedule();
LOG(Message) << "Program " << i + 1 << " (memory peak: "
<< MEM_MSG(scheduler.getMinValue()) << "):" << std::endl;

View File

@ -49,11 +49,24 @@ public:
unsigned int, end,
unsigned int, step);
};
class GeneticPar: Serializable
{
public:
GeneticPar(void):
popSize{20}, maxGen{1000}, maxCstGen{100}, mutationRate{.1} {};
public:
GRID_SERIALIZABLE_CLASS_MEMBERS(GeneticPar,
unsigned int, popSize,
unsigned int, maxGen,
unsigned int, maxCstGen,
double , mutationRate);
};
class GlobalPar: Serializable
{
public:
GRID_SERIALIZABLE_CLASS_MEMBERS(GlobalPar,
TrajRange, trajCounter,
GeneticPar, genetic,
std::string, seed);
};
public: