I have a #pragma omp parallel for
loop inside a class method. Each thread readonly accesses few method local variables, few call private data and a method's parameter. All of them are declared in a shared
clause.
My questions:
- Performance wise should not make any difference declare these
variables
shared
orfirstprivate
. Right? - Is the same true if I'm not careful about making variable not sharing the same cache line?
- If one of the shared variables is a pointer and inside the thread I read a value through it, is there an aliasing problem like in ordinary loops?
Tomorrow I will try to profile my code. In the meantime thanks for your advice!