Hi Ashok,


I can't guarantee Nektar will work perfectly with openmp, since we haven't tried this yet.

In any case, I think what you need is:

    #pragma omp parallel for num_threads(k)

Without the "for" clause all threads will execute the whole loop, instead of sharing the work. 


Cheers,

Douglas


From: nektar-users-bounces@imperial.ac.uk <nektar-users-bounces@imperial.ac.uk> on behalf of ashok jallepalli <ash.nani@gmail.com>
Sent: 02 December 2016 13:27:48
To: nektar-users
Subject: [Nektar-users] Using OpenMP on Nektar Libraries.
 
Hi,
   
     I have the following snippet of code and would like to know what I am doing wrong below. 
Without parallelizing, if this loop look takes 0.01 seconds. When I use k threads, this function is taking k*0.01 seconds. 

(1) Is there a faster way to evaluate a local expansion at a bunch of points. Or i must assess them 1by1
(2) I tried num threads from k=2 to k=10. This behavior is consistent. always takes (k*0.01). Is this behavior consistent?



#pragma omp parallel num_threads(k)
for (int i =0 ; i < values.num_elements(); i++)

{

        values[i] = lexp->PhysEvaluate(glCoords.at(i),el_Phys);

}


// Info  lexp is localExpansionShPtr;
// num_elements ~21
// In the program, I am replacing k with 2 .. 10 number

Ashok.