linpack_bench, a C code which carries out the LINPACK benchmark program.
The LINPACK benchmark is a test problem used to rate the performance of a computer on a simple linear algebra problem.
The test problem requires the user to set up a random dense matrix A of size N = 1000, and a right hand side vector B which is the product of A and a vector X of all 1's. The first task is to compute an LU factorization of A. The second task is to use the LU factorization to solve the linear system
A * X = B.
The number of floating point operations required for these two tasks is roughly
ops = 2 * N*N*N / 3 + 2 * N * N,therefore, the "MegaFLOPS" rating, or millions of floating point operations per second, can be found as
mflops = ops / ( cpu * 1000000 ).
The C source code presented here is unusual in that a single file embodies both single and double precision. The precision to be used is specified at compile time with a compiler option. Moreover, another compiler option allows the user to request "rolled loops" (the normal kind of for loop), or "unrolled loops", in which the loops are done with an increment greater than 1. The unrolled option can often significantly improve performance.
On a given computer, if you run the benchmark for a sequence of increasing values of N, the behavior of the MegaFLOPS rating will vary as you pass through three main zones of behavior:
Language | Precision | Type | Machine | Comment | MegaFLOPS |
---|---|---|---|---|---|
C | Single | Real | DHCP95 (Apple G5) | rolled | 108 |
C | Single | Real | DHCP95 (Apple G5) | unrolled | 184 |
C | Double | Real | DHCP95 (Apple G5) | rolled | 111 |
C | Double | Real | DHCP95 (Apple G5) | unrolled | 190 |
The computer code and data files described and made available on this web page are distributed under the MIT license
linpack_bench is available in a C version and a C++ version and a FORTRAN90 version and a MATLAB version.
LINPACK, a C code which supplies the solvers used by LINPACK_BENCH.
MATMUL, a C code which is an interactive matrix multiplication benchmark program.
MEMORY_TEST, a C code which declares and uses a sequence of larger and larger vectors, to see how big a vector can be used on a given machine and compiler.
MXM, a C code which sets up a matrix multiplication problem A=B*C of arbitrary size, and compares the time required for IJK, IKJ, JIK, JKI, KIJ and KJI orderings of the loops.
TIMER, a C example which demonstrates how to measure CPU time or elapsed time.