Suggestion for Magma ZCGESV

Open discussion for MAGMA library (Matrix Algebra on GPU and Multicore Architectures)
Post Reply
fletchjp
Posts: 203
Joined: Mon Dec 27, 2010 7:29 pm

Suggestion for Magma ZCGESV

Post by fletchjp » Wed Sep 16, 2015 5:42 pm

I am working with various problems which require the repeated solution of N sets of equations Ax = b where there are N copies of A which don't change from one iteration to the next while the b blocks do change. One way of doing this is to run ZGETRF on each A and save the results, so that ZGETRS can then run for each A for each iteration. That works for me both with LAPACK and with MAGMA. The main problem is the storage of the factorised A matrices. On a machine with 8 Gbytes of main memory I can only get to N=6 with double precision.

I have tried instead to use the LAPACK routine ZCGESV which uses single precision factorization. I have an adapted version ZCGESV_OPT where I can turn off the factorisation and use one I have already saved. I can also add the choice of whether to transpose the solution, which is available with ZGETRS but not with ZCGESV. I have this working in LAPACK and it enables me to double N to 12 which gives much better performance in the outer algorithm.

I am writing this to suggest that the same alterations could be made to the MAGMA routine for ZCGESV. I am going to attempt this myself and will let you know how I get on. I thought it worthwhile to let you know of this.

The matrix size is about 7000.

Best wishes

John

fletchjp
Posts: 203
Joined: Mon Dec 27, 2010 7:29 pm

Re: Suggestion for Magma ZCGESV

Post by fletchjp » Wed Sep 16, 2015 6:19 pm

When I wrote the above I had not yet looked at the Magma version of ZCGESV. I have now done so, and find that it does allow for transpose operations in its interface, unlike the LAPACK one. It has another difference from the LAPACK version as follows.

It does the SP factorization using magma_cgetrf_gpu as expected. It takes the pivots from this and puts them through swp2pswp (which I tracked down in exp/control/auxiliary.cpp).

This does something to make the pivots "parallel". The only other use I have found is in the noncomplex DSGESV.

It then calls an internal routine magma_zcgetrs_gpu instead of the cgetrs used in LAPACK.

So there are already differences from the LAPACK version but nothing I think which would stop me adding logical control to skip the factorization and reuse one done already.

This is based on Magma 1.6.2

John

fletchjp
Posts: 203
Joined: Mon Dec 27, 2010 7:29 pm

Re: Suggestion for Magma ZCGESV

Post by fletchjp » Sun Sep 27, 2015 5:35 pm

I have now implemented a version I have called magma_zcgesv_opt_gpu which gives the option to do either the factorization or the solution or both.

I have it working from Fortran using a modification of the interface code from the other thread.

Thank you for your help.

John

Post Reply