ergo
mmul_rectangular_test.cc File Reference

Tests and measures timings for matrix-matrix multiplication using BLAS and compares to a naive implementation, for rectangular matrices. More...

#include <cstdio>
#include <cstdlib>
#include <vector>
#include "realtype.h"
#include "utilities.h"
#include "mat_gblas.h"

Functions

static void fill_matrix_with_random_numbers (int n, int m, std::vector< ergo_real > &A)
 
static void do_naive_mmul (std::vector< ergo_real > &C, const std::vector< ergo_real > &A, const std::vector< ergo_real > &B, int n, int m, int p)
 
static void verify_mmul_result (const std::vector< ergo_real > &A, const std::vector< ergo_real > &B, const std::vector< ergo_real > &C, int n, int m, int p)
 
ergo_real compare_matrices (const std::vector< ergo_real > &A, const std::vector< ergo_real > &B, int n, int m)
 
int main (int argc, char *argv[])
 

Detailed Description

Tests and measures timings for matrix-matrix multiplication using BLAS and compares to a naive implementation, for rectangular matrices.

The idea is to run this linking to different BLAS variants with and without threading inside the BLAS gemm routine, to see how much speedup can be achieved from threading.

Function Documentation

◆ compare_matrices()

ergo_real compare_matrices ( const std::vector< ergo_real > &  A,
const std::vector< ergo_real > &  B,
int  n,
int  m 
)

References A, B, and template_blas_fabs().

Referenced by main().

◆ do_naive_mmul()

static void do_naive_mmul ( std::vector< ergo_real > &  C,
const std::vector< ergo_real > &  A,
const std::vector< ergo_real > &  B,
int  n,
int  m,
int  p 
)
static

References A, and B.

Referenced by main().

◆ fill_matrix_with_random_numbers()

static void fill_matrix_with_random_numbers ( int  n,
int  m,
std::vector< ergo_real > &  A 
)
static

References A.

Referenced by main().

◆ main()

◆ verify_mmul_result()

static void verify_mmul_result ( const std::vector< ergo_real > &  A,
const std::vector< ergo_real > &  B,
const std::vector< ergo_real > &  C,
int  n,
int  m,
int  p 
)
static

References A, B, and template_blas_fabs().

Referenced by main().