Subject: F77 compiler on R10000 SGI Indigo2: buggy?

From: "Robert Fraczkiewicz" <[email-masked]>
Date: Thu, 21 Nov 1996 14:28:44 -0600

Dear Netters,

Below is a short FORTRAN code that I wrote solely for the purpose of
testing the system subroutine DTIME in SGI IRIX 6.2. This subroutine
returns the elapsed CPU time since the last call to DTIME. I have
compiled it on SGI Indigo2 with R10000 processor using MIPSpro F77
compiler. I have used five different option sets listed below:

1) f77 silly.f -o silly        (this produces 32-bit mips2 code by default)
2) f77 -O2 silly.f -o silly
3) f77 -64 silly.f -o silly    (this produces 64-bit mips4 code)
4) f77 -64 -O2 silly.f -o silly
5) f77 -64 -O3 silly.f -o silly

The unusual results I have obtained are shown in table below. Apart
>from the fact that the 64-bit executables produce slightly different
result for x than their 32-bit counterparts, the CPU times in column
4) are larger by a factor of TEN in comparison to other columns!
Normally, I would expect them to be in between 3) and 5). This abnormal
result is reproducible for every SGI R10000 machine that we have here.
It seems that options -64 and -O2 don't get along very well. Is there
something I don't understand about MIPSpro F77 optimization options? Am I
missing something? Or is there a bug in the compiler?
Please, recompile this code on your R10000 (if you have it :-) to confirm
or deny this observation.

      program silly
      implicit double precision (a-h,o-z)
      real tarray(2)
      x=0.d0
      jmax=100
      call dtime(tarray)
      do imax=8000,10000,100
       do i=1,imax
        do j=1,jmax
         x=x+sqrt(float(i))*sin(float(j))
         y=acos(x/(i*abs(x)))
        enddo
       enddo
       call dtime(tarray)
       print *,imax,tarray(1)+tarray(2)
      enddo
      print *,x,y
      stop
      end

Results:
------------------------------------------------------------------------
       | CPU times (s) reported by DTIME for different compiler options|
  imax -----------------------------------------------------------------
       |     1)    |      2)    |      3)    |      4)    |      5)    |
------------------------------------------------------------------------
  8000 | 0.8353710 |  0.6551640 |  0.6200770 |   6.131035 |  0.1884840 |
  8100 | 0.8722960 |  0.6899580 |  0.6547980 |   6.208158 |  0.1924730 |
  8200 | 0.8814020 |  0.6967919 |  0.6354470 |   6.280854 |  0.1928640 |
  8300 | 0.8918310 |  0.6798510 |  0.6682850 |   6.354552 |  0.1953330 |
  8400 | 0.9021270 |  0.7131230 |  0.6759790 |   6.454478 |  0.1976650 |
  8500 | 0.9128000 |  0.7212590 |  0.6588350 |   6.503715 |  0.2249840 |
  8600 | 0.9232100 |  0.7044880 |  0.6914790 |   6.604474 |  0.2023520 |
  8700 | 0.9336550 |  0.7377620 |  0.6991270 |   6.682483 |  0.2047420 |
  8800 | 0.9442470 |  0.7459780 |  0.7070640 |   6.732563 |  0.2070200 |
  8900 | 0.9545040 |  0.7541710 |  0.6897570 |   6.828230 |  0.2343980 |
  9000 | 0.9649110 |  0.7372350 |  0.7226390 |   6.902500 |  0.2117620 |
  9100 | 0.9503450 |  0.7706130 |  0.7303350 |   6.977732 |  0.2140380 |
  9200 | 0.9860920 |  0.7787640 |  0.7130180 |   7.052145 |  0.2164480 |
  9300 | 0.9962510 |  0.7868320 |  0.7457520 |   7.127767 |  0.2188510 |
  9400 |  1.006923 |  0.7699320 |  0.7534280 |   7.226908 |  0.2460940 |
  9500 |  1.017477 |  0.8030970 |  0.7614270 |   7.281057 |  0.2234870 |
  9600 |  1.052756 |  0.8112460 |  0.7440030 |   7.351462 |  0.2258430 |
  9700 |  1.038267 |  0.8196840 |  0.7766720 |   7.452884 |  0.2281600 |
  9800 |  1.048346 |  0.8278640 |  0.7845440 |   7.500894 |  0.2555520 |
  9900 |  1.059044 |  0.8359420 |  0.7923810 |   7.600510 |  0.2328600 |
 10000 |  1.069380 |  0.8191160 |  0.7999970 |   7.650619 |  0.2352500 |
------------------------------------------------------------------------
   x   |   -1522838.034014487   |          -1522834.807409876          |
------------------------------------------------------------------------
   y   |    1.570896326795063   |           1.570896326795063          |
------------------------------------------------------------------------

Best regards,
Robert Fraczkiewicz
University of Texas Meedical Branch
Galveston, TX 77555

---

From: "Robert Fraczkiewicz" <[email-masked]>
Date: Thu, 21 Nov 1996 18:40:23 -0600

On Nov 21,  7:04pm, Omar G. Stradella wrote:
> Subject: Re: CCL:F77 compiler on R10000 SGI Indigo2: buggy?
> Hi Robert,
>
> That certainly doesn't look right. Did you run all the cases
> standalone ?. You are printing user+sys times, try to print
> both, are the sys times much higher than the user times ?

All cases were run in the same conditions. And they are always
reproducible. Below are the results with USER and SYSTEM times printed
separately:

3) f77 -64 silly.f -o silly

         imax    USER            SYSTEM
         8000  0.6193750      5.5300002E-04
         8100  0.6530520      2.4150000E-03
         8200  0.6353130      6.7899999E-04
         8300  0.6679210      6.9600000E-04
         8400  0.6755320      6.3899998E-04
         8500  0.6583500      6.4099999E-04
         8600  0.6910400      6.2499999E-04
         8700  0.6987190      5.9399998E-04
         (..............)

         8000   6.126564      4.4080000E-03
         8100   6.200925      6.2020002E-03
         8200   6.275659      4.4020000E-03
         8300   6.359073      5.8579999E-03
         8400   6.451895      4.6970001E-03
         8500   6.503077      5.1230001E-03
         8600   6.604784      5.6810002E-03
         8700   6.678527      5.6050001E-03
         (..............)

         8000  0.1880720      4.1099999E-04
         8100  0.1910070      1.9430000E-03
         8200  0.1929000      2.4500000E-04
         8300  0.1953550      3.0600000E-04
         8400  0.1976000      3.0900000E-04
         8500  0.2249180      3.1199999E-04
         8600  0.2022510      3.3700000E-04
         8700  0.2045990      3.0900000E-04
         (..............)

As you see, results for -64 -O2 are proportionally ten-fold slower in
both times :-(

> I've just ran your program on a "quiet" Indigo2 R10000/195MHz
> and this is what I got:
>
>        --------------------------------------------
>          imax |     3)    |      4)   |      5)   |
>        --------------------------------------------
>          8000 | 0.6389320 | 0.4704070 | 0.3378320
>          8100 | 0.6739330 | 0.4792880 | 0.3438850
>          8200 | 0.6547930 | 0.5068420 | 0.3709340
(..............)
>-- End of excerpt from Omar G. Stradella

That certainly looks strange... Seems like the problem is specific only
to our Indigo2's.. They all have been upgraded pretty recently to
R10000/195MHz. And I have installed quite a number of software patches.
Could it be a factor?

Could other CCL readers reproduce these results?

Robert Fraczkiewicz
University of Texas Medical Branch
Galveston, TX 77555

---

From: "Omar G. Stradella" <[email-masked]>
Date: Thu, 21 Nov 1996 19:04:19 -0500

Hi Robert,

       --------------------------------------------
         imax |     3)    |      4)   |      5)   |
       --------------------------------------------
         8000 | 0.6389320 | 0.4704070 | 0.3378320
         8100 | 0.6739330 | 0.4792880 | 0.3438850
         8200 | 0.6547930 | 0.5068420 | 0.3709340
         8300 | 0.6877040 | 0.4876800 | 0.3502160
         8400 | 0.6956780 | 0.5185640 | 0.3543930
         8500 | 0.7036650 | 0.4994340 | 0.3836350
         8600 | 0.6866900 | 0.5302930 | 0.3628220
         8700 | 0.7196610 | 0.5362660 | 0.3671010
         8800 | 0.7275980 | 0.5170740 | 0.3962870
         8900 | 0.7105780 | 0.5479479 | 0.3754910
         9000 | 0.7436190 | 0.5288640 | 0.4046990
         9100 | 0.7515450 | 0.5597370 | 0.3839000
         9200 | 0.7595540 | 0.5405610 | 0.3881170
         9300 | 0.7425210 | 0.5715650 | 0.4173290
         9400 | 0.7755310 | 0.5523360 | 0.3965220
         9500 | 0.7834170 | 0.5831710 | 0.4257890
         9600 | 0.7915200 | 0.5890040 | 0.4050190
         9700 | 0.7995780 | 0.5699100 | 0.4092260
         9800 | 0.7824590 | 0.6008570 | 0.4384830
         9900 | 0.8153910 | 0.5817030 | 0.4176470
        10000 | 0.8233650 | 0.6125400 | 0.4468400

As you said, -O2 should always be faster than -O0 (the default).
-O3 is usually faster than -O2, but not always it depends on the
code.

Omar.

On Nov 21,  2:28pm, Robert Fraczkiewicz wrote:
> Subject: CCL:F77 compiler on R10000 SGI Indigo2: buggy?
> Dear Netters,
>
> -------This is added Automatically by the Software--------
> -- Original Sender Envelope Address: [email-masked]
> -- Original Sender From: Address: [email-masked]
> [email-masked]: Everybody | [email-masked]: Coordinator
> [email-masked]: HELP CHEMISTRY or HELP SEARCH | Gopher: www.ccl.net 73
> Anon. ftp: www.ccl.net   | [email-masked] -- archive search
>              Web: http://www.ccl.net/chemistry.html
>-- End of excerpt from Robert Fraczkiewicz

-- 
+---------------------------------------------------------------------+
Omar G. Stradella, Ph.D.                    Supercomputing Applications 
Silicon Graphics, Inc.                          Computational Chemistry
One Cabot Road, Hudson, MA 01749, USA           N 42 22'41" W 71 33'45"
E-mail: [email-masked] Phone: +1-508-567-2258 FAX: +1-508-562-4755 
http://www.sgi.com/ChemBio                  http://reality.sgi.com/omar 
+--------  Ph-nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn  -------+