[petsc-dev] Option -history crashes with a terrible message
Barry Smith
bsmith at mcs.anl.gov
Wed Jun 19 22:40:17 CDT 2013
Both fixed in barry/petsc-history and next and master. This is the usual problem of wanting to use PETSc things that require initialization (like PETSc objects/viewers) early in the PetscInitialize() before those things are created yet.
Barry
On Jun 19, 2013, at 3:10 AM, Jed Brown <jedbrown at mcs.anl.gov> wrote:
> $ ./ex1 -history
> PETSC ERROR: Logging has not been enabled.
> You might have forgotten to call PetscInitialize().
> application called MPI_Abort(MPI_COMM_WORLD, 56) - process 0
>
> Here's the stack trace:
>
> (gdb) bt
> #0 0x00007ffff380ccd0 in exit () from /usr/lib/libc.so.6
> #1 0x00007ffff42ccc16 in MPIU_Exit () from /home/jed/usr/mpich-clang/lib/libmpich.so.10
> #2 0x00007ffff42f2baa in MPID_Abort () from /home/jed/usr/mpich-clang/lib/libmpich.so.10
> #3 0x00007ffff7f5cb06 in MPI_Abort () from /home/jed/usr/mpich-clang/lib/libpmpich.so.10
> #4 0x00007ffff6a9bec4 in PetscLogGetStageLog (stageLog=0x7fffffff4dd0) at /home/jed/petsc/src/sys/logging/utils/stagelog.c:35
> #5 0x00007ffff68ffed7 in PetscClassIdRegister (name=0x7ffff7b19c49 <.L.str6> "Viewer", oclass=0x7ffff7ddab24 <PETSC_VIEWER_CLASSID>) at /home/jed/petsc/src/sys/logging/plog.c:2555
> #6 0x00007ffff6a010e9 in PetscViewerInitializePackage () at /home/jed/petsc/src/sys/classes/viewer/interface/view.c:49
> #7 0x00007ffff6a06d56 in PetscViewerCreate (comm=1140850688, inviewer=0x7fffffff5288) at /home/jed/petsc/src/sys/classes/viewer/interface/viewreg.c:171
> #8 0x00007ffff69fde56 in PetscViewerASCIIOpenWithFILE (comm=1140850688, fd=0x45f4c0, lab=0x7fffffff5288) at /home/jed/petsc/src/sys/classes/viewer/impls/ascii/vcreatea.c:329
> #9 0x00007ffff69798e9 in PetscOpenHistoryFile (filename=0x0, fd=0x7ffff7be02c8 <petsc_history>) at /home/jed/petsc/src/sys/objects/init.c:131
> #10 0x00007ffff697e53b in PetscOptionsCheckInitial_Private () at /home/jed/petsc/src/sys/objects/init.c:479
> #11 0x00007ffff6982db1 in PetscInitialize (argc=0x7fffffffd7f8, args=0x7fffffffd7f0, file=0x0, help=0x4045e0 <help> "Solves a tridiagonal linear system with KSP.\n\n") at /home/jed/petsc/src/sys/objects/pinit.c:793
> #12 0x00000000004014e6 in main (argc=2, args=0x7fffffffd8e8) at ex1.c:36
>
>
> I don't know how some of our output files have trailing whitespace in
> the lines with positive tab-level. You can see this in, e.g.,
>
> $ git show 03c47c2df6d9113429 -- src/ksp/ksp/examples/tutorials/output/ex1_2.out
>
> which shows two spaces of trailing whitespace in the indented line.
>
> Matrix Object: 1 MPI processes
>
> I presume this was caused by somehow having petsc_history turned on, and
> I think the patch below will fix it, but I don't know how people turned
> on petsc_history to produce those trailing spaces in the first place.
>
> commit 17c4b54af62330efacf05d0471746d7cafbae154 (jed/fix-viewer-ascii-tab-whitespace)
> Author: Jed Brown <jedbrown at mcs.anl.gov>
> Date: Wed Jun 19 09:19:55 2013 +0200
>
> Viewer ASCII: print tabs to petsc_history, not fd
>
> Tabs are intended to provide indentation, but were being printed as
> trailing whitespace when petsc_history was turned on.
>
> diff --git a/src/sys/classes/viewer/impls/ascii/filev.c b/src/sys/classes/viewer/impls/ascii/filev.c
> index 705f3f7..a90a521 100644
> --- a/src/sys/classes/viewer/impls/ascii/filev.c
> +++ b/src/sys/classes/viewer/impls/ascii/filev.c
> @@ -554,7 +554,7 @@ PetscErrorCode PetscViewerASCIIPrintf(PetscViewer viewer,const char format[],..
> va_start(Argp,format);
> tab = ascii->tab;
> while (tab--) {
> - ierr = PetscFPrintf(PETSC_COMM_SELF,fd," ");CHKERRQ(ierr);
> + ierr = PetscFPrintf(PETSC_COMM_SELF,petsc_history," ");CHKERRQ(ierr);
> }
> ierr = (*PetscVFPrintf)(petsc_history,format,Argp);CHKERRQ(ierr);
> err = fflush(petsc_history);
More information about the petsc-dev
mailing list