[Omp] data scope clause
Hoeflinger, Jay P
jay.p.hoeflinger at intel.com
Thu Apr 28 11:05:42 PDT 2005
The effect of making a variable private is that a new variable of the same shape and type as the original variable is made for each thread at the start of the parallel region, and all references to that variable inside the parallel region refer to the private copy.
The effect of making a variable shared is that all references to that variable inside the parallel region refer to the original variable.
So, a variable does not need to be a global variable to be shared. Whatever kind of variable you have outside the parallel region is the variable that all threads will reference inside the parallel region.
Jay
-----Original Message-----
From: Omp-bounces at openmp.org [mailto:Omp-bounces at openmp.org] On Behalf Of Patricia Bittencourt Sampaio
Sent: Thursday, April 28, 2005 12:54 PM
To: Omp at openmp.org
Subject: RE: [Omp] data scope clause
Hello,
I have been made some tests so as to check the
funcionallity of the scope clauses in particullar when
nested parallel regions are used with more than one
function envolved.
The question of private clause was clarified to
me. But the shared clause is still obscure.
As Jose Luis said an interesting question is when
the variables are passed by reference. That means
that only the pointers is shared among the threads but
not the area of memory that are pointed to.
I guess the only way so as to create a variable
that is shared when some writes occured in a routine
outside is declaring that variable as global so as
all routines recognize it. This solution does not need
that the variable has to be passed as a parameter and
all threads will be able to write it under critical
clause.
Any comments will be welcome.
[]'s
Patrícia Bittencourt Sampaio
====================================
Federal University of Rio de Janeiro
__________________________________________________
Converse com seus amigos em tempo real com o Yahoo! Messenger
http://br.download.yahoo.com/messenger/
_______________________________________________
Omp mailing list
Omp at openmp.org
http://openmp.org/mailman/listinfo/omp_openmp.org
More information about the Omp
mailing list