[petsc-users] [KSP] solveTranspose fails with Strumpack and SuperLU_dist

Barry Smith bsmith at petsc.dev
Sat Apr 9 20:37:13 CDT 2022


  It would also be very straightforward for you to provide a merge request that adds support for PETSc to directly use SuperLU_DIST and Strumpacks transpose solver capability.   Just add the support to superlu_dist.c (and for strumpack) mimicking the style in mumps.c More specifically add a 

PetscErrorCode MatSolveTranspose_SuperLU_DIST(Mat A,Vec b,Vec x) function almost identical to MatSolveTranspose_MUMPS() but setting 

 Mat_SuperLU_DIST      *lu=(Mat_SuperLU_DIST*)A->data;
lu->options.trans = TRANS; 

and register it where the solve is registered later in the file (seach for ops->solve) 

Detailed instructions on making a PETSc MR can be found at https://petsc.org/release/developers/integration/#getting-your-code-and-documentation-into-petsc




> On Apr 9, 2022, at 8:57 PM, Zhang, Hong via petsc-users <petsc-users at mcs.anl.gov> wrote:
> 
> Jean,
> 
> You can use -ksp_use_explicittranspose to make KSP transpose the system explicitly in the transposed solve. This option was designed to enable more choices of linear solvers and preconditions in adjoint solves, of course, at a cost.
> 
> Hong (Mr.)
> 
>> On Apr 8, 2022, at 4:52 PM, Jean Marques <jeanmarques.eng at gmail.com <mailto:jeanmarques.eng at gmail.com>> wrote:
>> 
>> Hi all,
>> 
>> This may be a naive question, and I hope this is the right place to ask about it.
>> I need to solve a direct linear system with a sparse matrix R, then an adjoint system the hermitian of R.
>> 
>> I use a petsc4py, so what I do is this:
>> self.R.setUp()
>> to set up the PETSc KSP variable R, then I do:
>> self.R.solve(f, q)
>> and later:
>> self.R.solveTranspose(f, q)
>> 
>> However, 'solveTranspose()' only works when I use MUMPS. If I try STRUMPACK or SUPERLU_DIST it fails, it seems that 'solveTranpose()' is not defined for them? or is there a specific way to call them with these libraries?
>> Maybe the approach would be to define another 'self.R' variable but then set it as a transpose().conjugate() before setUp()?
>> I was trying STRUMPACK because it has a low-memory approach and that's my main bottleneck.
>> 
>> I appreciate any help you can provide.
>> 
>> Best,
>> Jean
>> 
>> -- 
>> Jean Helder Marques Ribeiro
>> Ph.D. Candidate
>> University of California, Los Angeles
>> 420 Westwood Plaza, Los Angeles, CA 90095
>> phone: (310) 689-6593
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20220409/0c1a51f1/attachment-0001.html>


More information about the petsc-users mailing list