Wrapping magma_dpotrf for python

Open discussion for MAGMA library (Matrix Algebra on GPU and Multicore Architectures)
mgates3
Posts: 918
Joined: Fri Jan 06, 2012 2:13 pm

Re: Wrapping magma_dpotrf for python

Post by mgates3 » Wed Jun 17, 2015 3:02 pm

There is not currently an out-of-GPU-memory triangular solve. If A is in CPU memory, and you have a single right-hand side b, then solving it on the CPU with LAPACK is likely faster than copying the matrix to the GPU and solving it there.

You can use magma_dposv, which will try to factor & solve on the GPU if it fits (magma_dpotrf_gpu & magma_dpotrs_gpu), otherwise it will use the out-of-GPU-memory factorization and solve on the CPU (magma_dpotrf & lapack_dpotrs).

-mark

mtek
Posts: 2
Joined: Tue Jul 28, 2015 11:55 am

Re: Wrapping magma_dpotrf for python

Post by mtek » Tue Jul 28, 2015 12:17 pm

Hello Peter,
I am trying to wrap magma_dsyevd function. I tried to replicate your results. Somehow, I couldn't manage that with exactly the same problem of "ctypes.c_char(uplo)". I was wondering if it is possible to upload your working code snippet.
-Mustafa

mtek
Posts: 2
Joined: Tue Jul 28, 2015 11:55 am

Re: Wrapping magma_dpotrf for python

Post by mtek » Tue Jul 28, 2015 5:50 pm

Hello Peter,
I am trying to replicate your results so that I can build magma_dsyev upon it. I encountered exactly the same problem at libmagma.magma_uplo_const(ctypes.c_char(uplo)). Somehow, I couldn't manage to correct it. I was wondering if you can post your working version as a template?
Best,
Mustafa

psims01
Posts: 9
Joined: Fri Nov 28, 2014 12:31 pm

Re: Wrapping magma_dpotrf for python

Post by psims01 » Tue Aug 04, 2015 2:31 pm

Hi Mustafa,

As Mark mentioned, uplo is not actually a char it's an int. You can use libmagma.magma_uplo_const(ctypes.c_char(uplo)) to convert 'L' or 'U' to the value required.
Annoyingly I wasn't able to get the call to dpotrf from libmagma to do what I wanted in the end which would have been a neater solution (if you can get it to work after correcting uplo please let me know). Instead I accessed it using c types via its c wrapper (testing_dpotrf).

Peter

Post Reply