Recent

Author Topic: Scimark  (Read 9967 times)

Fiji

  • Guest
Scimark
« on: May 07, 2014, 08:28:34 pm »
Hello!

How to port this Delphi benchmark to FPC?  :-[

https://code.google.com/p/scimark-delphi/source/browse/

Or does a port already exist?

Much appreciated.

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: Scimark
« Reply #1 on: May 07, 2014, 08:47:53 pm »
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1260
Re: Scimark
« Reply #2 on: May 08, 2014, 02:14:28 am »
Someone has
http://www.codenewsfast.com/cnf/article/0/permalink.art-ng1914q164833

I suspect the conversion is easy enough using the links provided by Taazz...
Lazarus Trunk/FPC Trunk on Windows [7, 10]
  Have you tried searching this forum or the wiki?:   http://wiki.lazarus.freepascal.org/Alternative_Main_Page
  BOOKS! (Free and otherwise): http://wiki.lazarus.freepascal.org/Pascal_and_Lazarus_Books_and_Magazines

airpas

  • Full Member
  • ***
  • Posts: 179
Re: Scimark
« Reply #3 on: May 08, 2014, 10:45:45 am »
this is the conversion . i used lazarus built-in converter

airpas

  • Full Member
  • ***
  • Posts: 179
Re: Scimark
« Reply #4 on: May 08, 2014, 10:55:58 am »
the result on my pc (intel g2020)

------------- Delphi -------------
Composite Score MFlops:   511.14
FFT             Mflops:   314.05    (N=1024)
SOR             Mflops:   857.57    (100 x 100)
MonteCarlo:     Mflops:   152.26
Sparse matmult  Mflops:   398.27    (N=1000, nz=5000)
LU              Mflops:   833.54    (M=100, N=100)


---------------FPC 2.7.1 -----------------
Composite Score MFlops:   530.84
FFT             Mflops:   283.71    (N=1024)
SOR             Mflops:   845.90    (100 x 100)
MonteCarlo:     Mflops:   157.86
Sparse matmult  Mflops:   595.78    (N=1000, nz=5000)
LU              Mflops:   770.94    (M=100, N=100)

DelphiFreak

  • Sr. Member
  • ****
  • Posts: 255
    • Fresh sound.
Re: Scimark
« Reply #5 on: May 08, 2014, 11:10:33 am »
Could you give some more info about which Delphi Version you used?
Thanks.
Linux Mint 20.3, Lazarus 2.3, Windows 10, Delphi 10.3 Rio, Delphi 11.1 Alexandria

DelphiFreak

  • Sr. Member
  • ****
  • Posts: 255
    • Fresh sound.
Re: Scimark
« Reply #6 on: May 08, 2014, 11:18:31 am »
I ran it on my machine and got a "negative" Value on the "Sparse mathunit". See screenshot.

Linux Mint 20.3, Lazarus 2.3, Windows 10, Delphi 10.3 Rio, Delphi 11.1 Alexandria

airpas

  • Full Member
  • ***
  • Posts: 179
Re: Scimark
« Reply #7 on: May 08, 2014, 11:19:53 am »
i just download the binary from  https://code.google.com/p/scimark-delphi/downloads/list .

i recompile it now with my delphi XE6  :

-------- delphi xe6 --------

Composite Score MFlops:   475.76
FFT                      Mflops:    225.41    (N=1024)
SOR                     Mflops:    656.99    (100 x 100)
MonteCarlo:        Mflops:    143.40
Sparse matmult  Mflops:     265.97    (N=1000, nz=5000)
LU                       Mflops:     1087.05  (M=100, N=100)


hinst

  • Sr. Member
  • ****
  • Posts: 303
Re: Scimark
« Reply #8 on: May 08, 2014, 11:20:29 am »
@DelphiFreak It is a time machine!  >:D
Too late to escape fate

Fiji

  • Guest
Re: Scimark
« Reply #9 on: May 08, 2014, 01:44:00 pm »
Tested on Intel Q6600;

Delphi XE5 32        
Mininum running time = 2.00 seconds
Composite Score MFlops:   371.66
FFT             Mflops:   234.88    (N=1024)
SOR             Mflops:   381.27    (100 x 100)
MonteCarlo:     Mflops:    75.13
Sparse matmult  Mflops:   245.73    (N=1000, nz=5000)
LU              Mflops:   921.28    (M=100, N=100)

Delphi XE6 32                      
Mininum running time = 2.00 seconds
Composite Score MFlops:   276.99
FFT             Mflops:   100.52    (N=1024)
SOR             Mflops:   437.94    (100 x 100)
MonteCarlo:     Mflops:    70.83
Sparse matmult  Mflops:   145.89    (N=1000, nz=5000)
LU              Mflops:   629.77    (M=100, N=100)
 
FPC Trunk 32 
Mininum running time = 2.00 seconds
Composite Score MFlops:   554.52
FFT             Mflops:   334.85    (N=1024)
SOR             Mflops:   718.31    (100 x 100)
MonteCarlo:     Mflops:    77.85
Sparse matmult  Mflops:   567.76    (N=1000, nz=5000)
LU              Mflops:  1073.81    (M=100, N=100)
 
Delphi XE6 64
Mininum running time = 2.00 seconds
Composite Score MFlops:   314.11
FFT             Mflops:   426.67    (N=1024)
SOR             Mflops:   450.86    (100 x 100)
MonteCarlo:     Mflops:   111.02
Sparse matmult  Mflops:  -485.50    (N=1000, nz=5000) // ???
LU              Mflops:  1067.50    (M=100, N=100)

FPC Trunk 64
Mininum running time = 2.00 seconds
Composite Score MFlops:   618.65
FFT             Mflops:   414.02    (N=1024)
SOR             Mflops:   722.52    (100 x 100)
MonteCarlo:     Mflops:   111.78
Sparse matmult  Mflops:   770.70    (N=1000, nz=5000)
LU              Mflops:  1074.22    (M=100, N=100)
 

FPC smokes Delphi..
« Last Edit: May 08, 2014, 02:06:30 pm by Fiji »

DelphiFreak

  • Sr. Member
  • ****
  • Posts: 255
    • Fresh sound.
Re: Scimark
« Reply #10 on: May 08, 2014, 02:23:48 pm »
Before there is no clarification why we get some "Negative" values I think we should not trust this numbers.
Linux Mint 20.3, Lazarus 2.3, Windows 10, Delphi 10.3 Rio, Delphi 11.1 Alexandria

DelphiFreak

  • Sr. Member
  • ****
  • Posts: 255
    • Fresh sound.
Re: Scimark
« Reply #11 on: May 10, 2014, 09:41:29 am »
I have changed (in unit SparseCompRow)

Code: [Select]
function SparseCompRow_num_flops(N, nz, num_iterations: integer): integer;
to

Code: [Select]
function SparseCompRow_num_flops(N, nz, num_iterations: integer):cardinal;
and the problem with negative MFlops is gone.


Lazarus 1.2.2  directory FPC 2.6.4 i386-linux-gtk 2

original code
*************
Composite Score MFlops:   490.03
FFT             Mflops:   250.03    (N=1024)
SOR             Mflops:   836.35    (100 x 100)
MonteCarlo:     Mflops:   170.81
Sparse matmult  Mflops:   610.20    (N=1000, nz=5000)
LU              Mflops:   582.73    (M=100, N=100)

my little optimization in procedure SparseCompRow_matmult ( remove the un-needed local vars rowR, rowRp1: integer; )
Composite Score MFlops:   520.78
FFT             Mflops:   262.21    (N=1024)
SOR             Mflops:   847.01    (100 x 100)
MonteCarlo:     Mflops:   171.58
Sparse matmult  Mflops:   738.64    (N=1000, nz=5000)
LU              Mflops:   584.47    (M=100, N=100)
Linux Mint 20.3, Lazarus 2.3, Windows 10, Delphi 10.3 Rio, Delphi 11.1 Alexandria

airpas

  • Full Member
  • ***
  • Posts: 179
Re: Scimark
« Reply #12 on: May 10, 2014, 10:59:08 am »
seems fpc and delphi produce the same results . while the c ( tested with tdm-gcc 4.7.1)  is faster x3 , thats due to huge floating point calculations ,  gcc is known by a good vectorization , unlike pascal 

DelphiFreak

  • Sr. Member
  • ****
  • Posts: 255
    • Fresh sound.
Re: Scimark
« Reply #13 on: June 28, 2014, 03:57:30 pm »
Hi Forum,

I had a closer look at FFT, since the FFT benchmark had the biggest difference to the other languages.

Original Delphi code
FFT             Mflops:   248.11    (N=1024)
Code: [Select]
        z1_real := Data[j];
        z1_imag := Data[j + 1];

        wd_real := w_real * z1_real - w_imag * z1_imag;
        wd_imag := w_real * z1_imag + w_imag * z1_real;   

My modified code ( remove of local variable z1_real and z1_imag )
FFT             Mflops:   355.39    (N=1024)
Code: [Select]
        wd_real := w_real * Data[j] - w_imag * Data[j + 1];
        wd_imag := w_real * Data[j + 1] + w_imag * Data[j];

Original c-sourcecode
Code: [Select]
      for (a = 1; a < dual; a++) {
        /* trignometric recurrence for w-> exp(i theta) w */
        {
          double tmp_real = w_real - s * w_imag - s2 * w_real;
          double tmp_imag = w_imag + s * w_real - s2 * w_imag;
          w_real = tmp_real;
          w_imag = tmp_imag;
        }
        for (b = 0; b < n; b += 2 * dual) {
          int i = 2*(b + a);
          int j = 2*(b + a + dual);
          double z1_real = data[j];
          double z1_imag = data[j+1];
          double wd_real = w_real * z1_real - w_imag * z1_imag;
          double wd_imag = w_real * z1_imag + w_imag * z1_real;
          data[j]   = data[i]   - wd_real;
          data[j+1] = data[i+1] - wd_imag;
          data[i]  += wd_real;
          data[i+1]+= wd_imag;
        }

Conclusion:
Translating c- sourcecode to Delphi/Lazarus must be done very carefully.
The "features" like just declaring new variables somewhere inside a method or this stupid thing of having variables in upper/lowercase is a real pain when translating sources.

e.g. this: N and n is not the same !

Code: [Select]
static void FFT_transform_internal (int N, double *data, int direction) {
    int n = N/2;
    int bit = 0;
    int logn;
    int dual = 1;

    if (n == 1) return;         /* Identity operation! */
    logn = int_log2(n);


    if (N == 0) return;



Linux Mint 20.3, Lazarus 2.3, Windows 10, Delphi 10.3 Rio, Delphi 11.1 Alexandria

 

TinyPortal © 2005-2018