diff --git a/eo/CMakeLists.txt b/eo/CMakeLists.txt index 211cd3159..35b98d16f 100644 --- a/eo/CMakeLists.txt +++ b/eo/CMakeLists.txt @@ -109,7 +109,7 @@ ENDIF (ENABLE_CMAKE_TESTING) ### 5) Where must cmake go now ? ###################################################################################### -ADD_SUBDIRECTORY(app) +#ADD_SUBDIRECTORY(app) ADD_SUBDIRECTORY(doc) ADD_SUBDIRECTORY(src) ADD_SUBDIRECTORY(test) diff --git a/eo/src/apply.h b/eo/src/apply.h index 63044c385..024dd8963 100644 --- a/eo/src/apply.h +++ b/eo/src/apply.h @@ -40,12 +40,10 @@ template void apply(eoUF& _proc, std::vector& _pop) { -#ifdef _OPENMP - - omp_set_num_threads(eo::parallel.nthreads()); - size_t size = _pop.size(); +#ifdef _OPENMP + double t1 = omp_get_wtime(); if (!eo::parallel.isDynamic()) diff --git a/eo/src/utils/eoParallel.cpp b/eo/src/utils/eoParallel.cpp index e267ce7f1..fdc047ac1 100644 --- a/eo/src/utils/eoParallel.cpp +++ b/eo/src/utils/eoParallel.cpp @@ -25,6 +25,8 @@ Caner Candan */ +#include + #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; diff --git a/eo/test/t-eoParallel.cpp b/eo/test/t-eoParallel.cpp index 055f45987..72d4f264a 100644 --- a/eo/test/t-eoParallel.cpp +++ b/eo/test/t-eoParallel.cpp @@ -2,6 +2,8 @@ // t-eoParallel.cpp //----------------------------------------------------------------------------- +#include + #include #include //#include @@ -40,6 +42,14 @@ int main(int ac, char** av) eo::log << eo::quiet << "DONE!" << std::endl; +#pragma omp parallel + { + if ( 0 == omp_get_thread_num() ) + { + eo::log << "num of threads: " << omp_get_num_threads() << std::endl; + } + } + return 0; }