Erik, Frank, Peter: Thanks guys. I will pursue your suggestions.
--
Scott H. Hawley, Ph.D. Asst. Prof. of Physics
Chemistry & Physics Dept Office: Hitch 100D
Belmont University Tel: +1-615-460-6206
Nashville, TN 37212 USA Fax: +1-615-460-5458
PGP Key at http://sks-keyservers.net
On May 18, 2011, at 12:14 AM, Peter Diener wrote:Hi Scott,On Tue, 17 May 2011, Frank Loeffler wrote:Hi,On Tue, May 17, 2011 at 03:02:00PM -0700, Scott Hawley wrote:Do these all be need to be declared as private?If the temporary variables are declared only inside the loop they areautomatically thread-local. Oh wait, that is Fortran. Well - in thatcase you should either declare all private, or (maybe easier) put theinclude files into separate functions, declare the temporary variablesonly there and call the functions from within the loop, in which casethey also don't have to be specified for openmp (as long as they are notstatic).i certainly don't want the various processors overwriting each others'work, which might be what they're doing. -- maybe they're evengenerating NaNs which would slow things down a bit!Alternatively you may use the DEFAULT(PRIVATE) clause, so that you onlyhave to specify the shared variables. However, in that case you have tomake sure to really declare all the shared variables as shared, sinceotherwise all processors will have to allocate storage and if they are 3dvariables this will slow down the code and increase memory consumption.Also private variables have undefined values on entry to the parallelregion so not declaring all shared variables properly can also adverselyaffect the result. So be careful.You should see that in the results though. It might make sense to firstmake sure that the results with different numbers of threads are thesame (depending on the problem you might actually get bit-by-bitidentical results), and work on optimization later. I agree that yourslow-down actually points towards some bug.FrankCheers,Peter
<PGP.sig><ATT00001..txt>