OpenMP: data scoping and modules
- From: joaquin.casanova@xxxxxxxxx
- Date: 27 Feb 2007 10:07:14 -0800
I'm getting confused by OpenMP behaviour for shared/private. I can't
find a definitive answer about the rules for shared-ness of variables
defined in modules. Let's say I have a program like this:
PROGRAM test
use omp_lib
use utils
implicit none
real::out,x
call sub
call omp_set_num_threads(4)
!$omp parallel private(out,x)
x = ...
out = func(x)
print*,x,out,omp_get_num_thread()
!$omp end parallel
END PROGRAM test
MODULE utils
use data
implicit none
contains
FUNCTION func(x) result(y)
...
private_data = x
...
END FUNCTION func
SUBROUTINE sub
...
shared_data = ...
...
END SUBROUTINE sub
END MODULE utils
MODULE data
implicit none
real::shared_data
real::private_data
!$omp threadprivate(private_data)
END MODULE data
My question is this: with the omp directives in this example, is
shared_data shared, and is private_data private? Thanks for your help.
.
- Follow-Ups:
- Re: OpenMP: data scoping and modules
- From: Reinhold Bader
- Re: OpenMP: data scoping and modules
- Prev by Date: Re: integer*8 speed vs integer*4 speed
- Next by Date: Re: fortran 2003 compiler
- Previous by thread: integer*8 speed vs integer*4 speed
- Next by thread: Re: OpenMP: data scoping and modules
- Index(es):