ahbarnett / floatingspeed Goto Github PK
View Code? Open in Web Editor NEWFloating-point/RAM benchmark in C vs C++ vs Fortran, including complex arithmetic
License: Other
Floating-point/RAM benchmark in C vs C++ vs Fortran, including complex arithmetic
License: Other
Using random_number instead of rand() improves portability.
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] + Idata1_im[i];
^
complexmulttiming.cpp:119:7: error: 'z2' was not declared in this scope
z2[i] = data2_re[i] + Idata2_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);
^~
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
I suggest adding the topic benchmark
in the About section at https://github.com/ahbarnett/floatingspeed
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.