The advice from respondees on the Intel Fortran forum is that in the
private copy of the variable cell, without initialisation, the
allocation status of the dclist component is garbage. Assignment to an
allocatable can cause reallocation if the size or allocation status of
the lhs array is not suitable, and attempting to reallocate with garbage
in the allocation status gives rise to the error.
I'm curious to know if other compilers also give this error, or
something like it, and whether I should file a bug report or consider
this a programming error. By the way, the Intel forum yielded a couple
of easy ways to avoid the problem (make cell a pointer, or put the
parallel section in a subroutine, or use the !$omp clause
FIRSTPRIVATE(cell)).
! test_omp.f90
! compiled with: ifort /Qopenmp test_omp.f90
program test_omp
type cell_type
integer :: site(3)
integer :: step
integer(2) :: lastdir
integer(2) :: DCbound(2)
real :: unbindtime(2)
integer :: visits,revisits,ndclist
integer, allocatable :: dclist(:)
end type
integer, parameter :: nlist = 1000
type(cell_type) :: cell_array(nlist)
type(cell_type) :: cell
integer :: k
call omp_set_num_threads(4)
cell = cell_array(1)
!$omp parallel private(k,cell)
do k = 1,nlist
cell = cell_array(k)
enddo
!$omp end parallel
end
Your code compiles and runs fine on ifort 10.1 and gfortran 4.4.
Cheers
Paul
C:\MinGW\source> g95 gib1.f90 -o b.exe
C:\DOCUME~1\dan\LOCALS~1\Temp/cc3kxco9.o:gib1.f90:(.text+0x9b): undefined
refere
nce to `omp_set_num_threads__'
C:\MinGW\source> gfortran gib1.f90 -o b.exe
ld: crtbegin.o: No such file: No such file or directory
C:\MinGW\source>
I get different errors for different reasons. Does anyone have a mingw
installation where all the open source distros just get along?
C:\MinGW\source>gfortran -fopenmp gib1.f90 -o b.exe
gfortran: libgomp.spec: No such file or directory
C:\MinGW\source>
That's three strikes: I'm out.
--
George
You teach a child to read, and he or her will be able to pass a literacy
test.
George W. Bush
Picture of the Day http://apod.nasa.gov/apod/
Interesting - I'm using ifort beta 11.0.039.
Gib
I've just installed ifort 11.0.066, and my code runs without error.
> C:\MinGW\source>
>
> I get different errors for different reasons. Does anyone have a mingw
> installation where all the open source distros just get along?
>
>
It is easy to break an installation by trying to install or copy too
many things into a single MingW folder. Been there, done that.
When installing a prepackaged g95 of gfortran, you would perhaps be
better off to put each in it's own folder. Then use a startup batch file
to fire up cmd.exe after setting the environment variables as needed.