In my last thread (here), I mentioned a problem I was seeing with common blocks in the OpenMP paradigm. After some testing, I’m out of ideas, so I’d appreciate some advice.
The code I’m using makes use of common blocks. What I think is happening is that when subroutines inside the parallel region use these common blocks, they refer back to the global values – even if the individual variables have been declared as “private”. If, on the other hand, I make the common blocks “threadprivate”, the code outside of the parallel region cannot use those variables to initialize them; subroutines (outside the parallel region) that should be seeing values for those variables are getting 0’s instead.
Is there a way in OpenMP to (1) get the compiler to create local copies of common blocks for use in a parallel region, (2) initialize those variables according to any pre-existing values in the global common blocks, and (3) distinguish based on location which version of the common block to be using?