About the input arguments of magma_dsgesv_gpu()

Open discussion for MAGMA

About the input arguments of magma_dsgesv_gpu()

Postby jgpallero » Thu Jan 02, 2014 12:30 pm

Hello,

I'm trying to use the magma_dsgesv_gpu() functionand I'm confused about the IPIV and dIPIV arguments. The IPIV argument is the same as in the reference Lapack implementation (http://www.netlib.no/netlib/lapack/double/dsgesv.f). Am I right? Also, in the magma_dsgesv_gpu() function, this must be stored in CPU memory. The problem is that I don't understand the behavior of the dIPIV argument. The documentation says:
Code: Select all
    dIPIV   (output) INTEGER array on the GPU, dimension (min(M,N))
            The pivot indices; for 1 <= i <= min(M,N), row i of the
            matrix was moved to row IPIV(i).

First of all, I think there is an error about its dimensions. As the matrix A is NxN, the min(M,N) has no sense, so the length of dIPIV should be N. Stores dIPIV at output the same data as IPIV?

Thanks
jgpallero
 
Posts: 29
Joined: Tue Nov 15, 2011 12:38 pm

Re: About the input arguments of magma_dsgesv_gpu()

Postby mgates3 » Tue Jan 07, 2014 2:28 pm

Yes, ipiv is the same as in LAPACK.
You're right, the documentation was wrong. In getrf, A is MxN, so ipiv is dimension min(M,N). But in gesv, A is NxN, so ipiv should be dimension N.

On output, ipiv and dipiv are not the same. For ipiv, row i was interchanged with row ipiv[i], and interchanges are applied serially. For dipiv, after permuting, row i was moved to row dipiv[i]. That is, dipiv is a permutation of numbers 0, ..., N-1. This allows the permutation to be applied in parallel, given separate input and output matrices. For example:

Code: Select all
// apply ipiv in serial
for i = 1 to N
    swap A[ ipiv[i] ] and A[ i ]
end

// apply dipiv, loop can be parallelized
for i = 1 to N
    SA[ dipiv[i] ] = A[ i ]
end


However, ipiv and dipiv are just different representations of the same permutation.
-mark
mgates3
 
Posts: 442
Joined: Fri Jan 06, 2012 2:13 pm

Re: About the input arguments of magma_dsgesv_gpu()

Postby mgates3 » Tue Jan 07, 2014 2:32 pm

Also, dipiv is 0-based, while ipiv is 1-based.
-mark
mgates3
 
Posts: 442
Joined: Fri Jan 06, 2012 2:13 pm

Re: About the input arguments of magma_dsgesv_gpu()

Postby jgpallero » Wed Jan 08, 2014 6:03 am

Thanks!
jgpallero
 
Posts: 29
Joined: Tue Nov 15, 2011 12:38 pm


Return to User discussion

Who is online

Users browsing this forum: Bing [Bot] and 3 guests