[petsc-users] Insering rows vs inserting columns

Bartłomiej W bartlomiej.wach at yahoo.pl
Wed May 25 19:48:07 CDT 2011


Hello,

I have a slight problem with performance of matsetvalues when inserting values row-by-row on single processor instead of column-by-column.

     ierr = MatCreate(PETSC_COMM_WORLD,&L);
     ierr = MatSetSizes(L,PETSC_DECIDE,PETSC_DECIDE,n,n);
     ierr = MatSetFromOptions(L);
     MatSeqAIJSetPreallocation(L,PETSC_NULL,nnz);

    (...)     

     MatSetValues(L,rows,indices_y,1,&col,values,INSERT_VALUES);
vs     
     MatSetValues(L,1,&row,cols,indices_x,values,INSERT_VALUES);

First way goes quick and gives me mallocs in matsetvalues = 0 in -info
While the second one takes much longer and does mallocs.

Why is it so that inserting rows is slower than inserting columns when proper nnz was provided? Or maybe there is my mistake here somewhere? 

Regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20110526/d51a3a55/attachment.htm>


More information about the petsc-users mailing list