Two questions:
1. Are such variables shared unless appearing in a threadprivate directive?
2. Assuming the answer to #1 is "yes", consider the following program:
Code: Select all
program host_association
implicit none
integer :: x = 0
!$omp parallel firstprivate(x)
!$omp master
x = x + 1
call printvar()
!$omp end master
!$omp end parallel
write (*,*) 'Outside of parallel region:', x
contains
subroutine printvar()
x = x + 2
write (*,*) 'In parallel region:', x
end subroutine printvar
end program host_association
- In parallel region: 2
Outside of parallel region: 2