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 <[email protected]> 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:
> [[email protected]] match_arg (./utils/args/args.c:160): 
> unrecognized argument valgrind
> [[email protected]] HYDU_parse_array (./utils/args/args.c:175): 
> argument matching returned error
> [[email protected]] parse_args (./ui/mpich/utils.c:1609): error 
> parsing input array
> [[email protected]] HYD_uii_mpx_get_parameters 
> (./ui/mpich/utils.c:1660): unable to parse user arguments
> [[email protected]] main (./ui/mpich/mpiexec.c:153): error 
> parsing parameters
> make: [runtest29] Error 255 (ignored)
> 
> 
> ________________________________________
> From: Barry Smith [[email protected]]
> Sent: Thursday, July 10, 2014 5:54 PM
> To: Sun, Hui
> Cc: [email protected]
> 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 <[email protected]> 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.
> 

Reply via email to