Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 16db7a6e authored by David Parsons's avatar David Parsons
Browse files

Add support for systems without openmp

parent ea8ae6b1
No related branches found
No related tags found
No related merge requests found
......@@ -34,7 +34,10 @@
#include <stdio.h>
#include <signal.h>
#include <sys/stat.h>
#ifdef _OPENMP
#include <omp.h>
#endif
// =================================================================
// Project Files
......@@ -182,9 +185,11 @@ int main(int argc, char* argv[])
break;
}
case 'p' : {
#ifdef _OPENMP
run_in_parallel = true;
if (atoi(optarg) > 0)
omp_set_num_threads(atoi(optarg));
#endif
break;
}
default : {
......@@ -203,9 +208,10 @@ int main(int argc, char* argv[])
t_end = t0 + 1000;
// It the user didn't ask for a parallel run, set number of threads to 1
#ifdef _OPENMP
if (not run_in_parallel)
omp_set_num_threads(1);
#endif
// =================================================================
// Load the simulation
......
......@@ -33,7 +33,10 @@
#include "Selection.h"
#include <math.h>
#ifdef _OPENMP
#include <omp.h>
#endif
#include "ExpManager.h"
#include "VisAVis.h"
......@@ -188,7 +191,9 @@ void Selection::step_to_next_generation(void)
std::list<Individual*> old_generation = _exp_m->get_indivs();;
std::list<Individual*> new_generation;
#ifdef _OPENMP
#pragma omp parallel for collapse(2) schedule(dynamic)
#endif
for (int16_t x = 0 ; x < grid_width ; x++)
for (int16_t y = 0 ; y < grid_height ; y++)
do_replication(reproducers[x][y], x * grid_height + y, x, y);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment