Ye olde LINPACK
One of the oldest CPU benchmarks is the venerable LINPACK. This was originally written in the ’70s and is a collection of taxing Fortran programs for performing linear algebra – operations on vectors and matrices. This was written to test the supercomputers of the era, and it has now been mostly superseded by LAPACK, which makes better use of native vector operations and other voodoo in modern architectures. Nonetheless, LINPACK still remains vaguely relevant since a great deal of supercomputer time today is still spent inverting matrices. It’s not really a standard any more, there are several different versions you can get from www.netlib.org/benchmark. Netlib is a repository of mathematically themed papers and programs and well worth investigating if you’re of a scientific programming bent. The most modern LINPACK implementation is the one called hpl (High Performance LINPACK) on Netlib. It’s the one still used for the TOP-500 supercomputer listing, but it requires extra support libraries. Here’s how to compile a simpler C-based LINPACK and measure how many FLoating point Operations per Second (FLOPS) your machine can manage. $ wget http://www.netlib.org/benchmark/ linpackc.new -O linpack.c $ gcc linpack.c -o linpack -lm
Using the default 200x200 array, our humble machine managed around 700MFLOPS. However, gcc is a clever creature, and using some extra compiler optimisations, for example: $ gcc linpack.c -o linpack -lm -O3 -march=native and rerunning the benchmark saw this leap to around 4.5GFLOPS.
There are many other optimisations one can pass to gcc such as -ffast-math (which might also be wrong-math in certain situations), and Gentoo users like them so much that they devote hours to compiling every package on their system with them.