Re: [petsc-dev] Suggestions for MatProductCreate()

2020-03-27 Thread Lisandro Dalcin
On Fri, 27 Mar 2020 at 05:09, h...@aspiritech.org wrote: > Lisandro, > >> As I said in previous emails, I'm not complaining about the API, I said >> it was a welcome adition. All I'm asking is: >> >> 1) Fix the handling of reference counting. This is an implementation >> detail, not really an AP

Re: [petsc-dev] Suggestions for MatProductCreate()

2020-03-24 Thread Lisandro Dalcin
On Tue, 24 Mar 2020 at 05:02, hzh...@mcs.anl.gov wrote: > Matt and Lisandro, > Let me explain a little more about new API for mat-mat operations, which > include MatMaMult (AB), MatPtAP (PtAP), MatMatMatMult (ABC), with a total 6 > matproduct types. > > 1) MatProduct is logically similar to MatFa

Re: [petsc-dev] Suggestions for MatProductCreate()

2020-03-23 Thread hzhang--- via petsc-dev
Matt and Lisandro, Let me explain a little more about new API for mat-mat operations, which include MatMaMult (AB), MatPtAP (PtAP), MatMatMatMult (ABC), with a total 6 matproduct types. 1) MatProduct is logically similar to MatFactor, not a single Mat. Calling MatProductCreate(A,B,NULL,&D); MatPro

Re: [petsc-dev] Suggestions for MatProductCreate()

2020-03-23 Thread Matthew Knepley
On Mon, Mar 23, 2020 at 5:12 PM Lisandro Dalcin wrote: > > > On Mon, 23 Mar 2020 at 17:57, hzh...@mcs.anl.gov > wrote: > >> Lisandro: >> >>> MatProductSetFromOptions() is not really setting any options. It looks >>> like the correct name for this API is MatProductSetUp(). In any case, it >>> loo

Re: [petsc-dev] Suggestions for MatProductCreate()

2020-03-23 Thread Lisandro Dalcin
On Mon, 23 Mar 2020 at 17:57, hzh...@mcs.anl.gov wrote: > Lisandro: > >> MatProductSetFromOptions() is not really setting any options. It looks >> like the correct name for this API is MatProductSetUp(). In any case, it >> looks like both SetFromOptions() and SetUp() should be provided. >> > > No

Re: [petsc-dev] Suggestions for MatProductCreate()

2020-03-23 Thread Lisandro Dalcin
On Mon, 23 Mar 2020 at 17:52, hzh...@mcs.anl.gov wrote: > Lisandro: > >> * Please consider fixing MatProductCreate(A,B,C,&D) to take ownership >> (that is, increase reference count) of the A,B, and the (optional) C >> matrices provided as arguments. Otherwise it is way easy to get into the >> dan

Re: [petsc-dev] Suggestions for MatProductCreate()

2020-03-23 Thread Patrick Sanan
You can put whatever message you like when you deprecate the function, so perhaps here you could leave the old functions and say something like PETSC_DEPRECATED_FUNCTION("Use X() and Y() (since version 3.13)") PetscErrorCode

Re: [petsc-dev] Suggestions for MatProductCreate()

2020-03-23 Thread hzhang--- via petsc-dev
Lisandro: > MatProductSetFromOptions() is not really setting any options. It looks > like the correct name for this API is MatProductSetUp(). In any case, it > looks like both SetFromOptions() and SetUp() should be provided. > Not all product and matrix types enable algorithmic options. For those

Re: [petsc-dev] Suggestions for MatProductCreate()

2020-03-23 Thread Satish Balay via petsc-dev
On Mon, 23 Mar 2020, hzhang--- via petsc-dev wrote: > Lisandro: > > > * Please consider fixing MatProductCreate(A,B,C,&D) to take ownership > > (that is, increase reference count) of the A,B, and the (optional) C > > matrices provided as arguments. Otherwise it is way easy to get into the > > dan

Re: [petsc-dev] Suggestions for MatProductCreate()

2020-03-23 Thread hzhang--- via petsc-dev
Lisandro: > * Please consider fixing MatProductCreate(A,B,C,&D) to take ownership > (that is, increase reference count) of the A,B, and the (optional) C > matrices provided as arguments. Otherwise it is way easy to get into the > dangling pointer trap. > Can you give me a simple example of " get i

Re: [petsc-dev] Suggestions for MatProductCreate()

2020-03-22 Thread Lisandro Dalcin
MatProductSetFromOptions() is not really setting any options. It looks like the correct name for this API is MatProductSetUp(). In any case, it looks like both SetFromOptions() and SetUp() should be provided. On Mon, 23 Mar 2020 at 01:48, Lisandro Dalcin wrote: > * Please consider fixing MatProd

[petsc-dev] Suggestions for MatProductCreate()

2020-03-22 Thread Lisandro Dalcin
* Please consider fixing MatProductCreate(A,B,C,&D) to take ownership (that is, increase reference count) of the A,B, and the (optional) C matrices provided as arguments. Otherwise it is way easy to get into the dangling pointer trap. * A thing also missing in the new API is a way to "cleanup" the