[petsc-dev] Tao unusable from complex??

Dener, Alp adener at anl.gov
Wed Dec 12 09:06:57 CST 2018


Hi Stefano,

I can’t really speak to why the entirety of TAO is disabled in complex builds. Todd can probably offer historical insight to the reason(s).

However, we do have some methods in TAO that are not tested or guaranteed to be correct for complex-valued objective functions. The limited-memory quasi-Newton codes, for instance, currently only construct the approximate Hessian for the real part of the function and do not generate step directions in the complex part. I also don’t know whether any of the CG methods or line searches require any modifications to be correct in complex builds either.

In your itemized list, I agree that at minimum we should be supporting #3 even if TAO itself does not work correctly for complex-valued functions.

In the meantime, TAO can test real gradients or Hessians internally with `-tao_test_gradient` or `-tao_test_hessian`. Or you can also call `TaoTestHessian()` too. It’s a finite-difference test though, and not a complex-step test.

——
Alp Dener
Argonne National Laboratory
https://www.anl.gov/profile/alp-dener


On Dec 12, 2018, at 8:23 AM, Stefano Zampini via petsc-dev <petsc-dev at mcs.anl.gov<mailto:petsc-dev at mcs.anl.gov>> wrote:

If I compile PETSc with complex support, all of the TAO methods are not registered.
Fare enough? not really, I can imagine at least three valid reasons to use those

1) I want to check that my code works for complex builds, even if I have pure real function evaluations. I may need complex support in other parts or the code (not when using TAO), or I just want to be a diligent PETSc developer
2) I want to test REAL gradients or Hessians using built-in capability, instead of writing my own
3) I want to use the complex differentiation trick to compute REAL gradients

Last time I checked, at least option 2) was available; However, from commit 5921d7004dad83427f45468906667b100d2e2b6e, no Tao methods are registered when PETSC_USE_COMPLEX is defined, and code like the one below fail at runtime:

TaoCreate()
TaoSetFromOption()
TaoSetObjectiveRoutine()
TaoTestGradient()

[0]PETSC ERROR: Unknown type. Check for miss-spelling or missing package: http://www.mcs.anl.gov/petsc/documentation/installation.html#external
[0]PETSC ERROR: Unable to find requested Tao type lmvm


--
Stefano

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20181212/1a844d43/attachment-0001.html>


More information about the petsc-dev mailing list