HP Forums

Full Version: Benchmark: Whetstones
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have attempted an implementation of the original Whetstone benchmark algorithm in PPL.

This was primarily a learning exercise to remind myself what the benchmark consisted of and to discover whether it was implementable in PPL.

Disclaimer: The implementation is unverified both in accuracy and timings.

If comparing accuracy of results with on-line sources, remember that there are several Whetstone benchmarks, so you might not be making a valid comparison.
Version 0.1 is a simple translation of the Original Algol benchmark.
No attempt has been made to optimise the PPL.
The figures here are not intended to be representative of what the PPL can achieve.


 LOCAL ID:="Whetstones V0.1 (UNVERIFIED)\nPPL StephenG1CMZ 2017";

 //Requires a procedure to output a list of reals
 //(to list,print or logfile)
 //IMPORT(OUTREAL);//See Benchmarks for example

  MSGBOX(" Aims to approximate the workload of Whetstone & verify that the algorithm is implementable in PPL.");
  MSGBOX("Neither accuracy nor timing is approved.");
  MSGBOX("The unoptimised version makes no attempt to improve loops.");


 LOCAL UnitST:="Mwhetstone";


 LOCAL TT:=0.499975;
 LOCAL T1:=0.50025;
 LOCAL T2:=2.0;

 LOCAL E1:={};//4
 LOCAL NK:={0,12,14,345,0,210,32,899,616,0,93};//11 ITERATION CONSTANTS



  LOCAL JJ:=0;
   EE(1):=( EE(1) + EE(2) + EE(3) - EE(4))*TT;
   EE(2):=( EE(1) + EE(2) - EE(3) + EE(4))*TT; 
   EE(3):=( EE(1) - EE(2) + EE(3) + EE(4))*TT;
   EE(4):=(−EE(1) + EE(2) + EE(3) + EE(4))*TT; 

 //Unoptimised:No PPL optimisation
   X4:=−1.0; X3:=X4; X2:=X3;
    X1:=( X1 + X2 + X3 - X4)*TT;
    X2:=( X1 + X2 - X3 + X4)*TT;
    X3:=( X1 - X2 + X3 + X4)*TT;
    X4:=(−X1 + X2 + X3 + X4)*TT;
   E1(4):=−1.0; E1(3):=E1(4); E1(2):=E1(3);
    E1(1):=( E1(1) + E1(2) + E1(3) - E1(4))*TT;
    E1(2):=( E1(1) + E1(2) - E1(3) + E1(4))*TT;
    E1(3):=( E1(1) - E1(2) + E1(3) + E1(4))*TT;
    E1(4):=(−E1(1) + E1(2) + E1(3) + E1(4))*TT; 
    IF JJ==1 THEN
    IF JJ>2 THEN
    IF JJ<1 THEN









  //END MODULE 11 




 EXPORT WhetstoneIt(ITER)
  RETURN WhetstoneItUnopt(ITER);

 EXPORT MegaWhetstone()

 EXPORT MegaWhetstones(Mwhetstones)

 EXPORT MWhetstone_s ()
  LOCAL TM:=TEVAL(MegaWhetstone);

  LOCAL TM:=MWhetstone_s();

  TM:=TM/1_s;//Remove Units
  //0s=>clock err or more Whetstones needed
  MWIPS:=IFTE(TM,ROUND((1/TM),6),"NaN");//Guard 0 Time

The Whetstone benchmark relies upon an OUTREAL function.

This was originally provided in my Benchmarks program, but that complicated compilation.

I have now extracted OUTREAL here.
The example code here emphasis flexibility (allowing reals to be printed, listed, or both).
Before publishing timings a much simpler OUTREAL should be substituted

 EXPORT BenchmarkList:=1;
 EXPORT BenchmarkAns:={};

  IF BenchmarkList THEN

Reference URL's