Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!apple!bionet!ames!sgi!shinobu!odin!everest.corp.sgi.com!mas From: mas@everest.corp.sgi.com (Michael A. Schulman) Newsgroups: comp.sys.sgi Subject: Re: f77 and -static option Message-ID: <1991Feb25.230134.2199@odin.corp.sgi.com> Date: 25 Feb 91 23:01:34 GMT References: <9102241616.AA25648@remote.dccs.upenn.edu> Sender: news@odin.corp.sgi.com (Net News) Reply-To: mas@sgi.com Organization: Silicon Graphics, Inc. Lines: 69 In article <9102241616.AA25648@remote.dccs.upenn.edu>, YATES@c.chem.upenn.edu ("YATES, JOHN H.") writes: |> |> I have a Fortran program that repeatedly builds and diagonalizes a 400x400 |> array using routines from a math library. I find that if I compile without |> the option -static, it core dumps (after about the 7th array, |> about 27 minutes of CPU time). If I build the whole code with |> |> f77 -g -static -o pa1 pa1.f pa2.f pa3.f |> |> It did not core dump. (roughly 2 hours of CPU time, about 29 400x400 arrays.) |> |> I learned about using -static by example from someones Makefile for a large |> Fortran code, and it is described in the f77 man page, which seems to leave |> it to folklore on when to use it or when it is necessary. |> |> My questions are, |> |> 1. should ALL Fortran Unix codes be compiled with the -static option? |> |> 2. When is it "safe" to not use it? |> |> 3. Are the unsafe -automatic Fortran constructs things like EQUIVALENCE, |> COMMON blocks, BLOCK DATA, ... and others? |> |> 4. Is it buggy Fortran code that requires -static to be used, or just normal |> Fortran coding practices? |> |> 5. What f77 options are generally regarded as "necessary" or "useful" in |> building large codes ported from non-Unix (e.g. VMS) systems. |> |> 6. Could this perhaps be an IRIX or f77 bug? |> |> Thanks, John |> yates@c.chem.upenn.edu -- You do not mention if the bug is in your program or in SGI fortran when you compare the two cases ( compiled with and without -static ). When porting codes to the SGI machine, it depends on your code whether you want to use -static. It is "safe" NOT to use it when the code is written such that local variables are initialized each entrance into the subroutine. Dont expect them to retain their value. It is probably buggy fortran in that you need -static. For large ( > 250,000 ) lines of code we use the following options: f77 -O -G 0 -static We use -static because of the large codes are "old" and expect certain behavior. -O because you could see up to 30 % performance improvement in certain cases. -G 0 because of the large number of variable placed in common blocks ( the loader will tell you if you need to use -G 0 ). Also of note, -Olimit. Michael Schulman Silicon Graphics Computer Systems 2011 N. Shoreline Blvd. Mountain View, CA 94039 415-962-3308 mas@sgi.com Brought to you by Super Global Mega Corp .com