[petsc-dev] Better error message for missing components

Smith, Barry F. bsmith at mcs.anl.gov
Sun Oct 13 12:05:22 CDT 2019


PetscErrorCode MatGetFactor(Mat mat, MatSolverType type,MatFactorType ftype,Mat *f)
{
  PetscErrorCode ierr,(*conv)(Mat,MatFactorType,Mat*);
  PetscBool      foundpackage,foundmtype;

  PetscFunctionBegin;
  PetscValidHeaderSpecific(mat,MAT_CLASSID,1);
  PetscValidType(mat,1);

  if (mat->factortype) SETERRQ(PetscObjectComm((PetscObject)mat),PETSC_ERR_ARG_WRONGSTATE,"Not for factored matrix");
  MatCheckPreallocated(mat,1);

  ierr = MatSolverTypeGet(type,((PetscObject)mat)->type_name,ftype,&foundpackage,&foundmtype,&conv);CHKERRQ(ierr);
  if (!foundpackage) {
    if (type) {
      SETERRQ2(PetscObjectComm((PetscObject)mat),PETSC_ERR_MISSING_FACTOR,"Could not locate solver package %s. Perhaps you must ./configure with --download-%s",type,type);
    } else {
      SETERRQ(PetscObjectComm((PetscObject)mat),PETSC_ERR_MISSING_FACTOR,"Could not locate a solver package. Perhaps you must ./configure with --download-<package>");
    }
  }



> On Oct 1, 2019, at 4:51 AM, Matthew Knepley via petsc-dev <petsc-dev at mcs.anl.gov> wrote:
> 
> Can anyone think of a way to get a better message from
> 
> [0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------
> [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: Unknown PetscViewer type given: hdf5
> [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for trouble shooting.
> [0]PETSC ERROR: Petsc Release Version 3.10.2, Oct, 09, 2018
> [0]PETSC ERROR: ./testPlex on a  named kif.eng.buffalo.edu by bldenton Mon Sep 30 21:18:30 2019
> [0]PETSC ERROR: Configure options --with-make-np=24 --prefix=/kif1/data/shared/software/libs/petsc/3.10.2/gcc/8.2.0/mpich/3.2.1/openblas/0.2.20/opt --with-debugging=false --COPTFLAGS="-O3 -mavx" --CXXOPTFLAGS="-O3 -mavx" --FOPTFLAGS=-O3 --with-shared-libraries=1 --with-mpi-dir=/kif1/data/shared/software/libs/mpich/3.2.1/gcc/8.2.0 --with-mumps=true --download-mumps=1 --with-metis=true --download-metis=1 --with-parmetis=true --download-parmetis=1 --with-superlu=true --download-superlu=1 --with-superludir=true --download-superlu_dist=1 --with-blacs=true --download-blacs=1 --with-scalapack=true --download-scalapack=1 --with-hypre=true --download-hypre=1 --with-blas-lib="[/kif1/data/shared/software/libs/openblas/0.2.20/gcc/8.2.0/lib/libopenblas.so]" --with-lapack-lib="[/kif1/data/shared/software/libs/openblas/0.2.20/gcc/8.2.0/lib/libopenblas.so]" --LDFLAGS=
> [0]PETSC ERROR: #1 PetscViewerSetType() line 444 in /kif1/data/shared/software/builddir/petsc-L9c6Pv/petsc-3.10.2/src/sys/classes/viewer/interface/viewreg.c
> [0]PETSC ERROR: #2 PetscOptionsGetViewer() line 327 in /kif1/data/shared/software/builddir/petsc-L9c6Pv/petsc-3.10.2/src/sys/classes/viewer/interface/viewreg.c
> [0]PETSC ERROR: #3 PetscObjectViewFromOptions() line 133 in /kif1/data/shared/software/builddir/petsc-L9c6Pv/petsc-3.10.2/src/sys/objects/destroy.c
> [0]PETSC ERROR: #4 main() line 210 in /kif1/data/users/bldenton/EGADSlite/egadsPlex/egadsPlex.c
> 
> I want it to say "Try configuring with --download-hdf5"
> 
>   Thanks,
> 
>      Matt
> 
> -- 
> 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://www.cse.buffalo.edu/~knepley/



More information about the petsc-dev mailing list