[Omp] availability of data structures in subroutines executedin parallel

Meadows, Lawrence F lawrence.f.meadows at intel.com
Wed Nov 22 13:12:07 PST 2006


What Greg says is correct. On a shared memory system it is hard
to make anything unaccessible from any thread even if it is not
legal from OpenMP standpoint (that is, threadprivate or some of the
more unusual nested parallelism cases). There are exceptions, but
unlikely you've seen them. Certainly if things are dynamically
allocated by Fortran ALLOCATE (and your code looks like Fortran)
then they are shared.

I'm not really familiar with the current quality of GCC Fortran
and of the OpenMP support but it is young enough that you may
have hit a compiler/runtime bug. Of course if you could come up
with a simple example I'm sure the GCC folks would accept a bug
report. Also there are at least five other Fortran compilers that
support OpenMP on variants of x86 architecture: Intel, PGI, ABSOFT,
Sun, Fujitsu/Lahey. So if that is your architecture then you could
try one of those.

Good luck.

-- Larry

>-----Original Message-----
>From: omp-bounces at openmp.org [mailto:omp-bounces at openmp.org] 
>On Behalf Of Greg Bronevetsky
>Sent: Thursday, November 16, 2006 6:43 AM
>To: Daniel Franke
>Cc: omp at openmp.org
>Subject: Re: [Omp] availability of data structures in 
>subroutines executedin parallel
>
>   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
>> 
>
>
>_______________________________________________
>Omp mailing list
>Omp at openmp.org
>http://openmp.org/mailman/listinfo/omp
>


More information about the Omp mailing list