Commit f0ea3065 authored by Joseph Pallamidessi's avatar Joseph Pallamidessi

Add openMP support

Now parallelize the evaluation of the populations
parent 2170ff74
......@@ -20,7 +20,7 @@ ADD_LIBRARY( libalex STATIC ${libalex_src} )
#Libeasea static library
FILE(GLOB libeasea_src libeasea/*.cpp )
ADD_LIBRARY( libeasea STATIC ${libeasea_src} ${libeasea_src_win})
SET_TARGET_PROPERTIES(libeasea PROPERTIES OUTPUT_NAME "libeasea" PREFIX "" COMPILE_FLAGS "-O3")
SET_TARGET_PROPERTIES(libeasea PROPERTIES OUTPUT_NAME "libeasea" PREFIX "" COMPILE_FLAGS "-O3 -fopenmp")
#Boost program_options static library
......
......@@ -9,6 +9,9 @@
#include <iostream>
#include <fstream>
#include <string.h>
#ifdef _OPENMP
#include <omp.h>
#endif
#include "include/CRandomGenerator.h"
#include "include/CIndividual.h"
#include "include/Parameters.h"
......@@ -110,6 +113,7 @@ void CPopulation::initPopulation(CSelectionOperator* selectionOperator,
void CPopulation::evaluatePopulation(CIndividual** population, unsigned populationSize){
#pragma omp parallel for schedule(runtime)
for( unsigned i=0 ; i < populationSize ; i++ )
population[i]->evaluate();
}
......
......@@ -3,7 +3,7 @@ ifeq ($(shell uname -o 2>/dev/null),Msys)
OS := MINGW
endif
CXXFLAGS = -g -O1 -Wall -fmessage-length=0 -I/usr/local/cuda/include -I../boost/
CXXFLAGS = -g -O1 -fopenmp -Wall -fmessage-length=0 -I/usr/local/cuda/include -I../boost/
OBJS = CRandomGenerator.o CSelectionOperator.o CEvolutionaryAlgorithm.o\
CStoppingCriterion.o COptionParser.o CPopulation.o CIndividual.o\
......
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