[petsc-dev] -log_view not working when setting using PetscOptionsSetValue( )
Matthew Knepley
knepley at gmail.com
Wed Aug 21 13:24:17 CDT 2024
On Wed, Aug 21, 2024 at 1:15 PM Angus, Justin Ray via petsc-dev <
petsc-dev at mcs.anl.gov> wrote:
> Hello,
>
>
>
> I’ve been able to successfully use -log_view in a cpp code using PETSc
> when setting it through a .petscrc file. I get lots of information about
> the SNES and KS solvers at the end of my simulation as expected.
>
>
>
> However, if I instead try to turn on log_view from inside my cpp code,
> using something like
>
>
>
> PetscInitialize(&a_argc,&a_argv,(char*)0,help);
>
> PetscOptionsSetValue( NULL, "-log_view" , NULL );
>
> PetscFinalize();
>
>
>
> Then I get the following message at the end of my simulation
>
>
>
> [5]PETSC ERROR: --------------------- Error Message
> --------------------------------------------------------------
>
> [5]PETSC ERROR: Object is in wrong state
>
> [5]PETSC ERROR: A PetscLogHandler of type default has not been started.
>
> [5]PETSC ERROR: See https://urldefense.us/v3/__https://petsc.org/release/faq/__;!!G_uCfscf7eWS!emwZ3QQIbMQF7ZH_8EyWu8LQEDYtiAM1sng6x0gtfM7GkGaouwGe-sWN4dVHH9h8fT2qaL-czNUjeHazex8N$
> <https://urldefense.us/v3/__https://petsc.org/release/faq/__;!!G_uCfscf7eWS!ZOx9FLrofB1s1oTVLL6psn-36zBbHH9WiAgg1Arjda5O4RvYo1Na8aJgC4P_Ractdr7HCa0C-aPq9oVsiUcnlQ$>
> for trouble shooting.
>
>
>
>
>
> What am I doing wrong here?
>
This is a limitation of PETSc. We want the log to be setup early so it is
processed inside PetscInitialize(). For things like
this is usually use the environment,
PETSC_OPTIONS="-log_view" ./myexe
Thanks,
Matt
> Thank you.
>
>
>
> -Justin
>
>
>
>
>
--
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
https://urldefense.us/v3/__https://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!emwZ3QQIbMQF7ZH_8EyWu8LQEDYtiAM1sng6x0gtfM7GkGaouwGe-sWN4dVHH9h8fT2qaL-czNUjeKliLdRa$ <https://urldefense.us/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!emwZ3QQIbMQF7ZH_8EyWu8LQEDYtiAM1sng6x0gtfM7GkGaouwGe-sWN4dVHH9h8fT2qaL-czNUjeKcwJEGc$ >
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20240821/18ac7164/attachment-0001.html>
More information about the petsc-dev
mailing list