From 0a82d57369cbf7a854aa944158be9caa338b850d Mon Sep 17 00:00:00 2001 From: carlocamilloni <carlo.camilloni@gmail.com> Date: Fri, 7 Dec 2018 01:12:39 +0100 Subject: [PATCH] MultiColvar: improve openmp performance --- src/vesselbase/ActionWithVessel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vesselbase/ActionWithVessel.cpp b/src/vesselbase/ActionWithVessel.cpp index ea5063467..de9b94954 100644 --- a/src/vesselbase/ActionWithVessel.cpp +++ b/src/vesselbase/ActionWithVessel.cpp @@ -265,7 +265,7 @@ void ActionWithVessel::runAllTasks() { // Get number of threads for OpenMP unsigned nt=OpenMP::getNumThreads(); - if( nt*stride*10>nactive_tasks || !threadSafe()) nt=1; + if( nt*stride*2>nactive_tasks || !threadSafe()) nt=1; // Get size for buffer unsigned bsize=0, bufsize=getSizeOfBuffer( bsize ); @@ -275,7 +275,7 @@ void ActionWithVessel::runAllTasks() { if( dertime_can_be_off ) dertime=false; if(timers) stopwatch.start("2 Loop over tasks"); - #pragma omp parallel num_threads(nt) + #pragma omp parallel num_threads(nt) schedule(dynamic) { std::vector<double> omp_buffer; if( nt>1 ) omp_buffer.resize( bufsize, 0.0 ); -- GitLab