Example codes of use for LAPACK:
Example codes of use for ScaLAPACK:
Distribution of matrices, collecting back the result
-
distribute a dense general matrix with an generate_element_ij_of_A(int i,int j,double *a) function
-
prerequise: you provide a function generate_element_ij_of_A(int ia,int ja,double *a) which for any processors
is able to construct the entry A(ia,ja) of the matrix A
- example1 is very straight-forward but not too efficient.
- example2 takes advantage of 2d block cyclic format
but the code is slightly more complicated.
-
distribute a dense general matrix with an generate_k_rows_of_A(int k,int i,double *a) function
-
prerequise: you provide a function generate_k_rows_of_A(int k,int ia,double *a) which for any processors
is able to construct the submatrix A(ia:ia+k-1,1:n), i.e. the k rows of the matrix A starting from line ia ending at line ia+k-1
- example3 has each processor generates several complete
rows and use PBLAS for communication to redistribute the matrix.
-
useful routines from SCALAPACK/TOOLS to keep in mind:
- infog2l
-- map global (ia,ja) index to (prow,pcol) processor and (lrindx,lcindx) local array indices
(picture)
- indxg2p
-- map global index to processor
- numroc
-- compute local extent, useful in allocating storage for local array
- infog1l
-- map global to local index
- indxl2g
-- map local index to global index
- p_elset/p_elget
-- assign or get global matrix entry
Use of ScaLAPACK routines