Assignment 3
Your task is to fill out the missing details in a skeleton subroutine in Fortran that solves a mathematical problem. You will do this in parallel using ScaLAPACK, PBLAS and BLACS.
These are the major steps:
- Define problem by setting N,K and NB. Initialize BLACS and generate distributed matrices and descriptors. A is N*N, B and X is N*K with blocking factor NB.
- Descriptors are generated by the routine DESCINIT. The 9th parameter, leading dimension of the local matrix, can be calculated by a call to the function NUMROC.
- Copy A, so you can verify your solution later using the routine pdlacpy.
- Compute B = A*X using the routine pdgemm.
- Copy B to X using the routine pdlacpy.
- Now Solve the linear system A*X = B for X
- Compute a LU factorization of A using the routine pdgetrf. This will overwrite A.
- Apply the permutation represented by the vector piv to the rows of the matrix X using the routine pdlapiv.
- Solve L*Y = X for Y overwriting X using the routine pdtrsm.
- Solve U*Z = X for Z overwriting X using the routine pdtrsm.
- Compute the residual: B = ACopy * X - B using the routine pdgemm.
- Compute and output the Frobenius norm of the residual now stored in matrix B using the routine pdlange. This value should be < ~ 10-10 if you have done it correctly.
In the skeleton file lab3.f there are places marked with todo which precedes a couple of deleted lines that your task is to reconstruct. There are in all cases just handfuls up to a dozen of lines to add in each place and the context should be helpful.
A sample Makefile and submit file for ABISKO is included with the skeleton code. Provided is also a routine for generating matrices, PDMATGEN.f, and a routine for printing out a distributed matrix PDLAPRNT.f.
Modules to load are listed in the file modules.
The files are found in assg3.tar_.gz
To pass this assignment you should show your code and results to the lab assistant.
Contributions by
Lars Karlsson
Bo Kågström
Mikael Rännar
Björn Adlerborn