Code:
-
program simple_alloc_copyin
use omp_lib
integer, allocatable, save :: A(:)
!$omp threadprivate(A)
call omp_set_num_threads(2)
ALLOCATE(A(2))
call omp_set_nested(.TRUE.)
call omp_set_dynamic(.FALSE.)
!$omp parallel
!$omp parallel num_threads(2)
if(.NOT.allocated(A))allocate(A(2))
!$omp end parallel
!$omp parallel
if(.NOT.allocated(A))print *, 'not allocated!!!'
!$omp end parallel
!$omp parallel copyin(A)
print *, omp_get_thread_num(), ':', A
!$omp end parallel
!$omp end parallel
end program simple_alloc_copyin
-
Execution:
-
not allocated!!!
not allocated!!!
Segmentation fault
-
In the OpenMP forum told me that it was a compiler issue.
http://openmp.org/forum/viewtopic.php?f=7&t=639&p=3400#p3400
--
Summary: gfortran and OpenMP: Allocate fails on nested
parallelism regions
Product: gcc
Version: 4.4.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libgomp
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: shiv4k at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44342