[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

further about PCComputeExplicitOperator()



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:
1563 if (size == 1) {
1564 //05/01/08
1565 //ierr = MatSetType(*mat,MATSEQDENSE);CHKERRQ(ierr);
1566 //ierr = MatSeqDenseSetPreallocation(*mat,PETSC_NULL);CHKERRQ(ierr);
1567 ierr = MatSetType(*mat,MATSEQAIJ);CHKERRQ(ierr);
1568 ierr = MatSeqAIJSetPreallocation(*mat,0,PETSC_NULL);CHKERRQ(ierr);
1569
1570 } else {
1571 ierr = MatSetType(*mat,MATMPIAIJ);CHKERRQ(ierr);
1572 ierr = MatMPIAIJSetPreallocation(*mat,0,PETSC_NULL,0,PETSC_NULL);CHKERRQ(ierr);
1573 }

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
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.
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. 

the version of PETSc is 2.3.3-p8.

thanks a lot.

Regards,
Yujie