extremly slow MatSetValues

Pierre-Yves Aquilanti sperif at gmail.com
Sun Sep 20 10:44:00 CDT 2009


Hello,

i'm facing a very slow MatSetValues during the discretization of my  
mathematical problem when creating the matrix.
My matrix is seven banded, come from the a discretization of an  
helmholtz problem using finite differences.

In the 2D case, creating the matrix is really fast. But in 3D case it  
goes well for the first second loop processing and then it goes really  
really slow. Here is a small part of my code :


ierr = DAGetCorners(*da, &Istartx, &Istarty, &Istartz, &Iendx, &Iendy,  
&Iendz);
     CHKERRQ(ierr);

	for (j = Istartz; j < Istartz + Iendz; j++) {

	    for(k=Istarty; k < Istarty+Iendy; k++){
		for (i = Istartx; i < Istartx + Iendx; i++) {


		/*get values on an array, their coordinate too*/

	MatSetValues(*B, 
1,ind_mat_x,value_count,ind_mat_y,val_mat_ligne,ADD_VALUES);
	}
}

Did you encounter any slowness for MatSetValues function ?

Thanks a lot

Regards


PYA


More information about the petsc-users mailing list