[petsc-users] Sorted CSR Matrix and Multigrid PC.

Barry Smith bsmith at mcs.anl.gov
Fri Sep 9 19:19:57 CDT 2016


  
  The missing third argument to PCApply means that you haven't allocated the vector work?


> On Sep 9, 2016, at 3:34 PM, Manuel Valera <mvalera at mail.sdsu.edu> wrote:
> 
> Hello everyone,
> 
> I'm having an error with my program that i cannot understand, the weird part is that the same implementation in my main model does not show errors and they are virtually identical.
> 
> The problematic part of the code is:
> 
> 
>   call KSPCreate(PETSC_COMM_WORLD,ksp,ierr)
>   call KSPSetOperators(ksp,Ap,Ap,ierr)   
>   call KSPGetPC(ksp,pc,ierr)
>   tol = 1.e-5
>   call KSPSetTolerances(ksp,tol,PETSC_DEFAULT_REAL,PETSC_DEFAULT_REAL,PETSC_DEFAULT_INTEGER,ierr)
> 
>   call PCGetOperators(pc,PETSC_NULL_OBJECT,pmat,ierr)
>   call PCCreate(PETSC_COMM_WORLD,mg,ierr)
>   call PCSetType(mg,PCJACOBI,ierr)
>   call PCSetOperators(mg,pmat,pmat,ierr)
>   call PCSetUp(mg,ierr)
> 
>   call PCApply(mg,xp,work,ierr)
> 
> 
> And the errors i get are:
> 
> [0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------
> [0]PETSC ERROR: Null argument, when expecting valid pointer
> [0]PETSC ERROR: Null Object: Parameter # 3
> [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for trouble shooting.
> [0]PETSC ERROR: Petsc Release Version 3.7.3, Jul, 24, 2016 
> [0]PETSC ERROR: ./solvelinearmgPETSc                                                                                                                                                                                                                                                       on a arch-linux2-c-debug named valera-HP-xw4600-Workstation by valera Fri Sep  9 12:46:02 2016
> [0]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++ --with-fc=gfortran --download-fblaslapack=1 --download-mpich=1 --download-ml=1
> [0]PETSC ERROR: #1 PCApply() line 467 in /home/valera/sergcemv4/bitbucket/serucoamv4/petsc-3.7.3/src/ksp/pc/interface/precon.c
> [0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------
> [0]PETSC ERROR: Null argument, when expecting valid pointer
> [0]PETSC ERROR: Null Object: Parameter # 3
> [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for trouble shooting.
> [0]PETSC ERROR: Petsc Release Version 3.7.3, Jul, 24, 2016 
> [0]PETSC ERROR: ./solvelinearmgPETSc                                                                                     
> 
> 
> As i said before, the exact same code in a bigger model does not print errors. I'm trying to solve this before moving into multigrid implementation in my prototype, 
> 
> Thanks for your time,
> 
> 
> 
> On Wed, Sep 7, 2016 at 8:27 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:
> 
> > On Sep 7, 2016, at 10:24 PM, Manuel Valera <mvalera at mail.sdsu.edu> wrote:
> >
> > Thank you I will try this. What would be the call if I wanted to use other Multigrid option?
> 
>    There really isn't any other choices.
> 
> > Don't worry this is a standalone prototype, it should be fine on the main model. Anyway, any hints would be appreciated. Thanks a lot for your time.
> >
> >
> > On Sep 7, 2016 8:22 PM, "Barry Smith" <bsmith at mcs.anl.gov> wrote:
> >
> >   Sorry, this was due to our bug, the fortran function for PCGAMGSetType() was wrong. I have fixed this in the maint and master branch of PETSc in the git repository. But you can simply remove the call to PCGAMGSetType() from your code since what you are setting is the default type.
> >
> >   BTW: there are other problems with your code after that call that you will have to work through.
> >
> >   Barry
> >
> > > On Sep 7, 2016, at 8:46 PM, Manuel Valera <mvalera at mail.sdsu.edu> wrote:
> > >
> > >
> > > ---------- Forwarded message ----------
> > > From: Manuel Valera <mvalera at mail.sdsu.edu>
> > > Date: Wed, Sep 7, 2016 at 6:40 PM
> > > Subject: Re: [petsc-users] Sorted CSR Matrix and Multigrid PC.
> > > To:
> > > Cc: PETSc users list <petsc-users at mcs.anl.gov>
> > >
> > >
> > > Hello,
> > >
> > > I was able to sort the data but the PCGAMG does not seem  to be working.
> > >
> > > I reconfigured everything from scratch as suggested and updated to the latest PETSc version, same results,
> > >
> > > I get the following error:
> > >
> > > [0]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation, probably memory access out of range
> > > [...]
> > > [0]PETSC ERROR: ---------------------  Stack Frames ------------------------------------
> > > [0]PETSC ERROR: Note: The EXACT line numbers in the stack are not available,
> > > [0]PETSC ERROR:       INSTEAD the line number of the start of the function
> > > [0]PETSC ERROR:       is given.
> > > [0]PETSC ERROR: [0] PetscStrcmp line 524 /home/valera/sergcemv4/bitbucket/serucoamv4/petsc-3.7.3/src/sys/utils/str.c
> > > [0]PETSC ERROR: [0] PetscFunctionListFind_Private line 352 /home/valera/sergcemv4/bitbucket/serucoamv4/petsc-3.7.3/src/sys/dll/reg.c
> > > [0]PETSC ERROR: [0] PCGAMGSetType_GAMG line 1157 /home/valera/sergcemv4/bitbucket/serucoamv4/petsc-3.7.3/src/ksp/pc/impls/gamg/gamg.c
> > > [0]PETSC ERROR: [0] PCGAMGSetType line 1102 /home/valera/sergcemv4/bitbucket/serucoamv4/petsc-3.7.3/src/ksp/pc/impls/gamg/gamg.c
> > > [0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------
> > > ....
> > >
> > > You can find the working program attached, sorry for the large files and messy makefile,
> > >
> > > Many thanks,
> > >
> > > Manuel Valera.
> > >
> > >
> > > ​
> > >  MGpetscSolver.tar.gz
> > > ​
> > >
> >
> 
> 



More information about the petsc-users mailing list