linbox
Functions
benchmark-fgemm.C File Reference

Benchmarking dense matrix multiplication on finite fields. More...

#include "benchmarks/benchmark.h"
#include "linbox/util/error.h"
#include "fflas-ffpack/fflas-ffpack.h"
#include "linbox/field/modular.h"
#include "linbox/field/modular-balanced.h"
#include "linbox/matrix/random-matrix.h"
#include "linbox/matrix/blas-matrix.h"
#include "linbox/algorithms/blas-domain.h"
#include <iomanip>

Functions

bool keepon (index_t &repet, const Timer &tim, double maxtime=0.2)
 Watches a timer and a number and repet and signals if over.
 
bool whatchon (index_t &repet, Timer &tim, double maxtime=0.5)
 Watches a timer and a number and repet and signals if over.
 
void bench_blas (index_t min, index_t max, int step, int charac)
 Benchmark fgemm Y=AX for several sizes of sqare matrices.
 
void bench_square (index_t min, index_t max, int step, int charac)
 Benchmark square fgemm Y=AX for several fields.
 
void bench_rectangular (index_t k, int charac, index_t l=2)
 Benchmark fgemm Y=AX for several shapes.
 
void bench_scalar (index_t k, int charac, bool inplace)
 Benchmark fgemm $D\gets\alpha A B+\beta C$ for general $\alpha,\beta$.
 
void bench_transpose (index_t k, int charac, bool inplace)
 Benchmark fgemm $D\gets\alpha A^x B^y+\beta C$ for $x,y=1,\top$ (transpose or not).
 
int main (int ac, char **av)
 

Detailed Description

Benchmarking dense matrix multiplication on finite fields.

This file benchmarks the FFLAS::fgemm implementation for various fields, shape and parameters. Actually, we use the wrapper member mul of LinBox::BlasMatrixDomain.

Todo:
make graphs look better (legends, units,...)

Function Documentation

bool keepon ( index_t &  repet,
const Timer &  tim,
double  maxtime = 0.2 
)

Watches a timer and a number and repet and signals if over.

We want at least 2 repetions but not more than maxtime spent on timing.

Parameters
repetnumber of previous repetitions. Should be 0 on the first time whatchon is called.
timtimer to watch
maxtimemaximum time (in seconds) until keepon tells stop.
Returns
true if we conditions are not met to stop, false otherwise.
Precondition
tim was clear at the beginning and never started.
bool whatchon ( index_t &  repet,
Timer &  tim,
double  maxtime = 0.5 
)

Watches a timer and a number and repet and signals if over.

We want at least 2 repetions but not more than maxtime spent on timing.

Parameters
repetnumber of previous repetitions. Should be 0 on the first time whatchon is called.
timtimer to watch
maxtimemaximum time (in seconds) until watchon tells stop.
Returns
true if we conditions are not met to stop, false otherwise.
Precondition
tim should have been started previously !
void bench_blas ( index_t  min,
index_t  max,
int  step,
int  charac 
)

Benchmark fgemm Y=AX for several sizes of sqare matrices.

Parameters
minmin size
maxmax size
stepstep of the size between 2 benchmarks
characcharacteristic of the field.
void bench_square ( index_t  min,
index_t  max,
int  step,
int  charac 
)

Benchmark square fgemm Y=AX for several fields.

Parameters
minmin size
maxmax size
stepstep of the size between 2 benchmarks
characcharacteristic of the field.
void bench_rectangular ( index_t  k,
int  charac,
index_t  l = 2 
)

Benchmark fgemm Y=AX for several shapes.

Let n=k^2. we test the following shapes :

  • (l,nk,nk), (nk,l,nk), (nk,nk,l) : like vector-product
  • (kl,nk,n), (nk,kl,n),(nk,n,kl) : one small rectangular matrix
  • (kl,n,nk), (n,kl,nk),(n,nk,kl) : same
  • (nl,n,n),(n,nl,n),(n,n,nl) : square (or close to)
Parameters
kparameter.
characcharacteristic of the field.
lsmall parameter (ie close to 1)
Todo:
resize if it>nb !!
void bench_scalar ( index_t  k,
int  charac,
bool  inplace 
)

Benchmark fgemm $D\gets\alpha A B+\beta C$ for general $\alpha,\beta$.

Parameters
kparameter.
characcharacteristic of the field.
inplace"inplace" matmul (ie. C=D is overwritten)
void bench_transpose ( index_t  k,
int  charac,
bool  inplace 
)

Benchmark fgemm $D\gets\alpha A^x B^y+\beta C$ for $x,y=1,\top$ (transpose or not).

Parameters
kparameter.
characcharacteristic of the field.
inplace"inplace" matmul (ie. C=D is overwritten)
int main ( int  ac,
char **  av 
)
Todo:
use commentator.