[petsc-users] VecValidValues() reports NaN found

linjing bo francium87 at hotmail.com
Mon May 5 08:15:38 CDT 2014


Ok, I will try it . Thanks for your advise. 

Date: Mon, 5 May 2014 08:12:05 -0500
Subject: Re: [petsc-users] VecValidValues() reports NaN found
From: knepley at gmail.com
To: francium87 at hotmail.com
CC: petsc-users at mcs.anl.gov

On Mon, May 5, 2014 at 7:56 AM, linjing bo <francium87 at hotmail.com> wrote:




I use JACOBI. The message showed is with JACOBI. 


Wired situation is that the backtrack information shows the location
 is before actually apply PC, so I guess the rhs vec is not changed at 
this point.

Another wired thing is : Because the original code is
 to complex. I write out the A matrix in Ax=b, and write a small test 
code to read in this matrix and solve it, no error showed. The KSP, PC 
are all set to be the same.

When I try to using ILU, more wired error happens, the backtrack info shows it died in a Flops logging function:

1) Run in serial until it works

2) It looks like you have memory overwriting problems. Run with valgrind
   Matt 
[2]PETSC ERROR: --------------------- Error Message ------------------------------------
[2]PETSC ERROR: Argument out of range!                                                  
[2]PETSC ERROR: Cannot log negative flops!                                              

[2]PETSC ERROR: ------------------------------------------------------------------------
[2]PETSC ERROR: Petsc Release Version 3.4.4, Mar, 13, 2014                              
[2]PETSC ERROR: See docs/changes/index.html for recent updates.                         

[2]PETSC ERROR: See docs/faq.html for hints about trouble shooting.                     
[2]PETSC ERROR: See docs/index.html for manual pages.                                   
[2]PETSC ERROR: ------------------------------------------------------------------------

[2]PETSC ERROR: ./gtc on a arch-linux2-c-debug named node2.indac.info by jlin Mon May  5 20:51:27 2014                                                                                                

[2]PETSC ERROR: Libraries linked from /opt/sfw/petsc/3.4.4/intel/openmpi/lib                       
[2]PETSC ERROR: Configure run at Sat Apr 26 20:19:41 2014                                          
[2]PETSC ERROR: Configure options --prefix=/opt/sfw/petsc/3.4.4/intel/openmpi --with-mpi-dir=/opt/sfw/openmpi/1.6.3/intel --with-blas-lapack-dir=/opt/sfw/intel/composer_xe_2011_sp1.7.256/mkl/lib/intel64 --with-mpiexec=mpiexec                                                                        

[2]PETSC ERROR: ------------------------------------------------------------------------           
[2]PETSC ERROR: PetscLogFlops() line 204 in /tmp/petsc-3.4.4/include/petsclog.h                    
[2]PETSC ERROR: MatLUFactorNumeric_SeqAIJ() line 552 in /tmp/petsc-3.4.4/src/mat/impls/aij/seq/aijfact.c                                                                                              

[2]PETSC ERROR: MatLUFactorNumeric() line 2889 in /tmp/petsc-3.4.4/src/mat/interface/matrix.c      
[2]PETSC ERROR: PCSetUp_ILU() line 232 in /tmp/petsc-3.4.4/src/ksp/pc/impls/factor/ilu/ilu.c       
[2]PETSC ERROR: PCSetUp() line 890 in /tmp/petsc-3.4.4/src/ksp/pc/interface/precon.c               

[2]PETSC ERROR: KSPSetUp() line 278 in /tmp/petsc-3.4.4/src/ksp/ksp/interface/itfunc.c             
[2]PETSC ERROR: KSPSolve() line 399 in /tmp/petsc-3.4.4/src/ksp/ksp/interface/itfunc.c             





Date: Mon, 5 May 2014 07:27:52 -0500
Subject: Re: [petsc-users] VecValidValues() reports NaN found
From: knepley at gmail.com
To: francium87 at hotmail.com

CC: petsc-users at mcs.anl.gov

On Mon, May 5, 2014 at 7:25 AM, linjing bo <francium87 at hotmail.com> wrote:








Hi, I'm trying to use PETSc's ksp method to solve a linear system. When running, Error is reported by VecValidValues() that NaN or Inf is found with error message listed below 


[3]PETSC ERROR: --------------------- Error Message ------------------------------------           


[3]PETSC ERROR: Floating point exception!                                                          
[3]PETSC ERROR: Vec entry at local location 0 is not-a-number or infinite at beginning of function: Parameter number 2!                                                                               


[3]PETSC ERROR: ------------------------------------------------------------------------           
[3]PETSC ERROR: Petsc Release Version 3.4.4, Mar, 13, 2014                                         
[3]PETSC ERROR: See docs/changes/index.html for recent updates.                                    


[3]PETSC ERROR: See docs/faq.html for hints about trouble shooting.                                
[3]PETSC ERROR: See docs/index.html for manual pages.                                              
[3]PETSC ERROR: ------------------------------------------------------------------------           


[3]PETSC ERROR: ./gtc on a arch-linux2-c-debug named node2.indac.info by jlin Mon May  5 20:03:20 2014                                                                                                


[3]PETSC ERROR: Libraries linked from /opt/sfw/petsc/3.4.4/intel/openmpi/lib                       
[3]PETSC ERROR: Configure run at Sat Apr 26 20:19:41 2014                                          
[3]PETSC ERROR: Configure options --prefix=/opt/sfw/petsc/3.4.4/intel/openmpi --with-mpi-dir=/opt/sfw/openmpi/1.6.3/intel --with-blas-lapack-dir=/opt/sfw/intel/composer_xe_2011_sp1.7.256/mkl/lib/intel64 --with-mpiexec=mpiexec                                                                        


[3]PETSC ERROR: ------------------------------------------------------------------------           
[3]PETSC ERROR: VecValidValues() line 28 in /tmp/petsc-3.4.4/src/vec/vec/interface/rvector.c  


It looks like the vector after preconditioner application is bad. What is the preconditioner?
  Matt 

     
[3]PETSC ERROR: PCApply() line 436 in /tmp/petsc-3.4.4/src/ksp/pc/interface/precon.c               
[3]PETSC ERROR: KSP_PCApply() line 227 in /tmp/petsc-3.4.4/include/petsc-private/kspimpl.h         


[3]PETSC ERROR: KSPInitialResidual() line 64 in /tmp/petsc-3.4.4/src/ksp/ksp/interface/itres.c     
[3]PETSC ERROR: KSPSolve_GMRES() line 239 in /tmp/petsc-3.4.4/src/ksp/ksp/impls/gmres/gmres.c      
[3]PETSC ERROR: KSPSolve() line 441 in /tmp/petsc-3.4.4/src/ksp/ksp/interface/itfunc.c             




After read the source code shown by backtrack informations, I realize the problem is in the right hand side vector. So I make a trial of set right hand side vector to ONE by VecSet, But the program still shows error message above, and using VecView or VecGetValue to investigate the first value of rhs vec shows the value is 1.0 as I set it to. Hope I clearly describe the problem. The code related is listed below



---------------------------Solver section--------------------------

  call VecSet( pet_bp_b, one, ierr)

  vecidx=[0,1]
  call VecGetValues( pet_bp_b, 2, vecidx, first, ierr)
  write(*,*) ' first two values ', first(1), first(2)



  call KSPSetInitialGuessNonzero(solver_bp,Petsc_True,ierr)
  call KSPSolve(solver_bp,pet_bp_b,pet_bp_x,ierr)
  call KSPView(solver_bp, PETSC_VIEWER_STDOUT_SELF,ierr)
  CHKERRQ(ierr)



 		 	   		  


-- 
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
 		 	   		  


-- 
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
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140505/5cf4b47c/attachment-0001.html>


More information about the petsc-users mailing list