meaning of "inherit the data-sharing attributes"

Discuss the OpenMP 3.0 API Specifications with the OpenMP Arch. Review Board. (Read Only)

meaning of "inherit the data-sharing attributes"

Postby m_van_waveren » Fri Jun 25, 2010 10:15 am

We at Fujitsu have some questions of the meaning of "inherit the data-sharing attributes" in the OpenMP 3.0 standard.

Section 2.9.1.1 of OpenMP 3.0 says
"For constructs other than task, if no default clause is present,
these variables inherit their data-sharing attributes from the enclosing
context." (page 79)"

We understand the word "inherit" means accessing the original data in
the enclosing context. (does not copy the data and its attribute)

2.9.1.2 says
"Formal arguments of called routines in the region that are passed
by reference inherit the data-sharing attributes of the associated
actual argument."(page 80, C/C++ portion)
"Dummy arguments of called routines in the region that are passed by
reference inherit the data-sharing attributes of the associated actual
argument."(page 80, Fortran portion)

We understand the words "inherit" means accessing the actual argument
not to the dummy/formal argument with the same attribute.


sample1: inherit from the enclosing context
--------------------------------------------------------------------
See the variable "a" referenced in a section of the following code :

!$omp parallel private(a) ! Original "a" is private.
a = 0
!$omp sections ! There is no default clause.
a = 1 ! What does "a" refer?

We understand "a" refers private version of outer parallel region.
And it is different form the following sample code, which has
"private(a)" specified in section clause.

!$omp parallel private(a)
a = 0
!$omp sections private(a) ! Specifing of private clause is
a = 1 ! *not* same meaning.
--------------------------------------------------------------------

sample2: inherit from associated actual argument (1)
--------------------------------------------------------------------
program test1
integer :: a
a = 10
!$omp parallel shared(a)
call sub(a) ! "a" is shared in this parallel region.
!$omp end parallel
end

subroutine sub(x)
integer :: x ! "x" refers "a" (associated actual argument).
end
--------------------------------------------------------------------

sample3: inherit from associated actual argument (2)
--------------------------------------------------------------------
program test2
integer :: b
!$omp parallel private(b)
b = 20
call sub(b) ! "b" is private in this parallel region.
!$omp end parallel
end

subroutine sub(y)
integer :: y ! "y" refers "b" (associated actual argument).
end
--------------------------------------------------------------------
m_van_waveren
 
Posts: 9
Joined: Tue Dec 11, 2007 12:57 pm
Location: Toulouse, France

Re: meaning of "inherit the data-sharing attributes"

Postby Federico » Thu Jul 01, 2010 1:04 pm

The interpretation of the examples seems correct.
Federico
 
Posts: 22
Joined: Wed Oct 24, 2007 6:39 am


Return to OpenMP 3.0 API Specifications

Who is online

Users browsing this forum: No registered users and 0 guests