- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have Compaq Visual FORTRAN Standard Edition 6.1.0 and I'm having stack overflow problems when passing large allocatable pointer arrays into a subroutine as CALL statement arguments:
Early on:
TYPE ZONE_TYPE
REAL, POINTER :: U(:,:,:)
END TYPE ZONE_TYPE
TYPE(ZONE_TYPE), POINTER :: zone
later on:
ALLOCATE(zone%U(0:zone%IMAX,0:zone%JMAX,0:zone%KMAX))
zone%U(0:zone%IMAX,0:zone%JMAX,0:zone%KMAX) = 0
later on:
READ(70) (((zone%U(I,J,K),I=1,zone%IMAX),J=1,zone%JMAX),K=1,zone%KMAX)
But when:
CALL QINTERPOLCART(zone%U)
I get a stack overflow during the CALL statement, but only when zone%U is large (e.g., zone%U(40,150,40)), but not when zone%U is smaller (e.g., zone%U(20,40,40)).
I noticed there is talk on the message board regarding the problem of stack overflows with large arrays being passed thru to subroutines, and I (not being a full-blown computer scientist) was wondering if this is indeed the problem I'm having. Is there a way to fix this, without rewriting my code. My UNIX machine (with a totally different FORTRAN 90 compiler) runs the program with no problem, but I want to be able to use my (faster) PC. I used EDITBIN, and got around the problem - I think - but the program ran notoriously slow compared to the UNIX, i.e., literally a 1000 times slower, although my PC is a lot faster with every other program I've done head-to-head comparisons with. Depending on how much memory I give FORTRAN using EDITBIN, the program either stops with a stack overflow problem or it runs notoriously slow. Is there a middle ground somewhere - where the program has enough memory but doesn't use more than it needs? I tried various memory allocations for 4+ hours, but still couldn't come up with a happy medium. Does Compaq Visual FORTRAN Standard Edition 6.1 indeed have problems handling large pointer/allocatable arrays as SUBROUTINE CALL arguments and will buying the new version of Compaq FORTRAN Standard Edition Version 6.6 fix the problem or do I have a bigger problem at hand? Also, I've got a Pentium 4 Xeon processor machine with 2 Gigabytes of RAM, is there a way to make sure I'm using all the memory and speed my computer has to offer?
Thanks!!!!!!!!!
Early on:
TYPE ZONE_TYPE
REAL, POINTER :: U(:,:,:)
END TYPE ZONE_TYPE
TYPE(ZONE_TYPE), POINTER :: zone
later on:
ALLOCATE(zone%U(0:zone%IMAX,0:zone%JMAX,0:zone%KMAX))
zone%U(0:zone%IMAX,0:zone%JMAX,0:zone%KMAX) = 0
later on:
READ(70) (((zone%U(I,J,K),I=1,zone%IMAX),J=1,zone%JMAX),K=1,zone%KMAX)
But when:
CALL QINTERPOLCART(zone%U)
I get a stack overflow during the CALL statement, but only when zone%U is large (e.g., zone%U(40,150,40)), but not when zone%U is smaller (e.g., zone%U(20,40,40)).
I noticed there is talk on the message board regarding the problem of stack overflows with large arrays being passed thru to subroutines, and I (not being a full-blown computer scientist) was wondering if this is indeed the problem I'm having. Is there a way to fix this, without rewriting my code. My UNIX machine (with a totally different FORTRAN 90 compiler) runs the program with no problem, but I want to be able to use my (faster) PC. I used EDITBIN, and got around the problem - I think - but the program ran notoriously slow compared to the UNIX, i.e., literally a 1000 times slower, although my PC is a lot faster with every other program I've done head-to-head comparisons with. Depending on how much memory I give FORTRAN using EDITBIN, the program either stops with a stack overflow problem or it runs notoriously slow. Is there a middle ground somewhere - where the program has enough memory but doesn't use more than it needs? I tried various memory allocations for 4+ hours, but still couldn't come up with a happy medium. Does Compaq Visual FORTRAN Standard Edition 6.1 indeed have problems handling large pointer/allocatable arrays as SUBROUTINE CALL arguments and will buying the new version of Compaq FORTRAN Standard Edition Version 6.6 fix the problem or do I have a bigger problem at hand? Also, I've got a Pentium 4 Xeon processor machine with 2 Gigabytes of RAM, is there a way to make sure I'm using all the memory and speed my computer has to offer?
Thanks!!!!!!!!!
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The stack overflow is most probably the consequence of large temporary array copy, which compiler does for you when it's unable to pass an array just by reference or by descriptor. If you pass just zone%U to QINTERPOLCART (no dimensions), you should also provide that:
- It is dimensioned in QINTERPOLCART as (:, :, :)
- Explicit interface of QINTERPOLCART is visible in the caller (either via INTERFACE block or, better, put QINTERPOLCART in a MODULE and USE it).
Jugoslav
- It is dimensioned in QINTERPOLCART as (:, :, :)
- Explicit interface of QINTERPOLCART is visible in the caller (either via INTERFACE block or, better, put QINTERPOLCART in a MODULE and USE it).
Jugoslav

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