[Openmp-dev] fortran OpenMP hangs in the last subroutine

David Van Aelst via Openmp-dev openmp-dev at lists.llvm.org
Mon May 16 00:49:02 PDT 2016


 Hi Mark at OpenMP.org, hi campbel... at gmail.com, hi other readers,
I think I have found the reason of the bad/erratic behaviour of my
program.
 I already wrote that the program began to hang in its last subprogram,
called rnflow, although 90 % or 95 % of the work had already been done
by the tenth of previous other subroutines.
 This subroutine is just a rainflow counter, which needs be initialized,
and here is the problem because I used DATA statements, that are said to
put the variables which they act upon into the SHARED set of variables;
there, they become sunject to race condition between the various
processors.
 I read that yesterday; I mas still reading lots of things about good
practises of fortran coding, and things about "valgrind --tool=helgrind"
that I might have inteded to use, and I falled on a paper by The Journal
of Supercomputing in The Netherlands, saying that "Saved local variables
are always shared and non-saved local variables are always
threadprivate. It is all too easy to inadvertently create a saved
variable. For example, in Fortran 90/95 initializing a local variable,
e.g., INTEGER :: I=0, creates a saved variable. A DATA statement has a
similar effect in both Fortran 77 and Fortran 90/95. In OpenMP such
variables are always shared, but often the programmer’s intent was to
initialize a threadprivate variable (which is not possible with local
variables in version 1.1)."
 So tomorrow at work, I will have to go in the depht of this rnflow
subroutine, and simply change a "data a/1/" to "a=1", and then the count
will be exactly the same, except that the program should go to its end
without data race nor hanging.
 I hope that it's the last time that you have to read me,
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/openmp-dev/attachments/20160516/fd4828fd/attachment.html>


More information about the Openmp-dev mailing list