========================================================= Starting to collect thing in ulmBLAS (and better Testing) [TOC] ========================================================= We will now start to collect our BLAS implementation in an extra compile unit so that we can reuse them for further exercises. Here an overview of the source and header files needed: - `ulmblas.h` This file is *given* and contains declarations of BLAS functions. - `ulmblas.c` This file is supposed to contain function definitions (i.e. implementations) of BLAS functions. *You have to fill this file with you implementation*. For this exercise it should contain (at least) the following implementations: - `dswap` for interchanging elements of two vectors. - `dgetrf` for computing the LU factorization with pivoting. Implicitly this will require that you also provide functions `dscal`, `idamax` and `dger` (as they are required for `dgetrf`). - `ulmaux.h`, `ulmaux.c`, `test_dgetrf.c` These files are * given*: - `ulmaux.c` contains for example functions for initializing and printing matrices, the timer `walltime`, etc. In `ulmaux.h` are declarations for these functions. - `test_dgetrf.c` is the actual program for checking and benchmarking the LU factorization. Header File for ulmBLAS ======================= :import: session12/ulmblas.h Exercise: Source File for ulmBLAS ================================= Write the source file `ulmblas.c`: Start with an empty file. Then include `ulmblas.h` and add your implementation for `dswap`, `dgetrf`, `dger`, `dscal` and `idamax`. Also include further header files required by your code. So you get a structure like this: ---- CODE(type=c) -------------------------------------------------------------- #include /* include other header files required by your code */ /* Implementation for your BLAS functions */ -------------------------------------------------------------------------------- Exercise: Test your LU factorization (with pivoting) ==================================================== Download the following files: :import: session12/ulmaux.h [fold] :import: session12/ulmaux.c [fold] :import: session12/test_dgetrf.c [fold] You can compile the test and link it with *your* ulmBLAS by --- SHELL(path=session12,hostname=heim) ---------------------------------------- gcc -Wall -O3 -I. -std=c99 -o test_dgetrf ulmblas.c ulmaux.c test_dgetrf.c -------------------------------------------------------------------------------- Run the tests with `./test_dgetrf check` and the benchmark with `./test_dgetrf bench`. Example: Running the test ------------------------- --- SHELL(path=session12,hostname=heim,fold) ----------------------------------- ./test_dgetrf check -------------------------------------------------------------------------------- Example: Running the benchmark ------------------------------ --- SHELL(path=session12,hostname=heim,fold) ----------------------------------- ./test_dgetrf bench --------------------------------------------------------------------------------