4.3.2. Modifying the Test/Benchmark Test Sizes - 5.2 English - 57404

AOCL User Guide (57404)

Document ID
57404
Release Date
2025-12-29
Version
5.2 English

The AOCL-BLAS source has an API specific test driver and this section explains how to use it for a specific set of matrix sizes.

The source file for GEMM benchmark is test/test_gemm.c and the executable is test/test_gemm_blis.x.

Complete the following steps to execute the GEMM tests on specific input parameters:

Enabling File Input

By default, file input/output is disabled. Instead, start, end, and step sizes are used. To enable the file input, complete the following steps:

  1. Open the file test/test_gemm.c.

  2. Uncomment the macro at the start of the file:

    #define FILE_IN_OUT
    

Building Test Driver

Execute the following commands to build the test driver:

$ cd tests
$ make -j blis

Creating an Input File

The input file accepts matrix sizes and strides in the following format. Each dimension is separated by a space and each entry is separated by a new line.

For example, m k n lda ldb ldc. Where:

  • Matrix A is of size m x k

  • Matrix B is of size k x n

  • Matrix C is of size m x n

  • lda is leading dimension of matrix A

  • ldb is leading dimension of matrix B

  • ldc is leading dimension of matrix C

This test application (test_gemm.c) assumes column-major storage of matrices.

The valid values of lda, ldb, and ldc for a GEMM operation C = beta*C + alpha* A * B, are as follows:

  • lda >= m

  • ldb >= k

  • ldc >= m

Running the Tests

Execute the following commands to run the tests:

$ cd tests
$ ./test_gemm_blis.x <input file name> <output file name>

An execution sample (with the test driver) for GEMM is as follows:

$ cat inputs.txt
200 100 100 200 200 200
10  4   1   100 100 100
4000 4000 400 4000 4000 4000
$ ./test_gemm_blis.x inputs.txt outputs.txt
_BLAS          m    k    n   cs_a cs_b cs_c gflops
data_gemm_blis 200  100  100 200  200  200  27.211
data_gemm_blis 10   4    1   100  100  100  0.027
data_gemm_blis 4000 4000 400 4000 4000 4000 45.279
$ cat outputs.txt
m    k    n    cs_a  cs_b cs_c  gflops
200  100  100  200   200  200   27.211
10   4    1    100   100  100   0.027
4000 4000 400  4000  4000 4000  45.279