Matrix-Matrix Multiplication Timings
is a C program which
sets up a matrix-matrix multiplication problem A = B * C,
and carries it out using
Nested FOR I, J, K loops;
Nested FOR I, K, J loops;
Nested FOR J, I, K loops;
Nested FOR J, K, I loops;
Nested FOR K, I, J loops;
Nested FOR K, J, I loops;
the MATMUL FORTRAN90 intrinsic function;
The user is allowed to specify N1, N2, and N3, which define
the matrix sizes.
mxm n1 n2 n3
n1 is the number of rows in B.
n2 is the number of columns in B and rows in C.
n3 is the number of columns in C;
The computer code and data files described and made available on this web page
are distributed under
the GNU LGPL license.
MXM is available in
a C version and
a C++ version and
a FORTRAN77 version and
a FORTRAN90 version and
a MATLAB version.
Related Data and Programs:
a C++ program which
measures the time needed to factor and solve a "large" (N=1000)
dense linear system of equations, and is used as a benchmark.
a C program which
compares the performance of (DO I, FOR J) loops, (DO J, FOR I ) loops,
and MATMUL for computing the product of an MxN matrix A and an N vector X.
a C program which
sums the integers from 1 to 1,000,000, as a demonstration of how
to rate a computer's speed;
C programs which
demonstrate how to compute CPU time or elapsed time.
John Burkardt, Paul Puglielli,
Pittsburgh Supercomputing Center,
MATMUL: An Interactive Matrix Multiplication Benchmark
mxm.c, the source code.
commands to compile and link the source code.
List of Routines:
MAIN is the main program for MXM.
CPU_TIME reports the elapsed CPU time.
MATGEN generates a random matrix.
MXM_IJK computes A = B * C using FOR I, FOR J, FOR K loops.
MXM_IKJ computes A = B * C using FOR I, FOR K, FOR J loops.
MXM_JIK computes A = B * C using FOR J, FOR I, FOR K loops.
MXM_JKI computes A = B * C using FOR J, FOR K, FOR I loops.
MXM_KIJ computes A = B * C using FOR K, FOR I, FOR J loops.
MXM_KJI computes A = B * C using FOR K, FOR J, FOR I loops.
TIMESTAMP prints the current YMDHMS date as a time stamp.
You can go up one level to
the C source codes.
Last revised on 09 October 2010.