# MATMUL A Matrix Multiplication Benchmark

MATMUL is a FORTRAN77 program which compares various methods for computing the matrix product

```
A * B = C.
```

MATMUL can do this for a variety of matrix sizes, and for different arithmetics (real, complex, double precision, integer, even logical!) There are many algorithms built in, including the simple triple DO loop (actually not so simple; there are 6 ways to set it up), some unrolling techniques, and the level 1 and 2 BLAS routines.

MATMUL is interactive, so the user can easily pursue any line of inquiry that seems promising. New algorithms or locally available methods are not to hard to add.

### Languages:

MATMUL is available in a C version and a FORTRAN77 version and a FORTRAN90 version.

### Related Data and Programs:

LINPACK_BENCH, a FORTRAN77 program which measures the time needed to factor and solve a linear system.

MDBNCH, a FORTRAN77 program which is a benchmark code for a molecular dynamics calculation.

MEMORY_TEST, a FORTRAN90 program 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 FORTRAN77 program 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.

NAS, a FORTRAN77 program which runs the NASA kernel benchmark.

SUM_MILLION, a FORTRAN77 program which sums the integers from 1 to 1,000,000, as a demonstration of how to rate a computer's speed;

TIMER, a FORTRAN77 program which demonstrates how to compute CPU time or elapsed time.

### Reference:

1. John Burkardt, Paul Puglielli,
Pittsburgh Supercomputing Center,
MATMUL: An Interactive Matrix Multiplication Benchmark

### Source Code:

• matmul.f, the source code;
• matmul.sh, commands to compile and load the source code;

### List of Routines:

• MAIN is the main program for MATMUL.
• C_CAP capitalizes a single character.
• CHRCHP "chops out" a portion of a string, and closes up the hole.
• CHRCTI reads an integer from a string.
• CHRDB1 removes blanks from a string, left justifying the remainder.
• CIJK computes A = B*C using index order IJK and complex arithmetic.
• CSET initializes the complex A, B and C matrices.
• DIGTEN returns the integer value of a base 10 digit.
• DIJK multiplies A = B*C using index order IJK and double precision.
• DOMETHOD calls a specific multiplication routine.
• DSET initializes the double precision A, B and C matrices.
• GETN determines the problem sizes desired by the user.
• GET_ORDER reads a new value of order from the user.
• GETSHO determines what items the user wishes to print out.
• HELLO says hello to the user, printing the version, machine, and so on.
• HELP prints a list of the available commands.
• IJK multiplies A = B*C using index order IJK.
• IJUK multiplies A = B*C using index order IJK and unrolling.
• IKJ multiplies A = B*C using index order IKJ.
• INIT initializes data.
• ISET initializes the integer A, B and C matrices.
• IUJK multiplies A = B*C using index order IJK, and unrolling on J.
• JIK multiplies A = B*C using index order JIK.
• JKI multiplies A = B*C using index order JKI.
• KIJ multiplies A = B*C using index order KIJ.
• KJI multiplies A = B*C using index order KJI.
• LIJK "multiplies" A = B*C using index order IJK, using logical data.
• LSET initializes the logical A, B and C matrices.
• MIJK multiplies A = B*C using index order IJK.
• MKJI multiplies A = B*C using index order KJI and multitasking.
• MULT carries out the matrix multiplication, using the requested method.
• NIJK multiplies A = B*C using index order IJK, using integer arithmetic.
• NIJK46 multiplies A = B*C using index order IJK, and integer arithmetic.
• NSTEP is used when a set of values of N is being generated.
• PRINTR prints out those parameters the user wants to see.
• REPORT reports the results for each multiplication experiment.
• RSET initializes the real A, B and C matrices.
• S_CAP replaces any lowercase letters by uppercase ones in a string.
• S_EQI is a case insensitive comparison of two strings for equality.
• S_LENGTH returns the length of a string up to the last nonblank.
• MATMUL_CPU_TIMER computes total CPU seconds.
• MATMUL_REAL_TIMER returns a reading of the real time clock.
• SIJK multiplies A = B*C using index order IJK, and no Cray vectorization.
• TAXPY is unoptimized standard BLAS routine SAXPY.
• TDOT computes the inner product of two vectors.
• TERBLA is the source code for the BLAS error handler.
• TGEMM is a source code copy of SGEMM, a BLAS matrix * matrix routine.
• TGEMVF is a source code copy of BLAS SGEMVF, a matrix * vector routine.
• TLSAME is a source code copy of BLAS LSAME, testing character equality.
• UIJK multiplies A = B*C using index order IJK and I unrolling to depth 4.
• UMXMA multiplies A = B*C using optimized MXMA.
• USAXPYC multiplies A = B*C columnwise, using optimized SAXPY.
• USAXPYR multiplies A = B*C "rowwise", using optimized SAXPY.
• USDOT multiplies A = B*C using optimized SDOT.
• USGEMM multiplies A = B*C using optimized SGEMM.
• USGEMMS multiplies A = B*C using optimized SGEMMS.
• UTAXPYC multiplies A = B*C columnwise, using unoptimized SAXPY.
• UTAXPYR multiplies A = B*C rowwise using source code SAXPY.
• UTDOT multiplies A = B * C using source code SDOT.
• UTGEMM multiplies A = B*C using SGEMM.

You can go up one level to the FORTRAN77 source codes.

Last revised on 23 March 2008.