[Omp] availability of data structures in subroutines executed
in parallel
Greg Bronevetsky
greg at bronevetsky.com
Thu Nov 16 06:42:54 PST 2006
Can you provide more details about how you created the graph and how
you use it? If the graph was created outside the omp parallel region, it
is very likely to be shared by default, so your SHARED clause is probably
not doing anything. Furthermore, SHARED applies to the graph variable
itself and not anything that it refers to so unless the entire graph is
contained inside this variable, the SHARED clause is again not doing much.
Thus, it seems likely that the crashes are due to your threads accessing
graph nodes inside the parallel region without proper synchronization.
Greg Bronevetsky
On Thu, 16 Nov 2006, Daniel Franke wrote:
> 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
> _______________________________________________
> Omp mailing list
> Omp at openmp.org
> http://openmp.org/mailman/listinfo/omp
>
More information about the Omp
mailing list