[petsc-users] -log_summary problem

Barry Smith bsmith at mcs.anl.gov
Tue Jan 3 22:08:25 CST 2012


  Max,

    If you have a stand alone PETSc program that ONLY does the randomcreate/destroy (between the PetscInitialize/Finalize()) does it still hang?

    Suggest running under valgrind to determine if memory corruption is the cause. http://www.mcs.anl.gov/petsc/documentation/faq.html#valgrind

   Barry


On Jan 3, 2012, at 9:57 PM, Max Rudolph wrote:

>> On Tue, Dec 20, 2011 at 19:35, Max Rudolph <rudolph at berkeley.edu> wrote:
>> When I run my code with the -log_summary option, it hangs indefinitely after displaying:
>> 
>> ========================================================================================================================
>> Average time to get PetscTime(): 9.53674e-08
>> Average time for MPI_Barrier(): 0.00164938
>> 
>> Is this a common problem, and if so, how do I fix it? This does not happen when I run the example programs - only my own code, so I must be at fault but without an error message I am not sure where to start. I am using petsc-3.1-p7. Thanks for your help.
>> 
>> Are all processes calling PetscFinalize()?
>> 
>> How did you set -log_summary? It should be provided at the time you invoke PetscInitialize() on all processes.
>> 
>> Try running in a debugger, then break when it hangs and print the stack trace.
> 
> I found the problem, or at least a workaround. I have a PetscRandom and freed it in the second to last line of my main subroutine:
> 	...
>   ierr=  PetscRandomCreate(PETSC_COMM_WORLD, &r);CHKERRQ(ierr);
>   ierr = PetscRandomSetType(r,PETSCRAND48);CHKERRQ(ierr);
> 	...
>   ierr = PetscRandomDestroy( r );CHKERRQ(ierr);
>   ierr = PetscFinalize();
> }
> 
> If I comment out the line with PetscRandomDestroy, -log_summary seems to work.
> 
> Max



More information about the petsc-users mailing list