[petsc-users] To slow just in first step of SNES

Barry Smith bsmith at mcs.anl.gov
Sun Dec 18 13:19:08 CST 2011


  Run with -info and search for malloc this will show you if you have not preallocated enough space.

  You can put this in the code after you preallocate the matrix but before calling MatAssembly and it will stop as soon as it needs to malloc more memory during MatSetValues() showing you have not properly preallocated  MatSetOption(Mat A,MAT NO NEW NONZERO LOCATIONS,PETSC TRUE);

  Barry


On Dec 18, 2011, at 1:11 PM, behzad baghapour wrote:

> Dear Developers,
> 
> I tried to following optimized matrix data setup for a block-sparse mat solver but when I run the code, too much time is taken "just" for the first step of SNES procedure (about 20 to 30 times than the next steps ?! ).
> 
> I did above as follows:
> 
> 1- Allocate matrix( matrices ):
> 
> MatSetType ( JAC, MATSEQBAIJ );
> MatSetSizes ( JAC, PETSC_DECIDE, PETSC_DECIDE, nt, nt );    
> MatSeqBAIJSetPreallocation ( JAC, tot, 0, nnz );
> MatSetFromOptions ( JAC );
> 
> where nnz[] is account regarded to connectivity
> 
> 2- Matrix Data calculation:
> 
> MatSetValues( JAC, tot, IDX, tot, JDX, VAL, ADD_VALUES );
> 
> where IDX, JDX, VAL are blocks of data with size tot.
> 
> 3- Did the same for preconditioning matrix.
> 
> 4- used PCILU for preconditioning.
> 
> I also print out log_summary but I actually can't find out if I set the memory optimized ( I don't no how to follow the logfile and check what parameters ).
> 
> Please let me know how would be the failure in my procedure...
> 
> Thanks a lot,
> BehZad
> 



More information about the petsc-users mailing list