Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs have moved to the Altera Community. Existing Intel Community members can sign in with their current credentials.

array temporaries...

jv244
Beginner
910 Views
using :
Intel Fortran Compiler for 32-bit applications, Version 8.0 Build 20040616Z Package ID: l_fc_pc_8.0.046_pe049.1
I'm trying to get something like the following to work:
!=============================================
MODULE TEST
TYPE dd
REAL, POINTER, DIMENSION(:,:,:) :: xx
END TYPE dd
CONTAINS
SUBROUTINE TT(A,B)
TYPE(dd), INTENT(INOUT) :: A
TYPE(dd), INTENT(IN) :: B
A%xx=A%xx+B%xx
END SUBROUTINE TT
END MODULE TEST
USE TEST
INTEGER, PARAMETER :: N=100
TYPE(dd), POINTER :: A,B
ALLOCATE(A,B)
ALLOCATE(A%xx(N,N,N),B%xx(N,N,N))
CALL TT(A,B)
END
!=============================================
But the code segfaults at runtime. This seems to be happening as soon as the arrays xx are +- 2Mb (N~80). I've tried using ulimit -s up to 30Mb stack, but this doesn't seem to help. Before I ask my sysadmin again to update to
pe050.1 is it fixed there ? Is there another easy solution (that doesn't involve recoding things with an explicit do loop)
Thanks,
Joost
0 Kudos
8 Replies
Steven_L_Intel1
Employee
910 Views
I don't see anything in what you have posted that should cause a temporary to be created. What does routine TT do?
0 Kudos
jv244
Beginner
910 Views
My guess is that a temporary is created for this thing as the xx are arrays
A%xx=A%xx+B%xx
but I might be wrong...
The little program in the first message is sufficient to recreate the segfault, and is actually very close to the real subroutine having trouble.
Joost
0 Kudos
Steven_L_Intel1
Employee
910 Views
I apologize - I read too quickly.
The compiler really ought to be able to tell in this case that a temp is not needed for the array assignment. My recollection is that we don't get the case where the array is a component of a derived type.
Please feel free to submit this to Intel Premier Support as a feature request.
I was able to run this with a 5MB stack.
0 Kudos
jv244
Beginner
910 Views
strangly, this doesn't work in my case, the stack size (in kbytes) being 20000, and the value of N=100 being unmodified. Does that mean it works with the newer release, or is there something else... ?
jv244:~$ ulimit -s 20000
jv244:~$ ifort -O1 mytest.f90
jv244:~$ a.out
Segmentation fault
jv244:~$ ulimit -s
20000
0 Kudos
Steven_L_Intel1
Employee
910 Views
Try ulimit -a to see what the limit really is. Worked for me with ulimit -s 8192.
0 Kudos
jv244
Beginner
910 Views
it really is 20000 :-)
jv244:~$ ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
file size (blocks, -f) unlimited
max locked memory (kbytes, -l) unlimited
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
stack size (kbytes, -s) 20000
cpu time (seconds, -t) 900
max user processes (-u) 7168
virtual memory (kbytes, -v) unlimited
0 Kudos
Steven_L_Intel1
Employee
910 Views
I see that I reported this to engineering a while ago, and they took it under consideration. I did run your program successfully using a current compiler.
0 Kudos
jv244
Beginner
910 Views
if this is of any use: the same happens after updating ifort to Build 20040716Z Package ID: l_fc_pc_8.0.046_pe050.1
0 Kudos
Reply