extremly slow MatSetValues

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


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,  

	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*/


Did you encounter any slowness for MatSetValues function ?

Thanks a lot



More information about the petsc-users mailing list