[petsc-users] Any workarounds for TAO in a complex scalar type code?

Barry Smith bsmith at petsc.dev
Thu Jun 24 22:11:07 CDT 2021


$ git grep requiresscalar 
bound/makefile:#requiresscalar    real
complementarity/makefile:#requiresscalar    real
constrained/makefile:#requiresscalar    real
leastsquares/makefile:#requiresscalar    real
linesearch/impls/makefile:#requiresscalar    real
pde_constrained/makefile:#requiresscalar    real
quadratic/makefile:#requiresscalar    real
unconstrained/makefile:#requiresscalar    real

We added these requirements when Tao was brought back into the PETSc fold as Alp mentioned. It would be good to start eliminating the requirements when possible. 

I have removed the leastsquares/makefile:#requiresscalar    real and have started a build to see how it goes. If everything goes well maybe we can get it working for complex without too much difficulty.

  Barry


> On Jun 24, 2021, at 4:02 PM, Junchao Zhang <junchao.zhang at gmail.com> wrote:
> 
> 
> 
> 
> On Thu, Jun 24, 2021 at 3:25 PM Dener, Alp via petsc-users <petsc-users at mcs.anl.gov <mailto:petsc-users at mcs.anl.gov>> wrote:
> Hi Lucas,
> 
> In theory, you can attempt to solve complex-valued problems by concatenating the real and imaginary parts into a single real-valued solution vector and solving it as if it’s a real-valued problem.
> 
> There’s a more practical issue of the PETSc build excluding the TAO source code entirely for complex builds. I think this is done because we cannot guarantee that TAO code has been completely rigorous in its distinction of PetscReal from PetscScalar. There may be places where we used Scalar and assumed it’s Real. The methods developed in the last few years have paid more attention to this but there’s a lot of older code floating around that might break even if you hacked the build into compiling TAO for complex configurations.
> If an expression does not support PetscComplex, shouldn't it report a compilation error?
> 
> I’m not entirely sure what’s necessary to enable TAO builds for complex PETSc. Perhaps Todd, Satish or Barry will have a better idea. If you want to give it a try though I’d be happy to help you resolve the errors as they come up so that it can be compiled for complex builds. Can’t provide convergence guarantees but it would at least let you attempt a solution.
> 
> Alp
> 
>> On Jun 24, 2021, at 2:44 PM, Lucas Banting <bantingl at myumanitoba.ca <mailto:bantingl at myumanitoba.ca>> wrote:
>> 
>> Hi,
>> 
>> I have a complex valued optimization code that requires non-linear least squares curve fitting at each iteration. I wanted to use Tao to do the non-linear least squares problem, but just discovered that Tao can only be used with real scalar types. Is there any workarounds?
>> 
>> I was wondering if maybe I could somehow use two different Petsc installations at once, or is there any other ways to hack tao into working?
>> 
>> Thanks,
>> Lucas
> 

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


More information about the petsc-users mailing list