[petsc-users] Start logging with -info after PetscInitialize()

Barry Smith bsmith at petsc.dev
Tue Jun 13 09:38:35 CDT 2023


  Jacob,

   Perhaps the cleanup can be done automatically so as to not require the user to know they need to call the Destroy first? The current API seems odd.



> On Jun 13, 2023, at 10:25 AM, Jacob Faibussowitsch <jacob.fai at gmail.com> wrote:
> 
> Call PetscInfoDestroy() first.
> 
> https://petsc.org/main/manualpages/Profiling/PetscInfoDestroy/
> 
> Best regards,
> 
> Jacob Faibussowitsch
> (Jacob Fai - booss - oh - vitch)
> 
>> On Jun 13, 2023, at 10:16, Jeremy Theler (External) via petsc-users <petsc-users at mcs.anl.gov> wrote:
>> 
>> Hello all.
>> 
>> I've asked this question to Satish personally last week at the conference, but I'm stuck so any help would be appreciated.
>> For some reason not worth explaining, I need to activate -info after PetscInitialize() has been already called.
>> I'm trying something like this:
>> 
>> PetscOptionsSetValue(NULL, "-info", NULL);        
>> PetscInfoSetFromOptions(NULL);
>> 
>> The second call fails with
>> 
>> [0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------
>> [0]PETSC ERROR: Object is in wrong state
>> [0]PETSC ERROR: PetscInfoSetClasses() cannot be called after PetscInfoGetClass() or PetscInfoProcessClass()
>> [0]PETSC ERROR: See https://petsc.org/release/faq/ for trouble shooting.
>> [0]PETSC ERROR: Petsc Release Version 3.19.2, Jun 01, 2023
>> [0]PETSC ERROR: reflexCLI on a double-int32-release named LIN54Z7SQ3 by jtheler Tue Jun 13 11:08:29 2023
>> [0]PETSC ERROR: Configure options --download-eigen --download-hdf5 --download-hypre --download-metis --download-mumps --download-parmetis --download-pragmatic --download-scalapack --download-slepc --with-64-bit-indices=no --with-debugging=no --with-precision=double --with-scalar-type=real COPTFLAGS=-O3 CXXOPTFLAGS=-O3 FOPTFLAGS=-O3 --download-egads --download-opencascade --download-tetgen
>> [0]PETSC ERROR: #1 PetscInfoSetClasses() at /home/jtheler/libs/petsc-3.19.2/src/sys/info/verboseinfo.c:182
>> [0]PETSC ERROR: #2 PetscInfoSetFromOptions() at /home/jtheler/libs/petsc-3.19.2/src/sys/info/verboseinfo.c:407
>> 
>> But if I ignore the non-zero return value and I allow my program to continue, the required logging is enabled.
>> I also tried using a local PetscOptions object but the result is the same.
>> 
>> Any ideas to avoid that wrong state error?
>> 
>> Thanks
>> --
>> jeremy
> 
> 

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


More information about the petsc-users mailing list