Merge branch 'openmp' of ssh://localhost:9001/gitroot/eodev/eodev into openmp
This commit is contained in:
commit
a911c98f64
4 changed files with 25 additions and 5 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -40,12 +40,10 @@
|
|||
template <class EOT>
|
||||
void apply(eoUF<EOT&, void>& _proc, std::vector<EOT>& _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())
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@
|
|||
// t-eoParallel.cpp
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include <omp.h>
|
||||
|
||||
#include <eo>
|
||||
#include <es/make_real.h>
|
||||
//#include <apply.h>
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue