Coder Social home page Coder Social logo

ahbarnett / floatingspeed Goto Github PK

View Code? Open in Web Editor NEW
6.0 6.0 5.0 355 KB

Floating-point/RAM benchmark in C vs C++ vs Fortran, including complex arithmetic

License: Other

C++ 98.42% Fortran 0.34% Shell 0.18% Julia 0.44% MATLAB 0.06% C 0.17% Python 0.19% Dockerfile 0.19%

floatingspeed's People

Contributors

ahbarnett avatar lu1and10 avatar magland avatar maltezfaria avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

floatingspeed's Issues

Compile errors on MacOS

Compilation for C-Type complex number code in for GCC 6.2 running on MacOS:

g++-6 utils.cpp -c
g++-6 complexmulttiming.cpp utils.o -o complexmulttimingc -Ofast -funroll-loops -D USE_C_TYPE_COMPLEX
complexmulttiming.cpp: In function 'int main(int, char**)':
complexmulttiming.cpp:115:5: error: 'complex' was not declared in this scope
complex double *z = (complex double *)malloc(sizeof(complex double)*M);
^~~~~~~
complexmulttiming.cpp:115:5: note: suggested alternative:
In file included from /usr/local/Cellar/gcc/6.2.0/include/c++/6.2.0/ccomplex:39:0,
from /usr/local/Cellar/gcc/6.2.0/include/c++/6.2.0/complex.h:32,
from complexmulttiming.cpp:4:
/usr/local/Cellar/gcc/6.2.0/include/c++/6.2.0/complex:63:32: note: 'std::complex'
template class complex;
^~~~~~~
complexmulttiming.cpp:116:13: error: expected ';' before 'double'
complex double *z2 = (complex double )malloc(sizeof(complex double)M);
^~~~~~
complexmulttiming.cpp:118:7: error: 'z' was not declared in this scope
z[i] = data1_re[i] + I
data1_im[i];
^
complexmulttiming.cpp:119:7: error: 'z2' was not declared in this scope
z2[i] = data2_re[i] + I
data2_im[i];
^~
complexmulttiming.cpp:123:7: error: 'z' was not declared in this scope
z[i] = z[i-1] + z[i] * z2[i];
^
complexmulttiming.cpp:123:30: error: 'z2' was not declared in this scope
z[i] = z[i-1] + z[i] * z2[i];
^~
complexmulttiming.cpp:126:89: error: 'z' was not declared in this scope
printf("%lld C-type complex mults in %.3g s\n\tresult = %.12f + %.12fI\n",M,t,creal(z[M-1]),cimag(z[M-1]));
^
complexmulttiming.cpp:127:19: error: 'z2' was not declared in this scope
free(z); free(z2);
^~

FYI: Here are some benchmarks on my laptop

This is not an issue, just a report for your info. Below is the result of running the run_all_tests.sh script 4 times on my laptop -- Dell Precision 7530.

(This excludes MATLAB)

(weirdly if I run fortran test on its own, rather than in the context of the script, I generally get higher rate - ranging between 1.7 and 2 Gpair/sec)

vscode@dc13b6d0654a:/workspaces/floatingspeed/lap3dkernel$ ./run_all_tests.sh 
C++SIMD:
5 repetitions each run...
N=10000, M=10000. manual VCL SIMD avx512, ans: 470638087.690212
                                time: 0.189 s           2.64 Gpair/sec
N=10000, M=10000. manual VCL SIMD avx2 (256), ans: 470638087.690212
                                time: 0.183 s           2.74 Gpair/sec
N=10000, M=10000. target outer loop, ans: 470638087.690212
                                time: 0.424 s           1.18 Gpair/sec
N=10000, M=10000. source outer loop, ans: 470638087.690212
                                time: 0.641 s           0.78 Gpair/sec
FORTRAN:
./run_all_tests.sh: line 10: gfortran: command not found
 ns=       10000    nt=       10000
 ntest =           20  ...
 tot=   7549471.0676897569     
   100000000 src-targ pairs in   1.26053715     s:   1.58662510     Gpair/s
JULIA:
targ-vec: 100000000 src-targ pairs in 1.96 s: 0.0511 Gpair/s
devec: 100000000 src-targ pairs in 0.28 s: 0.357 Gpair/s
devec par: 100000000 src-targ pairs in 0.0532 s: 1.88 Gpair/s
PYTHON:
native: 100000000 src-targ pairs in 2.04 s: 0.049 Gpair/s
numba:  100000000 src-targ pairs in 0.047 s: 2.13 Gpair/s
pot err numba vs native:  6.82e-13
MATLAB:
./run_all_tests.sh: line 22: matlab: command not found
OCTAVE:
octave: X11 DISPLAY environment variable not set
octave: disabling GUI features
test 1/r kernel in 3D. N=10000, M=10000...
targ-outer:     u(test)=-204.925905525712        t=1.58 s        0.0635 Gpair/s
src-outer:      u(test)=-204.925905525712        t=1.47 s        0.0681 Gpair/s
dense-matvec:   u(test)=-204.9259055257115       t=3.51 s        0.0285 Gpair/s




vscode@dc13b6d0654a:/workspaces/floatingspeed/lap3dkernel$ ./run_all_tests.sh 
C++SIMD:
5 repetitions each run...
N=10000, M=10000. manual VCL SIMD avx512, ans: 470638087.690212
                                time: 0.131 s           3.82 Gpair/sec
N=10000, M=10000. manual VCL SIMD avx2 (256), ans: 470638087.690212
                                time: 0.137 s           3.64 Gpair/sec
N=10000, M=10000. target outer loop, ans: 470638087.690212
                                time: 0.297 s           1.68 Gpair/sec
N=10000, M=10000. source outer loop, ans: 470638087.690212
                                time: 0.711 s           0.703 Gpair/sec
FORTRAN:
./run_all_tests.sh: line 10: gfortran: command not found
 ns=       10000    nt=       10000
 ntest =           20  ...
 tot=   7453247.5122789210     
   100000000 src-targ pairs in   1.23374486     s:   1.62108076     Gpair/s
JULIA:
targ-vec: 100000000 src-targ pairs in 1.97 s: 0.0507 Gpair/s
devec: 100000000 src-targ pairs in 0.258 s: 0.388 Gpair/s
devec par: 100000000 src-targ pairs in 0.0501 s: 2 Gpair/s
PYTHON:
native: 100000000 src-targ pairs in 1.97 s: 0.0508 Gpair/s
numba:  100000000 src-targ pairs in 0.0437 s: 2.29 Gpair/s
pot err numba vs native:  6.82e-13
MATLAB:
./run_all_tests.sh: line 22: matlab: command not found
OCTAVE:
octave: X11 DISPLAY environment variable not set
octave: disabling GUI features
test 1/r kernel in 3D. N=10000, M=10000...
targ-outer:     u(test)=-287.8825547996272       t=1.46 s        0.0683 Gpair/s
src-outer:      u(test)=-287.8825547996272       t=1.46 s        0.0687 Gpair/s
dense-matvec:   u(test)=-287.8825547996273       t=3.53 s        0.0283 Gpair/s




vscode@dc13b6d0654a:/workspaces/floatingspeed/lap3dkernel$ ./run_all_tests.sh 
C++SIMD:
5 repetitions each run...
N=10000, M=10000. manual VCL SIMD avx512, ans: 470638087.690212
                                time: 0.161 s           3.11 Gpair/sec
N=10000, M=10000. manual VCL SIMD avx2 (256), ans: 470638087.690212
                                time: 0.17 s            2.93 Gpair/sec
N=10000, M=10000. target outer loop, ans: 470638087.690212
                                time: 0.425 s           1.18 Gpair/sec
N=10000, M=10000. source outer loop, ans: 470638087.690212
                                time: 0.663 s           0.755 Gpair/sec
FORTRAN:
./run_all_tests.sh: line 10: gfortran: command not found
 ns=       10000    nt=       10000
 ntest =           20  ...
 tot=   7421530.2827616464     
   100000000 src-targ pairs in   1.27976596     s:   1.56278574     Gpair/s
JULIA:
targ-vec: 100000000 src-targ pairs in 1.93 s: 0.0519 Gpair/s
devec: 100000000 src-targ pairs in 0.264 s: 0.379 Gpair/s
devec par: 100000000 src-targ pairs in 0.0523 s: 1.91 Gpair/s
PYTHON:
native: 100000000 src-targ pairs in 1.96 s: 0.0511 Gpair/s
numba:  100000000 src-targ pairs in 0.0512 s: 1.95 Gpair/s
pot err numba vs native:  5.12e-13
MATLAB:
./run_all_tests.sh: line 22: matlab: command not found
OCTAVE:
octave: X11 DISPLAY environment variable not set
octave: disabling GUI features
test 1/r kernel in 3D. N=10000, M=10000...
targ-outer:     u(test)=-143.9898175208911       t=1.45 s        0.0688 Gpair/s
src-outer:      u(test)=-143.9898175208911       t=1.47 s        0.0679 Gpair/s
dense-matvec:   u(test)=-143.9898175208914       t=3.53 s        0.0283 Gpair/s



vscode@dc13b6d0654a:/workspaces/floatingspeed/lap3dkernel$ ./run_all_tests.sh 
C++SIMD:
5 repetitions each run...
N=10000, M=10000. manual VCL SIMD avx512, ans: 470638087.690212
                                time: 0.121 s           4.13 Gpair/sec
N=10000, M=10000. manual VCL SIMD avx2 (256), ans: 470638087.690212
                                time: 0.115 s           4.36 Gpair/sec
N=10000, M=10000. target outer loop, ans: 470638087.690212
                                time: 0.298 s           1.68 Gpair/sec
N=10000, M=10000. source outer loop, ans: 470638087.690212
                                time: 0.593 s           0.843 Gpair/sec
FORTRAN:
./run_all_tests.sh: line 10: gfortran: command not found
 ns=       10000    nt=       10000
 ntest =           20  ...
 tot=   7469534.6971662715     
   100000000 src-targ pairs in   1.24486721     s:   1.60659707     Gpair/s
JULIA:
targ-vec: 100000000 src-targ pairs in 1.96 s: 0.0511 Gpair/s
devec: 100000000 src-targ pairs in 0.259 s: 0.386 Gpair/s
devec par: 100000000 src-targ pairs in 0.0506 s: 1.98 Gpair/s
PYTHON:
native: 100000000 src-targ pairs in 1.98 s: 0.0504 Gpair/s
numba:  100000000 src-targ pairs in 0.0494 s: 2.02 Gpair/s
pot err numba vs native:  4.55e-13
MATLAB:
./run_all_tests.sh: line 22: matlab: command not found
OCTAVE:
octave: X11 DISPLAY environment variable not set
octave: disabling GUI features
test 1/r kernel in 3D. N=10000, M=10000...
targ-outer:     u(test)=120.4067525416816        t=1.43 s        0.0699 Gpair/s
src-outer:      u(test)=120.4067525416816        t=1.46 s        0.0687 Gpair/s
dense-matvec:   u(test)=120.4067525416806        t=3.55 s        0.0282 Gpair/s

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.