extremly slow MatSetValues
Matthew Knepley
knepley at gmail.com
Sun Sep 20 12:49:53 CDT 2009
Your matrix is not correctly preallocated:
http://www.mcs.anl.gov/petsc/petsc-as/documentation/faq.html#slow
Matt
On Sun, Sep 20, 2009 at 10:44 AM, Pierre-Yves Aquilanti <sperif at gmail.com>wrote:
> 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
>
--
What most experimenters take for granted before they begin their experiments
is infinitely more interesting than any results to which their experiments
lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20090920/f254bf42/attachment.htm>
More information about the petsc-users
mailing list