fabian wrote:Hi Mark,
thx for your help !
fabian wrote:1) Use have an uninitalized and unused variable l_count in the shared section of the parallel pragma.
Just a relict from coding ?
It's not unused: it's the upper bound for the parallel loop!
fabian wrote:2) You use these private variables t_...,
and than in a critical-block you assign their values to the "real" variables.
Why not just do all in one crital-block without private variables ?
Because then the critical section would be inside the parallel loop, and would be entered/exited many times per thread instead of once. If the
calc_score function is very expensive, then this additional overhead may not matter too much.
fabian wrote:3) I somehow must have overread it or something,
but i don't understand the sense of "shared" - are not all used variables shared by default ?
You are right they are: I just declared them shared to make the code clear. In general it is a good idea to use the default(none) clause and explicitly declare all referenced variables as shared/private/reduction etc. Otherwise it's all too easy to overlook a variable which ought not to be shared and end up with a race condition which may be hard to debug.