- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I was wondering why this simple program:
Notice that the same program works fine when compiled with gfortran and PGI compiler. If anybody has a clue I would be really glad to hear that.
M.
I was wondering why this simple program:
[fortran]program allocatable type pippo real(8), allocatable :: vec(:) end type pippo type(pippo) :: a !$omp parallel !$omp single allocate(a%vec(10)) !$omp end single !$omp end parallel end program allocatable[/fortran]crashes when compiled with:
- ifort -openmp
Notice that the same program works fine when compiled with gfortran and PGI compiler. If anybody has a clue I would be really glad to hear that.
M.
Link Copied
6 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Not with any version of ifort I have installed here (up to 14 weeks old, none older).
Maybe you found a buggy version of the compiler, or got the environment PATH settings fouled?
Are you certain, if you tried every past version of those other compilers, you would never find a bug?
Maybe you found a buggy version of the compiler, or got the environment PATH settings fouled?
Are you certain, if you tried every past version of those other compilers, you would never find a bug?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The version of ifort I am using is:
forrtl: severe (151): allocatable array is already allocated
Image PC Routine Line Source
a.out 0809129D Unknown Unknown Unknown
a.out 08090095 Unknown Unknown Unknown
a.out 08072938 Unknown Unknown Unknown
a.out 0806516D Unknown Unknown Unknown
a.out 080557CD Unknown Unknown Unknown
a.out 0804A548 Unknown Unknown Unknown
libiomp5.so B776AA6D Unknown Unknown Unknown
libiomp5.so B774A56C Unknown Unknown Unknown
libiomp5.so B774D020 Unknown Unknown Unknown
libiomp5.so B77328B7 Unknown Unknown Unknown
a.out 0804A477 Unknown Unknown Unknown
a.out 0804A391 Unknown Unknown Unknown
libc.so.6 B75ABB56 Unknown Unknown Unknown
a.out 0804A2A1 Unknown Unknown Unknown
If "pointer" is used instead of "allocatable" or the option "-O0" is passed to the compiler, then no fail is encountered.
I know that FORTRAN 90/95 standards do not admit allocatable fields as part of a derived data-type, but I am quite curious to understand what the compiler does when it compiles that simple program and why it fails with ifort and not with other compilers. Possibly this will give me a better understanding of the differences between pointers and allocatables types.
M.
- ifort (IFORT) 11.1 20091130
Copyright (C) 1985-2009 Intel Corporation. All rights reserved.
forrtl: severe (151): allocatable array is already allocated
Image PC Routine Line Source
a.out 0809129D Unknown Unknown Unknown
a.out 08090095 Unknown Unknown Unknown
a.out 08072938 Unknown Unknown Unknown
a.out 0806516D Unknown Unknown Unknown
a.out 080557CD Unknown Unknown Unknown
a.out 0804A548 Unknown Unknown Unknown
libiomp5.so B776AA6D Unknown Unknown Unknown
libiomp5.so B774A56C Unknown Unknown Unknown
libiomp5.so B774D020 Unknown Unknown Unknown
libiomp5.so B77328B7 Unknown Unknown Unknown
a.out 0804A477 Unknown Unknown Unknown
a.out 0804A391 Unknown Unknown Unknown
libc.so.6 B75ABB56 Unknown Unknown Unknown
a.out 0804A2A1 Unknown Unknown Unknown
If "pointer" is used instead of "allocatable" or the option "-O0" is passed to the compiler, then no fail is encountered.
I know that FORTRAN 90/95 standards do not admit allocatable fields as part of a derived data-type, but I am quite curious to understand what the compiler does when it compiles that simple program and why it fails with ifort and not with other compilers. Possibly this will give me a better understanding of the differences between pointers and allocatables types.
M.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
!$ompparallel
if(.not. allocated(a%vec) then
!$ompcritical
if (.not. allocated(a%vec)allocate(a%vec(10))
!$ompendcritical
endif
(assume other code here)
!$ompendparallel
Your program was in error.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear Jim,
I am sorry, but I can't get your point. Could you be more specific and tell me where is the error and why is it an error?
M.
I am sorry, but I can't get your point. Could you be more specific and tell me where is the error and why is it an error?
M.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Your code may accidentally work, then unexpectedly fail, should you insert additional code following the !$OMP SINGLE and preceeding the !$OMP END PARALLEL.
[bash]!$omp parallel !$omp single allocate(a%vec(10)) !$omp end single {any code here can experience problems} !$omp end parallel { code here should be OK}
Often postings on this forum are in "sketch" format (meaning missing details).
Jim Dempsey
[/bash]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try adding shared(a)
!$ompparallelshared(a)
!$ompsingle
allocate(a%vec(10))
!$ompendsingle
!$ompendparallel
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page