← Back to team overview

yade-dev team mailing list archive

Re: How to use a plugin

 

> I ran with yade -j3, and got the following:
> 
> Yade [1]: O.numThreads
>  ->  [1]: 2
> Yade [2]: os.environ['OMP_NUM_THREADS']
>  ->  [2]: '3'
> And C displays omp_get_max_threads() as 1. 
Hi Boon, this is very unusual. O.numThreads just calls
omp_get_max_threads()... and -j3 only sets OMP_NUM_THREADS before
initializing openMP, which then should use this value for
omp_get_max_threads() (see OpenMP documentation).

Oh, for your mutex problem: IIRC there is something like #pragma omp
critical-section (or something similar) which prevents multiple threads
being in the same part of the code simultaneously. You could use that
instead of explicit mutex, it would be just 1 line of code. See OpemMP
documentation for details (there is something at wikipedia as well, I
think...

> Which should I trust?
Tough question as they should be the same...

You are not using gcc < 4.4, right? (the OpenMP implementation was
probably not as good before as it is now)

v





Follow ups

References