[petsc-dev] MatNest and MatCreateHermitianTranspose

Pierre Jolivet pierre.jolivet at enseeiht.fr
Sat Oct 20 07:51:32 CDT 2018


Hello Stefano,

> On 20 Oct 2018, at 9:22 AM, Stefano Zampini <stefano.zampini at gmail.com> wrote:
> 
> Pierre,
> 
> Thanks to report this. I think this should be fixed in MatHermitianTransposeAdd. Would you like to open a PR?

Done.
Thanks,
Pierre

> Thanks
> Stefani
> 
> Il Sab 20 Ott 2018, 08:16 Pierre Jolivet <pierre.jolivet at enseeiht.fr <mailto:pierre.jolivet at enseeiht.fr>> ha scritto:
> Hello,
> I’m using a MatNest with some blocks made of matrices created with MatCreateHermitianTranspose. I end up with the following trace when doing a simple MatMult.
> Should this be fixed in matnest.c, matrix.c or htransm.c?
> 
> Thanks,
> Pierre
> 
> (lldb) down
> frame #11: 0x000000011ad06830 libpetsc.3.010.dylib`MatMult_Nest(A=0x00007fcc2eb50260, x=0x00007fcc2f019460, y=0x00007fcc2f01ca60) at matnest.c:52
>    49       for (j=0; j<nc; j++) {
>    50         if (!bA->m[i][j]) continue;
>    51         /* y[i] <- y[i] + A[i][j] * x[j] */
> -> 52         ierr = MatMultAdd(bA->m[i][j],bx[j],by[i],by[i]);CHKERRQ(ierr);
>    53       }
>    54     }
>    55     for (i=0; i<nr; i++) {ierr = VecRestoreSubVector(y,bA->isglobal.row[i],&by[i]);CHKERRQ(ierr);}
> (lldb) 
> frame #10: 0x000000011a9d6399 libpetsc.3.010.dylib`MatMultAdd(mat=0x00007fcc2ebfde60, v1=0x00007fcc2f029c60, v2=0x00007fcc2f024660, v3=0x00007fcc2f024660) at matrix.c:2517
>    2514   if (!mat->ops->multadd) SETERRQ1(PetscObjectComm((PetscObject)mat),PETSC_ERR_SUP,"No MatMultAdd() for matrix type '%s'",((PetscObject)mat)->type_name);
>    2515   ierr = PetscLogEventBegin(MAT_MultAdd,mat,v1,v2,v3);CHKERRQ(ierr);
>    2516   ierr = VecLockPush(v1);CHKERRQ(ierr);
> -> 2517   ierr = (*mat->ops->multadd)(mat,v1,v2,v3);CHKERRQ(ierr);
>    2518   ierr = VecLockPop(v1);CHKERRQ(ierr);
>    2519   ierr = PetscLogEventEnd(MAT_MultAdd,mat,v1,v2,v3);CHKERRQ(ierr);
>    2520   ierr = PetscObjectStateIncrease((PetscObject)v3);CHKERRQ(ierr);
> (lldb) 
> frame #9: 0x000000011ad136d0 libpetsc.3.010.dylib`MatMultAdd_HT(N=0x00007fcc2ebfde60, v1=0x00007fcc2f029c60, v2=0x00007fcc2f024660, v3=0x00007fcc2f024660) at htransm.c:24
>    21     PetscErrorCode ierr;
>    22   
>    23     PetscFunctionBegin;
> -> 24     ierr = MatMultHermitianTransposeAdd(Na->A,v1,v2,v3);CHKERRQ(ierr);
>    25     PetscFunctionReturn(0);
>    26   }
>    27   
> (lldb) 
> frame #8: 0x000000011a9d88e5 libpetsc.3.010.dylib`MatMultHermitianTransposeAdd(mat=0x00007fcc2e977260, v1=0x00007fcc2f029c60, v2=0x00007fcc2f024660, v3=0x00007fcc2f024660) at matrix.c:2629
>    2626     ierr = MatMultTranspose(mat,w,z);CHKERRQ(ierr);
>    2627     ierr = VecDestroy(&w);CHKERRQ(ierr);
>    2628     ierr = VecConjugate(z);CHKERRQ(ierr);
> -> 2629     ierr = VecWAXPY(v3,1.0,v2,z);CHKERRQ(ierr);
>    2630     ierr = VecDestroy(&z);CHKERRQ(ierr);
>    2631   }
>    2632   ierr = VecLockPop(v1);CHKERRQ(ierr);
> (lldb) 
> frame #7: 0x000000011a8f33b5 libpetsc.3.010.dylib`VecWAXPY(w=0x00007fcc2f024660, alpha=1, x=0x00007fcc2f024660, y=0x00007fcc2f039260) at rvector.c:795
>    792    VecCheckSameSize(x,3,y,4);
>    793    VecCheckSameSize(x,3,w,1);
>    794    if (w == y) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Result vector w cannot be same as input vector y, suggest VecAXPY()");
> -> 795    if (w == x) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_SUP,"Result vector w cannot be same as input vector x, suggest VecAYPX()");
>    796    PetscValidLogicalCollectiveScalar(y,alpha,2);
>    797  
>    798    ierr = PetscLogEventBegin(VEC_WAXPY,x,y,w,0);CHKERRQ(ierr);
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20181020/7e13f2cf/attachment.html>


More information about the petsc-dev mailing list