Benchmarks
guineau at wjg.enet.dec.com
guineau at wjg.enet.dec.com
Thu Aug 9 23:32:31 AEST 1990
In article <14425 at shlump.nac.dec.com>, I write:
> |> From: guineau at wjg.enet.dec.com
> |> Newsgroups: comp.unix.questions,sci.math,sci.math.num-analysis,comp.lang.c
> |> Subject: Re: Benchmarks
> |> Reply-To: guineau at wjg.enet.dec.com
>
> |> (I've mailed them to him, but for others...)
|> >
> |> Following is WHETS.FOR and following that is WHETS.C
Well, I kinda forgot to post the actual source.
Here it is:
WHETS.FOR
C-----------------------------------------------------------------------------
C
C Copy this if you like. I don't think it's the "Official" VAX
C CPU Whetstone benchmark, but is close. John
C
C WHETS.FOR 09/27/77 TDR
C ...WHICH IS AN IMPROVED VERSION OF
C WHET1A.FTN 01/22/75 RBG
C SINGLE-PRECISION VARIANT OF PROGRAM
C
C THIS PROGRAM IS THE
C "WHETSTONE INSTRUCTIONS PER SECONDS" MEASURE OF FORTRAN
C AND CPU PERFORMANCE.
C
C IT WAS DEVELOPED BY THE BRITISH CENTRAL COMPUTER AGENCY AND
C OBTAINED BY A ROUNDABOUT MEANS FROM A CUSTOMER WHO RECEIVED
C A LISTING OF THE SOURCE PROGRAM FROM DG MARKETING.
C
DIMENSION TIMES(3)
C
C COMMON WHICH REFERENCES LOGICAL UNIT ASSIGNMENTS
C
COMMON /LUNS/ ICRD,ILPT,IKBD,ITTY
C
COMMON T,T1,T2,E1(4),J,K,L
T=0.499975E00
T1=0.50025E00
T2=2.0E00
TYPE 1
ACCEPT 2,I
1 FORMAT(' TYPE LOOP COUNT (I4 FORMAT)'/)
2 FORMAT(I4)
C
C
C
C ***** BEGININNING OF TIMED INTERVAL *****
DO 200 ILOOP = 1,3
I = ILOOP*100
TIMES(ILOOP) = SECNDS(0.)
C ***** *****
C
ISAVE=I
N1=0
N2=12*I
N3=14*I
N4=345*I
N5=0
N6=210*I
N7=32*I
N8=899*I
N9=616*I
N10=0
N11=93*I
N12=0
X1=1.0E0
X2=-1.0E0
X3=-1.0E0
X4=-1.0E0
IF(N1)19,19,11
11 DO 18 I=1,N1,1
X1=(X1+X2+X3-X4)*T
X2=(X1+X2-X3+X4)*T
X4=(-X1+X2+X3+X4)*T
X3=(X1-X2+X3+X4)*T
18 CONTINUE
19 CONTINUE
CALL POUT(N1,N1,N1,X1,X2,X3,X4)
E1(1)=1.0E0
E1(2)=-1.0E0
E1(3)=-1.0E0
E1(4)=-1.0E0
IF(N2)29,29,21
21 DO 28 I=1,N2,1
E1(1)=(E1(1)+E1(2)+E1(3)-E1(4))*T
E1(2)=(E1(1)+E1(2)-E1(3)+E1(4))*T
E1(3)=(E1(1)-E1(2)+E1(3)+E1(4))*T
E1(4)=(-E1(1)+E1(2)+E1(3)+E1(4))*T
28 CONTINUE
29 CONTINUE
CALL POUT(N2,N3,N2,E1(1),E1(2),E1(3),E1(4))
IF(N3)39,39,31
31 DO 38 I=1,N3,1
38 CALL PA(E1)
39 CONTINUE
CALL POUT(N3,N2,N2,E1(1),E1(2),E1(3),E1(4))
J=1
IF(N4)49,49,41
41 DO 48 I=1,N4,1
IF(J-1)43,42,43
42 J=2
GOTO44
43 J=3
44 IF(J-2)46,46,45
45 J=0
GOTO47
46 J=1
47 IF(J-1)411,412,412
411 J=1
GOTO48
412 J=0
48 CONTINUE
49 CONTINUE
CALL POUT(N4,J,J,X1,X2,X3,X4)
J=1
K=2
L=3
IF(N6)69,69,61
61 DO 68 I=1,N6,1
J=J*(K-J)*(L-K)
K=L*K-(L-J)*K
L=(L-K)*(K+J)
E1(L-1)=J+K+L
E1(K-1)=J*K*L
68 CONTINUE
69 CONTINUE
CALL POUT(N6,J,K,E1(1),E1(2),E1(3),E1(4))
X=0.5E0
Y=0.5E0
IF(N7)79,79,71
71 DO 78 I=1,N7,1
X=T*ATAN(T2*SIN(X)*COS(X)/(COS(X+Y)+COS(X-Y)-1.0E0))
Y=T*ATAN(T2*SIN(Y)*COS(Y)/(COS(X+Y)+COS(X-Y)-1.0E0))
78 CONTINUE
79 CONTINUE
CALL POUT(N7,J,K,X,X,Y,Y)
X=1.0E0
Y=1.0E0
Z=1.0E0
IF(N8)89,89,81
81 DO 88 I=1,N8,1
88 CALL P3(X,Y,Z)
89 CONTINUE
CALL POUT(N8,J,K,X,Y,Z,Z)
J=1
K=2
L=3
E1(1)=1.0E0
E1(2)=2.0E0
E1(3)=3.0E0
IF(N9)99,99,91
91 DO 98 I=1,N9,1
98 CALL P0
99 CONTINUE
CALL POUT(N9,J,K,E1(1),E1(2),E1(3),E1(4))
J=2
K=3
IF(N10)109,109,101
101 DO 108 I=1,N10,1
J=J+K
K=J+K
J=J-K
K=K-J-J
108 CONTINUE
109 CONTINUE
CALL POUT(N10,J,K,X1,X2,X3,X4)
X=0.75E0
IF(N11)119,119,111
111 DO 118 I=1,N11,1
118 X=SQRT(EXP(ALOG(X)/T1))
119 CONTINUE
CALL POUT(N11,J,K,X,X,X,X)
C
C ***** END OF TIMED INTERVAL *****
200 TIMES(ILOOP)=SECNDS(TIMES(ILOOP))
C
C WHET. IPS = 1000/(TIME FOR 10 ITERATIONS OF PROGRAM)
WHETS = 10000./(TIMES(3)-TIMES(2))
TYPE 201,WHETS
201 FORMAT(' SPEED IS: ',F8.0,' THOUSAND WHETSTONE',
2 ' SINGLE PRECISION INSTRUCTIONS PER SECOND')
C ***** *****
C
STOP
END
SUBROUTINE PA(E)
COMMON T,T1,T2
DIMENSION E(4)
J=0
1 E(1)=(E(1)+E(2)+E(3)-E(4))*T
E(2)=(E(1)+E(2)-E(3)+E(4))*T
E(3)=(E(1)-E(2)+E(3)+E(4))*T
E(4)=(-E(1)+E(2)+E(3)+E(4))/T2
J=J+1
IF(J-6)1,2,2
2 CONTINUE
RETURN
END
SUBROUTINE P0
COMMON T,T1,T2,E1(4),J,K,L
E1(J)=E1(K)
E1(K)=E1(L)
E1(L)=E1(J)
RETURN
END
SUBROUTINE P3(X,Y,Z)
COMMON T,T1,T2
X1=X
Y1=Y
X1=T*(X1+Y1)
Y1=T*(X1+Y1)
Z=(X1+Y1)/T2
RETURN
END
SUBROUTINE POUT(N,J,K,X1,X2,X3,X4)
C
C WRITE STATEMENT COMMENTED OUT TO IMPROVE REPEATABILITY OF TIMINGS
C
C WRITE(2,1)N,J,K,X1,X2,X3,X4
1 FORMAT(1H,3I7,4E12.4)
RETURN
END
WHETS.C
#include <stdio.h>
#include <time.h>
/*
C <<< SQM::DISK$TSDPERF:[NOTES$LIBRARY]VMSTUNING.NOTE;1 >>>
C -< ** VMS Tuning Tricks ** >-
C =======================================================================
C Note 36.4 Whetstone Benchmark
C AURORA::HALLYB 210 lines 19-SEP-1985
C-----------------------------------------------------------------------------
C
C Copy this if you like. I don't think it's the "Official" VAX
C CPU Whetstone benchmark, but is close. John
C
C WHETS.FOR 09/27/77 TDR
C ...WHICH IS AN IMPROVED VERSION OF
C WHET1A.FTN 01/22/75 RBG
C SINGLE-PRECISION VARIANT OF PROGRAM
C
C THIS PROGRAM IS THE
C "WHETSTONE INSTRUCTIONS PER SECONDS" MEASURE OF FORTRAN
C AND CPU PERFORMANCE.
C
C IT WAS DEVELOPED BY THE BRITISH CENTRAL COMPUTER AGENCY AND
C OBTAINED BY A ROUNDABOUT MEANS FROM A CUSTOMER WHO RECEIVED
C A LISTING OF THE SOURCE PROGRAM FROM DG MARKETING.
C
DIMENSION TIMES(3)
C
C COMMON WHICH REFERENCES LOGICAL UNIT ASSIGNMENTS
C
*/
int ICRD,ILPT,IKBD,ITTYC;
int J,K,L;
double T,T1,T2,E1[5];
int N1,N2,N3,N4,N5,N6,N7,N8,N9,N10,N11,N12;
double X1,X2,X3,X4;
double X,Y,Z;
long TIMES[4],start,end;
main()
{
char buf[10];
int n,I,ILOOP,ISAVE;
T=0.499975E00;
T1=0.50025E00;
T2=2.0E00;
n=0;
while((n<1)||(n>3)) {
printf("Loop Count (1-3)?");
gets(buf);
n = atoi(buf);
};
/* ***** BEGININNING OF TIMED INTERVAL ***** */
for(ILOOP=1 ; ILOOP <= n ; ILOOP++) {
printf("LOOP: %d\n",ILOOP);
I = ILOOP*100;
time(&start);
ISAVE = I;
N1 = 10*I;
N2 = 12*I;
N3 = 14*I;
N4 = 345*I;
N5 = 0;
N6 = 210*I;
N7 = 32*I;
N8 = 899*I;
N9 = 616*I;
N10 = 0;
N11 = 93*I;
N12 = 0;
X1 = 1.0E0;
X2 = -1.0E0;
X3 = -1.0E0;
X4 = -1.0E0;
printf(" N1...\n");
if(N1>0.0)
for(I=1 ; I<N1 ; I++) {
X1=(X1+X2+X3-X4)*T;
X2=(X1+X2-X3+X4)*T;
X4=(-X1+X2+X3+X4)*T;
X3=(X1-X2+X3+X4)*T;
};
E1[1] = 1.0E0;
E1[2] = -1.0E0;
E1[3] = -1.0E0;
E1[4] = -1.0E0;
printf(" N2...\n");
if(N2>0.0)
for(I=1 ; I<N2 ; I++) {
E1[1]=(E1[1]+E1[2]+E1[3]-E1[4])*T;
E1[2]=(E1[1]+E1[2]-E1[3]+E1[4])*T;
E1[3]=(E1[1]-E1[2]+E1[3]+E1[4])*T;
E1[4]=(-E1[1]+E1[2]+E1[3]+E1[4])*T;
};
printf(" N3...\n");
if(N3>0.0)
for(I=1 ; I<N3 ; I++)
PA();
J=1;
printf(" N4...\n");
if(N4>0.0) {
for(I=1 ; I<N4 ; I++) {
if((J-1) == 0)
J=2;
else
J=3;
if((J-2)>0)
J=0;
else
J=1;
if((J-1)<0)
J=1;
else
J=0;
};
};
printf(" N5...\n");
J=1;
K=2;
L=3;
printf(" N6...\n");
if(N6>0.0)
for(I=1 ; I<N6 ; I++) {
J=J*(K-J)*(L-K);
K=L*K-(L-J)*K;
L=(L-K)*(K+J);
E1[L-1]=J+K+L;
E1[K-1]=J*K*L;
};
X = 0.5E0;
Y = 0.5E0;
printf(" N7...\n");
if(N7>0.0)
for(I=1 ; I<N7 ; I++) {
X=T * atan(T2 * sin(X) * cos(X) / (cos(X+Y)+cos(X-Y)-1.0E0));
Y=T * atan(T2 * sin(Y) * cos(Y) / (cos(X+Y)+cos(X-Y)-1.0E0));
};
X = 1.0E0;
Y = 1.0E0;
Z = 1.0E0;
printf(" N8...\n");
if(N8>0.0)
for(I=1 ; I<N8 ; I++)
P3(X,Y,Z);
J = 1;
K = 2;
L = 3;
E1[1] = 1.0E0;
E1[2] = 2.0E0;
E1[3] = 3.0E0;
printf(" N9...\n");
if(N9>0.0)
for(I=1 ; I<N9 ; I++)
P0();
J = 2;
K = 3;
printf(" N10...\n");
if(N10>0.0)
for(I=1 ; I<N10 ; I++) {
J=J+K;
K=J+K;
J=J-K;
K=K-J-J;
};
X=0.75E0;
printf(" N11...\n");
if(N11>0.0)
for(I=1 ; I<N11 ; I++)
X=sqrt(exp(log(X)/T1));
/* ***** END OF TIMED INTERVAL ***** */
time(&end);
TIMES[ILOOP-1] = end-start;
printf("Time = %d seconds\n",TIMES[ILOOP-1]);
};
/* WHET. IPS = 1000/(TIME FOR 10 ITERATIONS OF PROGRAM) */
/* WHETS = 10000./(TIMES(3)-TIMES(2)) */
}
PA()
{
int J;
for(J=1 ; J<7 ; J++) {
E1[1]=(E1[1]+E1[2]+E1[3]-E1[4])*T;
E1[2]=(E1[1]+E1[2]-E1[3]+E1[4])*T;
E1[3]=(E1[1]-E1[2]+E1[3]+E1[4])*T;
E1[4]=(-E1[1]+E1[2]+E1[3]+E1[4])/T2;
};
return(0);
}
P0()
{
E1[J]=E1[K];
E1[K]=E1[L];
E1[L]=E1[J];
return(0);
}
P3(X,Y,Z)
double X,Y,Z;
{
double X1,Y1;
X1=X;
Y1=Y;
X1=T*(X1+Y1);
Y1=T*(X1+Y1);
Z=(X1+Y1)/T2;
return(0);
}
--
W. John Guineau guineau at wjg.enet.dec.com
Digital Equipment Corporation
Marlboro MA. 01752
More information about the Comp.unix.questions
mailing list