* eoParallel: added the call to omp_set_num_threads to define the number of threads with parameters

This commit is contained in:
Caner Candan 2011-02-02 23:50:58 +01:00
commit 2044d92eff
3 changed files with 22 additions and 2 deletions

View file

@ -44,8 +44,6 @@ void apply(eoUF<EOT&, void>& _proc, std::vector<EOT>& _pop)
#ifdef _OPENMP
omp_set_num_threads(eo::parallel.nthreads());
double t1 = omp_get_wtime();
if (!eo::parallel.isDynamic())

View file

@ -25,6 +25,8 @@ Caner Candan <caner.candan@thalesgroup.com>
*/
#include <omp.h>
#include "eoParallel.h"
eoParallel::eoParallel() :
@ -74,6 +76,16 @@ void eoParallel::_createParameters( eoParser& parser )
void make_parallel(eoParser& parser)
{
eo::parallel._createParameters( parser );
#ifdef _OPENMP
if ( eo::parallel.isEnabled() )
{
if ( eo::parallel.nthreads() > 0 )
{
omp_set_num_threads( eo::parallel.nthreads() );
}
}
#endif // !_OPENMP
}
eoParallel eo::parallel;