[petsc-users] a strange bug on using DMDA_STENCIL_BOX

Barry Smith bsmith at mcs.anl.gov
Thu Jul 10 20:23:43 CDT 2014


  The directions are there

	• run with valgrind using: ${PETSC_DIR}/bin/petscmpiexec -valgrind -n NPROC PETSCPROGRAMNAME -malloc off PROGRAMOPTIONS
	• or invoke valgrind directly with: mpiexec -n NPROC valgrind --tool=memcheck -q --num-callers=20 --log-file=valgrind.log.%p PETSCPROGRAMNAME -malloc off PROGRAMOPTIONS

  you used 1/2 of the first direction and 1/2 of the second direction. So Use either the first or the second, don’t mix them together. Note the first one has ${PETSC_DIR}/bin/petscmpiexec instead of mpiexec.

  Barry



On Jul 10, 2014, at 8:16 PM, Sun, Hui <hus003 at ucsd.edu> wrote:

> I don't know how to use valgrind. I followed your link to add these lines into the makefile:
> runtest29:
>        -@${MPIEXEC} -valgrind -n 1 test_29 -malloc off -da_grid_x 6 -da_grid_y 6 -ksp_type bcgs -ksp_monitor_short -ksp_converged_reason
> 
> However when I run make runtest29, it gives me errors:
> [mpiexec at Huis-MacBook-Pro.local] match_arg (./utils/args/args.c:160): unrecognized argument valgrind
> [mpiexec at Huis-MacBook-Pro.local] HYDU_parse_array (./utils/args/args.c:175): argument matching returned error
> [mpiexec at Huis-MacBook-Pro.local] parse_args (./ui/mpich/utils.c:1609): error parsing input array
> [mpiexec at Huis-MacBook-Pro.local] HYD_uii_mpx_get_parameters (./ui/mpich/utils.c:1660): unable to parse user arguments
> [mpiexec at Huis-MacBook-Pro.local] main (./ui/mpich/mpiexec.c:153): error parsing parameters
> make: [runtest29] Error 255 (ignored)
> 
> 
> ________________________________________
> From: Barry Smith [bsmith at mcs.anl.gov]
> Sent: Thursday, July 10, 2014 5:54 PM
> To: Sun, Hui
> Cc: petsc-users at mcs.anl.gov
> Subject: Re: [petsc-users] a strange bug on using DMDA_STENCIL_BOX
> 
>  Your interpretation is correct. If DMDA_STENTIL_STAR works then one absolutely expects that DMDA_STENTIL_BOX would produce the same answer.  If you are running with linux could you run with valgrind to see if there is some strange memory corruption or lack of initialization http://www.mcs.anl.gov/petsc/documentation/faq.html#valgrind
> 
>   What happens with -ksp_monitor on both cases? Same convergence history or different?
> 
>   Barry
> 
> 
> 
> On Jul 10, 2014, at 7:49 PM, Sun, Hui <hus003 at ucsd.edu> wrote:
> 
>> I'm using KSP for 2D Navier Stokes, finite difference. I have DM object created with DMDA_STENTIL_STAR. I'm only using one single process to run the code. It works fine, the linear system converges to the correct solution with correct order, as expected. However, if I change it to DMDA_STENTIL_BOX, it does not converge, the residue \|Ax-b\|_2 remains large.
>> 
>> I have checked that the rhs for both cases are exactly the same, and the matrices also seem to be the same because I have checked the output of A*y, where y is the analytic solution, and both cases give exactly the same answer. If the linear system is exactly the same, then it seems very strange to me that DMDA_STENTIL_STAR works while DMDA_STENTIL_BOX does not work, for I use the same solver, there shouldn't be any difference.
>> 
>> If you happen to encounter this kind of bug before and have some idea what's going on, please let me know. Thank you very much! If you want to look at the code I've written, feel free to ask.
> 



More information about the petsc-users mailing list