[comp.sys.sgi] FORTRAN program optimisation

LEONARDZ@UOGUELPH.BITNET ("Len Zaifman UoGuelph 824-4120 xt 6566", 519) (08/25/89)

     I need help on two issues.

     1 . I am trying to compile some fortran code with optimisation. At O2 ,
        several routines ( this program has several hundred  ) hit the error
       not optimised beacuase global tables are not large enough, use
        Olimit > nnn where nnn is some number larger than 500. The question
        is , does it hurt the performance of the program , or the program
        size to compile  with Olimit nnn,where nnn is greater than the largest
        reported size required, for all the routines , whether they need the
        space or not ?? The program is large enough as it is , and I am trying
        to enhance its runtime execution speed as much as possible.
             To that end I would also like someone from SGI to comment on the
        advisability of using O3. I was told that at the moment this level of
        optimisation is unsafe. Is that true , and what performance enhancement
        is expected over O2 optimisation ?? Also, for a very large program such
        as this what are the recommended analysis tools on IRIX to help
        optimise the performance(hopefully without source code changes ). I am
        looking for tools which help restructure the binary(loaded) code to
        enhance performance.

       2. On the user interface side , I see a need for easier command recall
          than using !nnn to recall a command. Recently I worked on an Apollo
          where command recall and editting was available through mouse
          highlighting, cutting and pasting (ie like a mac). Can this be done
          in IRIX now (3.1 x level)? will it be available at 3.2 ?? In
          Workspace ??

                Thanks


                                                          Regards,
                                                          Len Zaifman

calvin@dinkum.wpd.sgi.com (Calvin H. Vu) (08/26/89)

In article <89Aug25.093608edt.57688@ugw.utcs.utoronto.ca>, LEONARDZ@UOGUELPH.BITNET ("Len Zaifman  UoGuelph 824-4120 xt 6566", 519) writes:
> 
>      1 . I am trying to compile some fortran code with optimisation. At O2 ,
>         several routines ( this program has several hundred  ) hit the error
>        not optimised beacuase global tables are not large enough, use
>         Olimit > nnn where nnn is some number larger than 500. The question
>         is , does it hurt the performance of the program , or the program
>         size to compile  with Olimit nnn,where nnn is greater than the largest
>         reported size required, for all the routines , whether they need the
>         space or not ?? The program is large enough as it is , and I am trying
>         to enhance its runtime execution speed as much as possible.
	The number specified in the -Olimit option is used to set up the
	internal table inside the optimizer.   It will not adversely effect the 
	runtime speed nor the size of your program (other than the fact that
	your program will be smaller and run faster if optimized).   The only
	bad effect is that the bigger the number, the more memory space will
	be used by the optimizer, and your program may take longer to compile.

>       To that end I would also like someone from SGI to comment on the
>     advisability of using O3. I was told that at the moment this level of
>     optimisation is unsafe. Is that true , and what performance enhancement
>     is expected over O2 optimisation ?? 
	The reason we don't recommend -O3 level is because it fails some of
	our internal QA tests.   It provides about 10% improvement over -O2
	level, depending on your application.

>     Also, for a very large program such
>     as this what are the recommended analysis tools on IRIX to help
>     optimise the performance(hopefully without source code changes ). I am
>     looking for tools which help restructure the binary(loaded) code to
>     enhance performance.
> 
	Sorry we don't have any tools that can do optimization on loaded
	binary code.
	You can use 'prof' and 'pixie' to figure out all the places in your
	program that may need to be changed for faster execution.

>    2. On the user interface side , I see a need for easier command recall
>       than using !nnn to recall a command. Recently I worked on an Apollo
>       where command recall and editting was available through mouse
>       highlighting, cutting and pasting (ie like a mac). Can this be done
>       in IRIX now (3.1 x level)? will it be available at 3.2 ?? In
>       Workspace ??
> 
	We have cut & paste in 3.2.
>                                                           Regards,
>                                                           Len Zaifman

davea@quasar.wpd.sgi.com (David B. Anderson) (08/26/89)

In article <41004@sgi.sgi.com> calvin@dinkum.wpd.sgi.com (Calvin H. Vu) writes:
>In article <89Aug25.093608edt.57688@ugw.utcs.utoronto.ca>, LEONARDZ@UOGUELPH.BITNET ("Len Zaifman  UoGuelph 824-4120 xt 6566", 519) writes:
[stuff deleted]
>>     Also, for a very large program such
>>     as this what are the recommended analysis tools on IRIX to help
>>     optimise the performance(hopefully without source code changes ). I am
>>     looking for tools which help restructure the binary(loaded) code to
>>     enhance performance.
>> 
>	Sorry we don't have any tools that can do optimization on loaded
>	binary code.
[stuff deleted]

Calvin is quite correct about release 3.1.  However for 3.2 we support
cord(1), which restructures a binary.   When you get 3.2 see the cord(1),
ftoc(1), prof(1), pixie(1), and cc(1) man pages for further information.

[ David B. Anderson  Silicon Graphics  (415)964-1459x3060  davea@sgi.com ]

khb@road.Sun.COM (Keith Bierman - Advanced Languages - Floating Point Group ) (08/26/89)

In article <89Aug25.093608edt.57688@ugw.utcs.utoronto.ca> LEONARDZ@UOGUELPH.BITNET ("Len Zaifman  UoGuelph 824-4120 xt 6566", 519) writes:
>
>     I need help on two issues.
>
>     1 . I am trying to compile some fortran code with optimisation. At O2 ,
>        several routines ( this program has several hundred  ) hit
         .... stuff about table sizes

It should be easy enough to try the experiment of compiling a few
modules with and without the larger tables. I've never noticed a
significant difference, but not working for SGI, I can't promise you
that. 

>             To that end I would also like someone from SGI to comment on the
>        advisability of using O3. I was told that at the moment this level of
>        optimisation is unsafe. Is that true , and what performance

Mileage varies a lot for all higher level optimizers. I strongly
suggest you profile your code, and turn the optimizer on high on just
the top routines (probably 5 or 10). Optimizers can pessimize code, so
pay attention to the profiles as you go. I expect that you have both
prof and gprof. prof is less intrusive. For really reducing the
intrusiveness (at the cost of lower information content) turn on
profiling ONLY on the "link" line, viz.

	f77 -O  your.f -c
	f77 your.o -p

Asking how much benefit O<n> gives over <n-1> is typically silly ...
most of the time doesn't matter ... just what goes on in 10% of your
code. 

>
>       2. On the user interface side , I see a need for easier command recall

At the very least ksh should be available (if only via the ATT
toolchest source program, or via bash from RMS). I haven't played
around with the SGI machines enough to comment of the cut and paste
(sunview, and openlook allow it).


Keith H. Bierman    |*My thoughts are my own. !! kbierman@sun.com
It's Not My Fault   |	MTS --Only my work belongs to Sun* 
I Voted for Bill &  | Advanced Languages/Floating Point Group            
Opus                | "When the going gets Weird .. the Weird turn PRO"

ijlustig@phoenix.Princeton.EDU (Irvin Lustig) (08/28/89)

Regarding -O3 level optimization, I have a large Fortran source code
that works under -O2, but fails miserably under -O3.  Who knows what
triggers the failure.

	-Irv Lustig
	Assistant Professor
	Dept. of Civil Engineering and Operations Research
	Princeton University
	irv%basie@princeton.edu