On Thu, 26 May 2011, Bart?omiej W wrote: > 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?
The order or the way the values are inserted shouldn't matter. As long as the correct nozero structure is provided [with nnz] - there should be no additional mallocs. you can check with MatView() to see if the matrix is anyway different in the 2 cases. Satish > > Regards >
