replica nfl jerseysreplica nfl jerseyssoccer jerseyreplica nfl jerseys forums.silverfrost.com :: View topic - using /stack command in ftn95
forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

using /stack command in ftn95

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
georisk



Joined: 16 Mar 2011
Posts: 2

PostPosted: Thu Apr 14, 2011 2:02 pm    Post subject: using /stack command in ftn95 Reply with quote

I am a recent upgrade to 64 bit and ftn95

I used to compile code requiring large arrays using:

ftn77/stack 9999999 myprog.for -link

Code still compiles on old laptop.

If I try the same using ftn95 on new 64 bit machine it says I need to use /clr option. But when I use this it gives a lot of warnings (no errors) and won't compile.

Any ideas appreciated.
Back to top
View user's profile Send private message
JohnCampbell



Joined: 16 Feb 2006
Posts: 2615
Location: Sydney

PostPosted: Fri Apr 15, 2011 7:45 am    Post subject: Reply with quote

I think /clr invokes .net which is probably not what you want.

You have two main options.

1) Change the program to remove local big ARRAYS from the stack, puting them in common/modules.

For large global arrays, this can be done by moving large arrays to a COMMON or MODULE
( this is easy as you just list the large arrays in a named common as
COMMON /BIG_STACK/ array_1, array_2

or if they are temporary arrays in a subroutine, allocating them with ALLOCATE, rather than being just local arrays.

Example
! declare with
real*8, allocatable, dimension( :,: ) :: big_array ! if this is identified as a large local array
!
! early in the executable code : the dimensions can be variables
ALLOCATE (BIG_ARRAY(4000,5000))
!
! to be neat, at the ned
DEALLOCATE (BIG_ARRAY)

Typically you should have few arrays to implement this change.
The memory limit for FTN95 is about 1.6gb. If the program is old chances are it is nowhere near this. However if you are changing the size in anticipation of 64bit, that may explain the problem

2) change the way you compile and link
compile with >ftn95 myprog.for
link with >slink myprog.obj -stack:9999999

I have never had any success with /stack or -stack and would recommend analysing your program to remove large local arrays from the stack.
Also, avoid /ZERO or /SAVE if you can, as this increases the stack use.

You may be reluctant to change your F77 code, but the changes should not be significant, as you are only telling the compiler where to use memory.

John

Ps. I omitted ",allocatable" from the declaration.
Back to top
View user's profile Send private message
georisk



Joined: 16 Mar 2011
Posts: 2

PostPosted: Sun Apr 17, 2011 10:04 am    Post subject: Reply with quote

John

Thought I try the easy option #2 first. It worked a treat. Thanks for your help.

Program was 3500 lines of F77 code that I have used for many years and has been tested and known to work. Always hesitant to change code when I know it works.

Once again thanks for your help.

Andrew
Very Happy Smile
Back to top
View user's profile Send private message
JohnCampbell



Joined: 16 Feb 2006
Posts: 2615
Location: Sydney

PostPosted: Tue Apr 19, 2011 12:45 am    Post subject: Reply with quote

Andrew,

I would recommend that you investigate if you have large local arrays. Option /xref will list all variables and their size. You can import the list into excel and then calculate the size of all arrays, sorting to identify any possible targets.
Typically they are in the main program, where it is easy to group them into a common or a module, with little risk of changeing the program.
If they are in a subroutine or function, you should consider if they require /save or /zeroise to run; both of which approaches are non standard and not recommended. These arrays can be easily made as ALLOCATE or possibly included as a subroutine argument to better manage temporary variables from the main program.

I'm surprised that this occurs in F77 code, as memory was at a premium back then.

John
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group