when 1 processor is used, the matrix M in PCComputeExplicitOperator(pc,&M) uses MATSEQDENSE type. Now, I want to use MATSEQAIJ, I change the codes as follows:<br>1563 if (size == 1) {<br>1564 //05/01/08<br>1565 //ierr = MatSetType(*mat,MATSEQDENSE);CHKERRQ(ierr);<br>
1566 //ierr = MatSeqDenseSetPreallocation(*mat,PETSC_NULL);CHKERRQ(ierr);<br>1567 ierr = MatSetType(*mat,MATSEQAIJ);CHKERRQ(ierr);<br>1568 ierr = MatSeqAIJSetPreallocation(*mat,0,PETSC_NULL);CHKERRQ(ierr);<br>
1569 <br> 1570 } else {<br>1571 ierr = MatSetType(*mat,MATMPIAIJ);CHKERRQ(ierr);<br>1572 ierr = MatMPIAIJSetPreallocation(*mat,0,PETSC_NULL,0,PETSC_NULL);CHKERRQ(ierr);<br>1573 }<br><br>PCApply is fast when running. However, MatSetValues() is very very slow when some arraies need to set. I find that the problem likely lies in <br>
MatSeqXAIJReallocateAIJ(A,A->rmap.n,1,nrow,row,col,rmax,aa,ai,aj,rp,ap,imax,nonew,MatScalar) in MatSetValues_SeqAIJ() after debugging the codes. <br>I can't further figure out where is the problem. Because it is difficult to debug. Could you give me some advice? thanks a lot. <br>
<br>the version of PETSc is 2.3.3-p8.<br><br>thanks a lot.<br><br>Regards,<br>Yujie<br><br><br><br><br>