[Omp] availability of data structures in subroutines executed in parallel

Daniel Franke franke.daniel at gmail.com
Thu Nov 16 03:48:30 PST 2006


Dear all,

this may be a stupid question, but I am out of my wits here.
In a subroutine, I have something similar to this

DO
!$OMP PARALLEL SHARED(graph)
  ! select a startnode from graph
  CALL graph_algorithm(startnode)
!$OMP END PARALLEL
  ! alter the graph, check exit conditions
END DO

where GRAPH is a node type that holds an array of pointers to
neighbouring nodes, each of those holds an array of pointers to
neighbouring nodes ...

Now, while GRAPH_ALGORITHM works fine if compiled without OMP support
or if OMP_NUM_THREADS=1 (gfortran-4.2.-prerelease), it crashes at
various places if executed in parallel. The algorithm is a
depth-first-search within a subset of the nodes, beginning at
STARTNODE.  The nodes themselves are not altered during the process,
everything is read-only.

>From debugging I already learned, that some (all?) of the pointers
building the graph become undefined when GRAPH_ALGORITHM is executed
in parallel -- although the GRAPH is explicitely SHARED?! I read the
specs back and forth and can not conclude anything helpful from it.

It is to assume that I miss something important here.
A hint or pointer would what this might be would really be appreciated.

Thanks and regards
    Daniel


More information about the Omp mailing list