by ejd » Tue Apr 15, 2008 2:28 pm
I have another answer that I feel requires full disclosure. I have been trying to answer the forum questions as vendor non-specific as possible. That is because this forum is for OpenMP questions and not to try and sell people anything. However, in this case, there is a vendor specific addition to OpenMP that could help you. That is not to say that other vendors don't have something as well - I just don't know it if they do. I happen to work for the vendor that I am going to "promote" in this case.
That said, Sun Microsystems made an addition to the default clause. With the newer Sun compilers, you can say default(__auto) and it will try and figure out how the various variables in the construct should be scoped. If you also specify compiler commentary, the appropriate clauses (shared, private, etc) will appear with the list of variables. This can be cut out of the commentary and pasted into your code and then you can use any compiler that supports OpenMP. I don't know how well it would do with your code. With Fortran code we have seen cases where the user would have had to scope 100's of variables reduced down to where they only had to scope 6 variables. With C and C++ it is harder, because of pointer aliasing.
We had discussed adding this to the OpenMP spec, but it is not a feature that all compilers could support, because it requires dependency analysis (used for autoparallelizing). Features like this are tried by the various vendors to see if they are useful and should be something to consider adding to the OpenMP spec. At the time Sun added this feature a couple of years ago, no other vendor had it. There was a university that put it into their research compiler as well. Other vendors may now have a similar feature (and they are free to respond to your query as well).
The Sun compilers are free (support costs money) and run on Solaris and Linux. If you do try this, let me know how it works. We are always looking for ways to improve it.