Commit 0093d042 authored by Frederic's avatar Frederic

CMAES-gpu

parent 7711f217
......@@ -29,6 +29,7 @@ Centre de Math
#define STD_FLAVOR_CMAES 2
#define CUDA_FLAVOR_SO 0
#define CUDA_FLAVOR_MO 1
#define CUDA_FLAVOR_CMAES 2
#define UNIX 1
#define WINDOWS 2
......
......@@ -2161,6 +2161,8 @@ int CEASEALexer::create(CEASEAParser* pParser, CSymbolTable* pSymTable)
if (TARGET==CUDA){
if(TARGET_FLAVOR == CUDA_FLAVOR_SO )
strcat(sTemp,"CUDA.tpl");
else if(TARGET_FLAVOR == CUDA_FLAVOR_CMAES )
strcat(sTemp,"CMAES_CUDA.tpl");
else
strcat(sTemp,"CUDA_MO.tpl");
......
......@@ -355,7 +355,7 @@ Object
if (bVERBOSE) printf(" %s pointer declared (%d bytes)\n",$2->sName,$2->nSize);
}
| Symbol '[' Expr ']' {
if((TARGET_FLAVOR==STD_FLAVOR_CMAES) && nPROBLEM_DIM==0 && strcmp(pCURRENT_CLASS->sName,"Genome")==0) { nGENOME_NAME=$1->sName; nPROBLEM_DIM=(int)$3;}
if((TARGET_FLAVOR==STD_FLAVOR_CMAES || TARGET_FLAVOR==CUDA_FLAVOR_CMAES) && nPROBLEM_DIM==0 && strcmp(pCURRENT_CLASS->sName,"Genome")==0) { nGENOME_NAME=$1->sName; nPROBLEM_DIM=(int)$3;}
$1->nSize=pCURRENT_TYPE->nSize*(int)$3;
$1->pClass=pCURRENT_CLASS;
$1->pType=pCURRENT_TYPE;
......@@ -1382,6 +1382,10 @@ int main(int argc, char *argv[]){
TARGET=STD;
TARGET_FLAVOR = STD_FLAVOR_CMAES;
}
else if (!mystricmp(sTemp,"cmaes_cuda")) {
TARGET=CUDA;
TARGET_FLAVOR = CUDA_FLAVOR_CMAES;
}
else if (!mystricmp(sTemp,"v")) bVERBOSE=true;
else if (!mystricmp(sTemp,"path")) {
......
......@@ -1033,9 +1033,9 @@ void EvolutionaryAlgorithm::showPopulationStats(struct timeval beginTime){
for(size_t i=0; i<population->parentPopulationSize; i++){
currentAverageFitness+=population->parents[i]->getFitness();
#if \MINIMAXI
if(population->parents[i]->getFitness()>population->Best->getFitness())
#else
if(population->parents[i]->getFitness()<population->Best->getFitness())
#else
if(population->parents[i]->getFitness()>population->Best->getFitness())
#endif
population->Best=population->parents[i];
}
......
......@@ -547,9 +547,9 @@ void EvolutionaryAlgorithm::showPopulationStats(struct timeval beginTime){
for(size_t i=0; i<population->parentPopulationSize; i++){
currentAverageFitness+=population->parents[i]->getFitness();
#if \MINIMAXI
if(population->parents[i]->getFitness()>population->Best->getFitness())
#else
if(population->parents[i]->getFitness()<population->Best->getFitness())
#else
if(population->parents[i]->getFitness()>population->Best->getFitness())
#endif
population->Best=population->parents[i];
}
......
......@@ -572,9 +572,9 @@ void EvolutionaryAlgorithm::showPopulationStats(struct timeval beginTime){
for(size_t i=0; i<population->parentPopulationSize; i++){
currentAverageFitness+=population->parents[i]->getFitness();
#if \MINIMAXI
if(population->parents[i]->getFitness()>population->Best->getFitness())
#else
if(population->parents[i]->getFitness()<population->Best->getFitness())
#else
if(population->parents[i]->getFitness()>population->Best->getFitness())
#endif
population->Best=population->parents[i];
}
......
......@@ -334,9 +334,9 @@ void EvolutionaryAlgorithm::showPopulationStats(struct timeval beginTime){
for(size_t i=0; i<population->parentPopulationSize; i++){
currentAverageFitness+=population->parents[i]->getFitness();
#if \MINIMAXI
if(population->parents[i]->getFitness()>population->Best->getFitness())
#else
if(population->parents[i]->getFitness()<population->Best->getFitness())
#else
if(population->parents[i]->getFitness()>population->Best->getFitness())
#endif
population->Best=population->parents[i];
}
......
......@@ -307,9 +307,9 @@ void EvolutionaryAlgorithm::showPopulationStats(struct timeval beginTime){
for(size_t i=0; i<population->parentPopulationSize; i++){
currentAverageFitness+=population->parents[i]->getFitness();
#if \MINIMAXI
if(population->parents[i]->getFitness()>population->Best->getFitness())
#else
if(population->parents[i]->getFitness()<population->Best->getFitness())
#else
if(population->parents[i]->getFitness()>population->Best->getFitness())
#endif
population->Best=population->parents[i];
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment