Simple Benchmark

Here are the results of a simple benchmark program (shown below) that I have run on a number of computers over time. It's a lousy program--for one thing, it's floating-point intensive, and I don't find floating point performance very interesting. Unfortunately, I can't go back in time with a better benchmark.


Machine             OS and Compiler                 Seconds

Pentium III-866     Win2000 MS C 12.00.8804 cl /Ox      0.218
Gateway G6-P180     NT MS C 11.00.7022 cl /Ox           0.991
Apex Pentium 133    NT MS C 11.00.7022 cl /Ox           1.331
SGI Challenge/L     cc -O3                              1.78
CYBER 2000          NOS/VE 1.8.3; Fortran scalar        1.889
IBM RS/6000-560:    AIX 3.2.3? xlc -O                   2.640
IBM RS/6000-560:    AIX 3.2.3? f77 -O                   3.160
IBM RS/6000-350     AIX 3.2.5 cc -O                     3.60
IBM 3090-180        VM/SP HPO 4.2 opt(3)                5.8   
Compaq ProLi 486/66 NT MS C 11.00.7022 cl /Ox           6.819
VAXstation 4000-60  FORTRAN /OPT                        7.1
Gateway 4DX2-66/V   NT MS For Powerstation 1.0          9.06
AMD64 3200+ DtCyber NOS 2.8.1 FTN OPT=2                 9.698
Sun ELC             f77 -cg89 -O4 pi.f                 12.3
Sun ELC             gcc -O4                            13.6
VAX 8650            VMS 4.5       /opt/check=none      16.5 
CDC 750             Hustler       opt=3                18.0
Gateway 4DX2-66V    NT; DOS For 5.1 fl /AL/FPi87/Ox    20.0
IBM 4381-1          VM/SP R. 4.0  opt(3)               46.5 
MicroVAX II         VMS 4.5       (default)           106.5  
CDC 810             NOS/VE 1.2.1  opt=high            109.8
Sun 3/50            Unix          -O -f68881          140.2 
Please note that the Desktop Cyber software emulator ran faster, on a modern PC, than the original Cyber 750!

FORTRAN Source

Here is the original source to the benchmark program. It was written in FORTRAN because that was the language available on most of the machines I was testing at the time.

      PROGRAM RANPI

c   Program to compute PI by probability.
c   By Mark Riordan  24-DEC-1986; 
c   Original version apparently by Don Shull.
c   To be used as a CPU benchmark.

      write(*,*) 'Starting PI...'      
      ztot = 0.0
      low = 1
      ixran = 1907
      yran = 5813.0
      ymult = 1307.0
      ymod = 5471.0
      itot = 1200000
      DO 100 j=1,itot

c   X and Y are two uniform random numbers between 0 and 1.
c   They are computed using two linear congruential generators.
c   A mix of integer and real arithmetic is used to simulate a
c   real program.  Magnitudes are kept small to prevent 32-bit
c   integer overflow and to allow full precision even with a 23-bit
c   mantissa.

        iprod = 27611 * ixran
        ixran = iprod - 74383*(iprod/74383)
        x = float(ixran) / 74383.0
        prod = ymult * yran
        yran = (prod - ymod*int(prod/ymod))
        y = yran / ymod
        Z = X*x + Y*y
        call myadd(ztot,z)
        IF ( Z .LE. 1.0 ) THEN
          low = low + 1
        ENDIF
100   continue
      write(*,9000) x,y,low,j
9000  format(' x=',f8.5,' y=',f8.5,' low=',i7,' j=',i7)
      Pi = 4.0 * float(low)/float(Itot)
      write(*,*) 'Pi = ',pi,' ztot = ',ztot,' itot = ',itot
      STOP
      END
      subroutine myadd(sum,addend)

c   Simple adding subroutine thrown in to allow subroutine
c   calls/returns to be factored in as part of the benchmark.

      sum = sum + addend
      return
      end

C Source

Here's the same program, hand-translated to C. Most of the more recent machines were run with this version.


/*--- pi.c       PROGRAM RANPI
 *
 *   Program to compute PI by probability.
 *   By Mark Riordan  24-DEC-1986; 
 *   Original version apparently by Don Shull.
 *   To be used as a CPU benchmark.
 *  
 *  Translated to C from FORTRAN 20 Nov 1993
 */
#include <stdio.h>

void
myadd(float *sum,float *addend);

int
main(int argc, char *argv[]) {
   float ztot, yran, ymult, ymod, x, y, z, pi, prod;
   long int low, ixran, itot, j, iprod;

      printf("Starting PI...\n");
      ztot = 0.0;
      low = 1;
      ixran = 1907;
      yran = 5813.0;
      ymult = 1307.0;
      ymod = 5471.0;
      itot = 1200000;

      for(j=1; j<=itot; j++) {

/*
c   X and Y are two uniform random numbers between 0 and 1.
c   They are computed using two linear congruential generators.
c   A mix of integer and real arithmetic is used to simulate a
c   real program.  Magnitudes are kept small to prevent 32-bit
c   integer overflow and to allow full precision even with a 23-bit
c   mantissa.
*/

        iprod = 27611 * ixran;
        ixran = iprod - 74383*(long int)(iprod/74383);
        x = (float)ixran / 74383.0;
        prod = ymult * yran;
        yran = (prod - ymod*(long int)(prod/ymod));
        y = yran / ymod;
        z = x*x + y*y;
        myadd(&ztot,&z);
        if ( z <= 1.0 ) {
          low = low + 1;
        }
      }
      printf(" x=%8.5f y=%8.5f low=%7d j=%7d\n",x,y,low,j);
      pi = 4.0 * (float)low/(float)itot;
      printf("Pi = %9.6f ztot=%12.2f itot=%8d\n",pi,ztot,itot);

      return 0;
}

void
myadd(float *sum,float *addend) {

/*
c   Simple adding subroutine thrown in to allow subroutine
c   calls/returns to be factored in as part of the benchmark.
*/
      *sum = *sum + *addend;
}