About matrix output layout of some decompositions in PLASMA

Open forum for general discussions relating to PLASMA.

About matrix output layout of some decompositions in PLASMA

Postby jgpallero » Sun Jul 29, 2012 7:49 am

Hello all:

I'm writting a wrapper around some functions of Lapack and PLASMA. The goal is to select Lapack or PLASMA at compiling time of my code in order to use one of them. Due to this fact the output arguments of my wrapper should be the same as in Lapack. Then I have some questions due to the behavior of PLASMA:

First of all, the PLASMA_dgetrf and PLASMA_dgels functions, that performs the LU factorization. In PLASMA_dgetrf and PLASMA_dgels documentation says that the A matrix arguments stores at output the TILE factors L and U from the factorization. In my wrapper these factors should be returned as a Lapack matrix. So how could I transform the tiled A matrix from PLASMA to the correct Lapack format? I know the function PLASMA_Tile_to_Lapack(PLASMA_desc *A,void *Af77,int LDA), but I'm a bit confused about the PLASMA_desc argument. The A matrix returned by PLASMA_dgetrf and PLASMA_dgels are of type double* and is tiled, but the A argument of PLASMA_Tile_to_Lapack is of type PLASMA_desc*. Should I use this function to convert A to Lapack format?
And about the PLASMA_dgetri and PLASMA_dgetrs? In my wrapper the input A matrix will be stored in Lapack format, but the PLASMA functions expect A in tiled format as output from PLASMA_dgetrf. I know the function PLASMA_Lapack_to_Tile(void *Af77,int LDA,PLASMA_desc *A), but again I have the doubt about the double* A type that PLASMA functions accept and PLASMA_desc *A type that PLASMA_Lapack_to_Tile returns. Can I use PLASMA_Lapack_to_Tile to this task?

I have the same questions about the matrix A in PLASMA_dgeqrf and PLASMA_dgelqf (QR and LQ factorizations) and in PLASMA_dorgqr (reconstruction A=QR).
The PLASMA_dgeqrf and PLASMA_dgelqf functions uses internally a double* T vector that should be allocated with the functions PLASMA_Alloc_Workspace_[dgeqrf|dgelqf]. Are these vectors the same as TAU vector used in DGEQRF and DGELQF in Lapack? Have the same dimensions? Can I copy the T to TAU after the PLASMA functions run? If in my wrapper I pass the TAU vectors with the correct dimensions (as stated in the reference Lapack documentation), could I use TAU instead T in PLASMA?

Posts: 29
Joined: Sat Jul 28, 2012 12:12 pm

Re: About matrix output layout of some decompositions in PLA

Postby jgpallero » Sun Aug 05, 2012 8:04 am

Hello again:

I'm thinking in perform these operations in my wrapper directly via the *_Tile funtions. The idea is to call prior the PLASMA function the routine PLASMA_dLapack_to_Tile, and after the PLASMA function the routine PLASMA_dTile_to_Lapack in order to convert the output tile matrices in classical Lapack ones.

But I'm a bit confused about the PLASMA matrix conversion routines. For example, the imput arguments for PLASMA_dLapack_to_Tile are only double *Af77, int LDA and PLASMA_desc *A. But what about the Af77 dimensions?
Posts: 29
Joined: Sat Jul 28, 2012 12:12 pm

Re: About matrix output layout of some decompositions in PLA

Postby jgpallero » Tue Sep 04, 2012 1:13 pm

Hello again (and again):

I'm trying to use the PLASMA_dgetrf_Tile function in order to convert after the execution the QR factorization stored in A from tile format to normal Fortran matrix for use in my wrapper as I explained in my previous posts.

To do this I must convert my input A matrix in tile format. In the document 02_Kurzak_PLASMA.pdf (slide 62) stored in http://web.eecs.utk.edu/~kurzak/tutorials/ISC12/ I see the steps:
Code: Select all
PLASMA_Desc_Create(&descA, ...);
PLASMA_Desc_Create(&descB, ...);
PLASMA_dLapack_to_Tile(A, lda, descA);
PLASMA_dLapack_to_Tile(B, ldb, descB);
PLASMA_dgesv_Tile(descA, IPIV, descB);

(After the computation and before PLASMA_Desc_Destroy I should use PLASMA_Tile_to_dLapack) in order to transform the factorized tiled matrix into the normal Fortran scheme)

My problem is about the input arguments of the function PLASMA_Desc_Create. It is defined in the file descriptor.c and the input arguments are explained, but I don't understand them clearly. The complete interface of the function is:
Code: Select all
int PLASMA_Desc_Create(PLASMA_desc **desc, void *mat, PLASMA_enum dtyp, int mb, int nb, int bsiz,
                       int lm, int ln, int i, int j, int m, int n)

and my doubts are about the
Code: Select all
 int mb, int nb, int bsiz,int lm, int ln, int i, int j, int m, int n

Surfing the code in other functions I see that the macros plasma_dooplap2tile and plasma_diplap2tile use (between others) the same arguments. These macros call the function plasma_desc_init, which uses the same arguments too. Comparing the passed arguments and the descriptions I think that I've determined the correct values of them, but I'm not so sure. These are my understand (suppose a matrix A, of M, N and LDA):

1- mb and nb: rows and columns per tile. In the code always mb=nb=PLASMA_NB is used, so I suppose that the PLASMA constant PLASMA_NB is the correct value for mb and nb in PLASMA_Desc_Create

2- bsiz: the doxygen doc says "Size in bytes including padding". But size of what? In bytes? In the code always the value mb*nb is used, so I suppose that bsiz is the total number of elements in a tile

3- lm and ln: rows and columns STORED IN MEMORY of the matrix, so in column major order always lm=LDA and ln=N

4- i and j: row and column index to the beginning of the submatrix. Always i=j=0

5- m and n: rows and columns of the submatrix. Always m=M and n=N

In points 4 and 5 I understand that 'submatrix' is the matrix A referred to the real dimensions in memory LDA,N

Am I right?

Posts: 29
Joined: Sat Jul 28, 2012 12:12 pm

Re: About matrix output layout of some decompositions in PLA

Postby jgpallero » Thu Sep 06, 2012 10:50 am


I'm trying to use the *_Tile functions as I explained in my previous post, but I have problems about the argumens mb and nb (rows and columns in a tile). In the code of some functions in PLASMA I can see that a common value for these arguments is the value stored in PLASMA_NB. In the file common.h I see that PLASMA_NB is defined as plasma->nb, where plasma is of type plasma_context_t. But PLASMA_NB can not be accesed from the plasma.h by the user (common.h is not installed). So how can I use the PLASMA_NB in my own programs in order to create a descriptor via the PLASMA_Desc_Create function? I would like to use the default value for NB as fixed at compilation time of PLASMA.
Posts: 29
Joined: Sat Jul 28, 2012 12:12 pm

Re: About matrix output layout of some decompositions in PLA

Postby mateo70 » Fri Sep 07, 2012 7:06 am


The way to set/get the blocking size and the inner blocking size is:
- first to disable the autotunning to avoid PLASMA to change the value with different algorithms:

- and then you set it to the value you decided:

- or if you want to know which size PLASMA is using:

Posts: 109
Joined: Fri May 07, 2010 3:48 pm

Re: About matrix output layout of some decompositions in PLA

Postby jgpallero » Fri Sep 07, 2012 8:43 am

Thank you for your answer. When I use PLASMA_Disable(PLASMA_AUTOTUNING); and after the call to the computation functions, do I need to call PLASMA_Enable(PLASMA_AUTOTUNING);? Changes PLASMA_Disable(PLASMA_AUTOTUNING); a globar or a local variable? Remember that I'm calling the *_Tile computational functions inside a wrapper function.

And what about my post about the arguments of PLASMA_Desc_Create and the use of *_Tile functions?

As I said previously I'm using the *_Tile functions dgesv, dgels, dgetrf, dgetri, dgetrs, dgeqrf and dgelqf because the non tile versions return the decomposed matrix in tile format and I need output in my wrapper in fortran format, but the functions return the results as tiled double* pointers and I don't know how to convert them in fortran format

Thanks in advance
Posts: 29
Joined: Sat Jul 28, 2012 12:12 pm

Return to User discussion

Who is online

Users browsing this forum: No registered users and 1 guest