N-body bench

bearophile bearophileHUGS at lycos.com
Thu Jan 30 14:32:53 PST 2014


Stanislav Blinov:

> An aging i3?

My CPU is older, it doesn't support AVX2 and AVX.


> This is getting a bit silly now. I must have some compile 
> switches for g++ wrong:
>
> g++ -Ofast -fkeep-inline-functions -fomit-frame-pointer 
> -march=native -mfpmath=sse -mavx -mssse3 -flto --std=c++11 
> -fopenmp nbody.cpp -o nbody-cpp
>
> time ./nbody-cpp 50000000:
> -0.169075164
> -0.169059907
> 0:05.09 real, 5.07 user, 0.00 sys, 1140 kb, 99% cpu
>
> ldc2 -release -O3 -disable-boundscheck -vectorize 
> -vectorize-loops -ofnbody-ldc -mattr=+avx,+ssse3 nbody.d
>
> time ./nbody-ldc 50000000:
> -0.169075164
> -0.169059907
> 0:04.02 real, 4.01 user, 0.00 sys, 1304 kb, 99% cpu

Now the ldc2-compile runs in 4 seconds, this sounds correct. If 
you have paid for a CPU with AVX2 or AVX, it's right to use that 
:-)

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list