Problems with PetscLogView

Issue #864 resolved
Jan Blechta created an issue

Due to some chaos in initialization/finalization of PETSc/MPI, usage of -log_view fails many times. MWE:

#include <dolfin.h>

using namespace dolfin;

int main()
{
  PETScOptions().set("log_view");
  return 0;
}

Error message:

*** The MPI_Attr_get() function was called after MPI_FINALIZE was invoked.
*** This is disallowed by the MPI standard.
*** Your MPI job will now abort.

Comments (10)

  1. Johannes Ring

    Just want to add that if you do the same in Python you get the following error message:

    $ python -c "from dolfin import *;PETScOptions().set('log_view')"
    [0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------
    [0]PETSC ERROR: No support for this operation for this object type
    [0]PETSC ERROR: Must use -log_summary or PetscLogDefaultBegin() before calling this routine
    [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for trouble shooting.
    [0]PETSC ERROR: Petsc Release Version 3.7.6, Apr, 24, 2017 
    [0]PETSC ERROR: Unknown Name on a arch-linux2-c-opt named 98c5afe42af5 by fenics Tue Jun  6 07:01:24 2017
    [0]PETSC ERROR: Configure options --COPTFLAGS=-O2 --CXXOPTFLAGS=-O2 --FOPTFLAGS=-O2 --with-blas-lib=/usr/lib/libopenblas.a --with-lapack-lib=/usr/lib/liblapack.a --with-c-support --with-debugging=0 --with-shared-libraries --download-suitesparse --download-scalapack --download-metis --download-parmetis --download-ptscotch --download-hypre --download-mumps --download-blacs --download-spai --download-ml --prefix=/usr/local/petsc-32
    [0]PETSC ERROR: #1 PetscLogView() line 1761 in /tmp/petsc-3.7.6/src/sys/logging/plog.c
    [0]PETSC ERROR: #2 PetscLogViewFromOptions() line 1808 in /tmp/petsc-3.7.6/src/sys/logging/plog.c
    [0]PETSC ERROR: #3 PetscFinalize() line 1118 in /tmp/petsc-3.7.6/src/sys/objects/pinit.c
    PetscFinalize() failed [error code: 56]
    [0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------
    [0]PETSC ERROR: No support for this operation for this object type
    [0]PETSC ERROR: Must use -log_summary or PetscLogDefaultBegin() before calling this routine
    [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for trouble shooting.
    [0]PETSC ERROR: Petsc Release Version 3.7.6, Apr, 24, 2017 
    [0]PETSC ERROR: Unknown Name on a arch-linux2-c-opt named 98c5afe42af5 by fenics Tue Jun  6 07:01:24 2017
    [0]PETSC ERROR: Configure options --COPTFLAGS=-O2 --CXXOPTFLAGS=-O2 --FOPTFLAGS=-O2 --with-blas-lib=/usr/lib/libopenblas.a --with-lapack-lib=/usr/lib/liblapack.a --with-c-support --with-debugging=0 --with-shared-libraries --download-suitesparse --download-scalapack --download-metis --download-parmetis --download-ptscotch --download-hypre --download-mumps --download-blacs --download-spai --download-ml --prefix=/usr/local/petsc-32
    [0]PETSC ERROR: #4 PetscLogView() line 1761 in /tmp/petsc-3.7.6/src/sys/logging/plog.c
    [0]PETSC ERROR: #5 PetscLogViewFromOptions() line 1808 in /tmp/petsc-3.7.6/src/sys/logging/plog.c
    [0]PETSC ERROR: #6 PetscFinalize() line 1118 in /tmp/petsc-3.7.6/src/sys/objects/pinit.c
    
  2. Jan Blechta reporter

    If I rember correctly, in Python it worked for me the following

    import petsc4py
    petsc4py.init('python', '-log_view')
    

    The trick is that the option must be passed before PETSc initialization I think.

  3. Nathan Sime

    I've been using

    #include <dolfin.h>
    
    using namespace dolfin;
    
    int main(int argc, char** args)
    {
      PetscInitialize(&argc, &args, (char*)0, (char*)0);
      return 0;
    }
    

    with the argument -log_view with no problems. I also get the above MPI error if I use the code Jan posted.

  4. Prof Garth Wells

    Should be resolved in f521cfd. Some issues may persists due to careless use of MPI on logging, and calls to logging functions before MPI is initialised.

  5. Log in to comment