Re: [petsc-dev] MATOP_MAT_MULT

2020-05-14 Thread Jose E. Roman
I think this will be useful for SLEPc as it is now, but cannot test it because some changes are required in SLEPc. I will try to find time to implement them in the coming days. Jose > El 12 may 2020, a las 17:28, Pierre Jolivet > escribió: > > MatShellSetMatProductOperation looks really nice

Re: [petsc-dev] MATOP_MAT_MULT

2020-05-12 Thread Pierre Jolivet
MatShellSetMatProductOperation looks really nice to me, thanks! Pierre > On 12 May 2020, at 12:13 PM, Stefano Zampini > wrote: > > Pierre and Jose > > I have added support for MatMat callbacks operations for MATSHELL, you may > want to take a look here for how to use it > https://gitlab.com/

Re: [petsc-dev] MATOP_MAT_MULT

2020-05-12 Thread Stefano Zampini
Pierre and Jose I have added support for MatMat callbacks operations for MATSHELL, you may want to take a look here for how to use it https://gitlab.com/petsc/petsc/-/merge_requests/2712/diffs?commit_id=7f809910e2bafe055242a87d70afd114664ffaf8 This is the relevant commit https://gitlab.com/petsc/p

Re: [petsc-dev] MATOP_MAT_MULT

2020-05-10 Thread Stefano Zampini
> On May 10, 2020, at 8:56 PM, Jose E. Roman wrote: > > > >> El 10 may 2020, a las 19:42, Stefano Zampini >> escribió: >> >> Glad to hear it works. Anyway, without the MatShellVecSetType call the code >> was erroring for me, not leaking memory. >> Where you also providing -vec_type cuda a

Re: [petsc-dev] MATOP_MAT_MULT

2020-05-10 Thread Jose E. Roman
> El 10 may 2020, a las 19:42, Stefano Zampini > escribió: > > Glad to hear it works. Anyway, without the MatShellVecSetType call the code > was erroring for me, not leaking memory. > Where you also providing -vec_type cuda at command line or what? > Mark recently noted a similar leak, and

Re: [petsc-dev] MATOP_MAT_MULT

2020-05-10 Thread Stefano Zampini
Glad to hear it works. Anyway, without the MatShellVecSetType call the code was erroring for me, not leaking memory. Where you also providing -vec_type cuda at command line or what? Mark recently noted a similar leak, and I was wondering what was the cause for yours. A MWE would be great. BTW,

Re: [petsc-dev] MATOP_MAT_MULT

2020-05-10 Thread Jose E. Roman
Thanks for the hints. I have modified my branch. I was missing the MatShellSetVecType() call. Now everything works fine and all tests are clean. Jose > El 9 may 2020, a las 21:32, Stefano Zampini > escribió: > > Jose > > I have just pushed an updated example with the MatMat operation, and I

Re: [petsc-dev] MATOP_MAT_MULT

2020-05-09 Thread Stefano Zampini
Jose I have just pushed an updated example with the MatMat operation, and I do not see the memory leak. Can you check? zampins@jasmine:~/petsc$ make -f gmakefile.test test search='mat%' searchin='ex69' PETSC_OPTIONS='-malloc -malloc_dump -malloc_debug' /usr/bin/python /home/zampins/petsc/confi

Re: [petsc-dev] MATOP_MAT_MULT

2020-05-09 Thread Jose E. Roman
> El 9 may 2020, a las 20:00, Stefano Zampini > escribió: > > > > Il giorno sab 9 mag 2020 alle ore 19:43 Jose E. Roman ha > scritto: > > > > El 9 may 2020, a las 12:45, Stefano Zampini > > escribió: > > > > Jose > > > > I have just pushed a test > > https://gitlab.com/petsc/petsc/-

Re: [petsc-dev] MATOP_MAT_MULT

2020-05-09 Thread Stefano Zampini
Il giorno sab 9 mag 2020 alle ore 19:43 Jose E. Roman ha scritto: > > > > El 9 may 2020, a las 12:45, Stefano Zampini > escribió: > > > > Jose > > > > I have just pushed a test > https://gitlab.com/petsc/petsc/-/blob/d64c2bc63c8d5d1a8c689f1abc762ae2722bba26/src/mat/tests/ex69.c > > See if it fit

Re: [petsc-dev] MATOP_MAT_MULT

2020-05-09 Thread Jose E. Roman
> El 9 may 2020, a las 12:45, Stefano Zampini > escribió: > > Jose > > I have just pushed a test > https://gitlab.com/petsc/petsc/-/blob/d64c2bc63c8d5d1a8c689f1abc762ae2722bba26/src/mat/tests/ex69.c > See if it fits your framework, and feel free to modify the test to add more > checks Alm

Re: [petsc-dev] MATOP_MAT_MULT

2020-05-09 Thread Pierre Jolivet
Hong, I also removed a couple of deprecated MATOP there https://gitlab.com/petsc/petsc/-/merge_requests/2786 If you git grep MATOP_TRANSPOSE_MAT_MULT, you’ll see that there are still some remaining in src/tao/constrained/impls/admm/admm.c Ac

Re: [petsc-dev] MATOP_MAT_MULT

2020-05-09 Thread Stefano Zampini
Hong you may want to take a look at this big commit here https://gitlab.com/petsc/petsc/-/merge_requests/2712/diffs?commit_id=94a81e695f30a0ff4a14c0eb596e09393f9b329f Now that you coded MatProduct, I think it is the case of not playing with the destroy/view routines anymore in the various MatMat

Re: [petsc-dev] MATOP_MAT_MULT

2020-05-09 Thread Stefano Zampini
Jose I have just pushed a test https://gitlab.com/petsc/petsc/-/blob/d64c2bc63c8d5d1a8c689f1abc762ae2722bba26/src/mat/tests/ex69.c See if it fits your framework, and feel free to modify the test to add more checks Il giorno ven 8 mag 2020 alle ore 18:48 Jose E. Roman ha scritto: > Attached. Ru

Re: [petsc-dev] MATOP_MAT_MULT

2020-05-08 Thread Jose E. Roman
Attached. Run with -test 1 or -test 2 > El 8 may 2020, a las 17:14, Stefano Zampini > escribió: > > Jose > > Just send me a MWE and I’ll fix the case for you > > Thanks > Stefano ex1.c Description: Binary data

Re: [petsc-dev] MATOP_MAT_MULT

2020-05-08 Thread Stefano Zampini
t;>>>>> table (they are still listed in petscmat.h -- an overlook, I'll remove >>>>>> them). >>>>>> MATOP_MAT_MULT_SYMBOLIC/NUMERIC ... are still in the table. >>>>>> 2) MatHasOperation(C,...) must be called for the matri

Re: [petsc-dev] MATOP_MAT_MULT

2020-05-08 Thread Jose E. Roman
ULL,&C); > >>>> MatProductSetType(C,...); > >>>> ... > >>>> MatProductSetFromOptions(); //if the product is not supported for the > >>>> given mat types, currently petsc crashes here, which we can replace with > >&g

Re: [petsc-dev] MATOP_MAT_MULT

2020-05-07 Thread Stefano Zampini
asOperation(C,MATOP_MAT_MULT,&flg) > >>>> > >>>> Question: how to call MatHasOperation(C,..) when MatProductSymbloc() > is not supported? > >>>> > >>>> My fix to this bug: > >>>> Resume MatSetType() in MatProductSetFromOp

Re: [petsc-dev] MATOP_MAT_MULT

2020-05-06 Thread Stefano Zampini
;flg) >>>> >>>> Question: how to call MatHasOperation(C,..) when MatProductSymbloc() is >>>> not supported? >>>> >>>> My fix to this bug: >>>> Resume MatSetType() in MatProductSetFromOptions(). Then user calls: >>>>

Re: [petsc-dev] MATOP_MAT_MULT

2020-05-06 Thread Stefano Zampini
>>> Question: how to call MatHasOperation(C,..) when MatProductSymbloc() is >>>> not supported? >>>> >>>> My fix to this bug: >>>> Resume MatSetType() in MatProductSetFromOptions(). Then user calls: >>>> >>>> MatProductCr

Re: [petsc-dev] MATOP_MAT_MULT

2020-05-06 Thread Jose E. Roman
Create(A,B,NULL,&C); >>> MatProductSetType(C,...); >>> ... >>> MatProductSetFromOptions(C); //if the product is not supported for the >>> given mat types, C->ops->productsymbolic=NULL; >>> MatHasOperation(C,MATOP_PRODUCTSYMBOLIC,&flg); >>>

Re: [petsc-dev] MATOP_MAT_MULT

2020-05-06 Thread Stefano Zampini
ednesday, May 6, 2020 2:09 AM > *To:* Zhang, Hong > *Cc:* Pierre Jolivet ; Jose E. Roman < > jro...@dsic.upv.es>; petsc-dev ; Smith, Barry F. < > bsm...@mcs.anl.gov> > *Subject:* Re: [petsc-dev] MATOP_MAT_MULT > > Hong > > If the product is not supported, the ty

Re: [petsc-dev] MATOP_MAT_MULT

2020-05-06 Thread Pierre Jolivet
gt;>MatDestroy(&C); >> ... >> } >> >> Either you take care of this bug report, or let me know your thoughts about >> how to fix this bug. >> Hong >> From: Zhang, Hong mailto:hzh...@mcs.anl.gov>> >> Sent: Saturday, April 25, 2020 2:40 PM >

Re: [petsc-dev] MATOP_MAT_MULT

2020-05-06 Thread Stefano Zampini
} > > Either you take care of this bug report, or let me know your thoughts > about how to fix this bug. > Hong > -- > *From:* Zhang, Hong > *Sent:* Saturday, April 25, 2020 2:40 PM > *To:* Pierre Jolivet > *Cc:* Jose E. Roman ; Stefano Zampin

Re: [petsc-dev] MATOP_MAT_MULT

2020-05-06 Thread Zhang, Hong via petsc-dev
Stefano, How about you work on this issue? Hong From: Stefano Zampini Sent: Wednesday, May 6, 2020 2:09 AM To: Zhang, Hong Cc: Pierre Jolivet ; Jose E. Roman ; petsc-dev ; Smith, Barry F. Subject: Re: [petsc-dev] MATOP_MAT_MULT Hong If the product is not

Re: [petsc-dev] MATOP_MAT_MULT

2020-05-06 Thread Stefano Zampini
roy(&C); >... > } > > Either you take care of this bug report, or let me know your thoughts about > how to fix this bug. > Hong > From: Zhang, Hong > Sent: Saturday, April 25, 2020 2:40 PM > To: Pierre Jolivet > Cc: Jose E. Roman ; Stefano Zampini > ; pet

Re: [petsc-dev] MATOP_MAT_MULT

2020-05-05 Thread Zhang, Hong via petsc-dev
om: Zhang, Hong Sent: Saturday, April 25, 2020 2:40 PM To: Pierre Jolivet Cc: Jose E. Roman ; Stefano Zampini ; petsc-dev ; Smith, Barry F. Subject: Re: [petsc-dev] MATOP_MAT_MULT Pierre, When we do MatProductCreate: C = A*B; //C owns A and B, thus B->refct =2 MatProductCreateWithMats:

Re: [petsc-dev] MATOP_MAT_MULT

2020-04-25 Thread Zhang, Hong via petsc-dev
n. Let me know if you have better solution. See ex109.c and ex195.c for tests. Hong From: Pierre Jolivet Sent: Saturday, April 25, 2020 11:45 AM To: Zhang, Hong Cc: Jose E. Roman ; Stefano Zampini ; petsc-dev ; Smith, Barry F. Subject: Re: [petsc-dev] MATOP_

Re: [petsc-dev] MATOP_MAT_MULT

2020-04-25 Thread Pierre Jolivet
Hong, José didn’t report this, though he may have run into the same issue, I did. I’ll try the branch and get back at you on GitLab MR. Thanks, Pierre > On 25 Apr 2020, at 6:17 PM, Zhang, Hong wrote: > > Jose, > > >> I also now just tested some previously PETSC_VERSION_LT(3,13,0) running > >>

Re: [petsc-dev] MATOP_MAT_MULT

2020-04-25 Thread Zhang, Hong via petsc-dev
Jose, >> I also now just tested some previously PETSC_VERSION_LT(3,13,0) running code >> with C=A*B, Dense=Nest*Dense, all previously allocated prior to a call to >> MatMatMult and scall = MAT_REUSE_MATRIX. >> Sadly, it’s now broken. It is my fault for not having a test for this in >> https://g

Re: [petsc-dev] MATOP_MAT_MULT

2020-04-23 Thread Zhang, Hong via petsc-dev
I'll try to do it in maint. Hong From: Jose E. Roman Sent: Thursday, April 23, 2020 2:36 AM To: Pierre Jolivet Cc: Zhang, Hong ; Stefano Zampini ; petsc-dev ; Smith, Barry F. Subject: Re: [petsc-dev] MATOP_MAT_MULT I agree with Pierre. However, if th

Re: [petsc-dev] MATOP_MAT_MULT

2020-04-23 Thread Jose E. Roman
n master, is ok? >> Hong >> >> From: Pierre Jolivet >> Sent: Wednesday, April 22, 2020 3:08 PM >> To: Zhang, Hong >> Cc: Jose E. Roman ; Stefano Zampini >> ; petsc-dev ; Smith, Barry >> F. >> Subject: Re: [petsc-dev] MATOP_MAT_MULT >> >&

Re: [petsc-dev] MATOP_MAT_MULT

2020-04-22 Thread Pierre Jolivet
gt; > Jose, > I'll check and fix them. I have to do it in master, is ok? > Hong > > From: Pierre Jolivet > Sent: Wednesday, April 22, 2020 3:08 PM > To: Zhang, Hong > Cc: Jose E. Roman ; Stefano Zampini > ; petsc-dev ; Smith, Barry > F. > Subject: Re: [petsc-

Re: [petsc-dev] MATOP_MAT_MULT

2020-04-22 Thread Zhang, Hong via petsc-dev
Jose, I'll check and fix them. I have to do it in master, is ok? Hong From: Pierre Jolivet Sent: Wednesday, April 22, 2020 3:08 PM To: Zhang, Hong Cc: Jose E. Roman ; Stefano Zampini ; petsc-dev ; Smith, Barry F. Subject: Re: [petsc-dev] MATOP_MAT_MULT

Re: [petsc-dev] MATOP_MAT_MULT

2020-04-22 Thread Pierre Jolivet
#x27; gives the name of > MatProductSetFromOptions_xxx, (including basic implementation) or NULL. > > Let me know your suggestions. I'll list all of you as reviewer. > Hong > > From: Jose E. Roman > Sent: Wednesday, April 22, 2020 9:07 AM > To: Stefano Zampini >

Re: [petsc-dev] MATOP_MAT_MULT

2020-04-22 Thread Zhang, Hong via petsc-dev
g, Hong ; Pierre Jolivet ; petsc-dev Subject: Re: [petsc-dev] MATOP_MAT_MULT I agree with Pierre and Stefano. Hong: your proposed solution would be fine, but MATOP_MATPRODUCT does not exist yet, so I cannot try it. I would like a solution along the lines of what Stefano suggests. It is not too

Re: [petsc-dev] MATOP_MAT_MULT

2020-04-22 Thread Zhang, Hong via petsc-dev
petsc-dev mailto:petsc-dev@mcs.anl.gov>> Subject: Re: [petsc-dev] MATOP_MAT_MULT On 21 Apr 2020, at 5:22 PM, Zhang, Hong mailto:hzh...@mcs.anl.gov>> wrote: Pierre, MatMatMult_xxx() is removed from MatOps table. Shouldn’t there be a deprecation notice somewhere? There is nothin

Re: [petsc-dev] MATOP_MAT_MULT

2020-04-22 Thread Jose E. Roman
tDestroy(Wmat); >> ... >> } >> Hong >> >> >> From: Jose E. Roman >> Sent: Tuesday, April 21, 2020 11:21 AM >> To: Pierre Jolivet >> Cc: Zhang, Hong ; petsc-dev >> Subject: Re: [petsc-dev] MATOP_MAT_MULT >> >> >>

Re: [petsc-dev] MATOP_MAT_MULT

2020-04-22 Thread Stefano Zampini
lementation available. > if (V->vmm && flg) { > MatProductSymbolic(Wmat); > MatProductNumeric(Wmat); > } else { > MatDestroy(Wmat); > ... > } > Hong > > > From: Jose E. Roman > Sent: Tuesday, April 21, 2020 11:21 AM > To: Pierre Jolivet >

Re: [petsc-dev] MATOP_MAT_MULT

2020-04-21 Thread Pierre Jolivet
> Sent: Tuesday, April 21, 2020 10:53 AM > To: Zhang, Hong > Cc: petsc-dev > Subject: Re: [petsc-dev] MATOP_MAT_MULT > > > >> On 21 Apr 2020, at 5:22 PM, Zhang, Hong > <mailto:hzh...@mcs.anl.gov>> wrote: >> >> Pierre, >> MatMatMult_xxx()

Re: [petsc-dev] MATOP_MAT_MULT

2020-04-21 Thread Zhang, Hong via petsc-dev
my A is of type SBAIJ, for which there is no > MatMatMult, the code will now error out in the MatProduct? > There is no fallback mechanism? Meaning I could in fact _not_ use the new API > and will just have to loop on all columns of B, even for AIJ matrices. > > Thanks, > Pierr

Re: [petsc-dev] MATOP_MAT_MULT

2020-04-21 Thread Zhang, Hong via petsc-dev
, Hong Cc: petsc-dev Subject: Re: [petsc-dev] MATOP_MAT_MULT On 21 Apr 2020, at 5:22 PM, Zhang, Hong mailto:hzh...@mcs.anl.gov>> wrote: Pierre, MatMatMult_xxx() is removed from MatOps table. Shouldn’t there be a deprecation notice somewhere? There is nothing about MATOP_MAT_MULT in th

Re: [petsc-dev] MATOP_MAT_MULT

2020-04-21 Thread Jose E. Roman
> MatMatMult, the code will now error out in the MatProduct? > There is no fallback mechanism? Meaning I could in fact _not_ use the new API > and will just have to loop on all columns of B, even for AIJ matrices. > > Thanks, > Pierre > >> Hong >> >> Fr

Re: [petsc-dev] MATOP_MAT_MULT

2020-04-21 Thread Pierre Jolivet
es. Thanks, Pierre > Hong > > From: petsc-dev on behalf of Pierre Jolivet > > Sent: Tuesday, April 21, 2020 7:50 AM > To: petsc-dev > Subject: [petsc-dev] MATOP_MAT_MULT > > Hello, > Am I seeing this correctly? > #include > > int main(int argc,char **

Re: [petsc-dev] MATOP_MAT_MULT

2020-04-21 Thread Zhang, Hong via petsc-dev
From: petsc-dev on behalf of Pierre Jolivet Sent: Tuesday, April 21, 2020 7:50 AM To: petsc-dev Subject: [petsc-dev] MATOP_MAT_MULT Hello, Am I seeing this correctly? #include int main(int argc,char **args) { Mat A; PetscBool hasMatMult

[petsc-dev] MATOP_MAT_MULT

2020-04-21 Thread Pierre Jolivet
Hello, Am I seeing this correctly? #include int main(int argc,char **args) { Mat A; PetscBool hasMatMult; PetscErrorCodeierr; ierr = PetscInitialize(&argc,&args,NULL,NULL);if (ierr) return ierr; ierr = MatCreate(PETSC_COMM_WORLD,&A);CHKERRQ(ierr); ierr = Mat