Re: OpenMP: data scoping and modules
- From: joaquin.casanova@xxxxxxxxx
- Date: 28 Feb 2007 06:32:44 -0800
Hello Joaquin,
The short answer to your question: Yes.
However, in general it is recommended to keep the usage of global
variables to a minimum, since the "non-locality" in programming style
is error-prone. In your example, just assume that "sub" is called within
a threaded region. Then, at the very least, you need to put updates
to shared_data into a critical region. Even so, your algorithm may
not work as intended.
Regards
OK, thanks. So in this case, if i took private_data out of module data
and instead kept it only as an argument to func, that would be better
because I'd have fewer globally declared variables, but it would still
be private, because it's declared inside func?
.
- References:
- OpenMP: data scoping and modules
- From: joaquin . casanova
- Re: OpenMP: data scoping and modules
- From: Reinhold Bader
- OpenMP: data scoping and modules
- Prev by Date: Re: Matlab -> Fortran
- Next by Date: Re: Array Constructors
- Previous by thread: Re: OpenMP: data scoping and modules
- Next by thread: character string assumed length
- Index(es):