[petsc-dev] Broken MatMatMult_MPIAIJ_MPIDense

Smith, Barry F. bsmith at mcs.anl.gov
Mon Sep 23 10:10:14 CDT 2019


   We would like avoid allocating a huge array for the matrix and then having the user place on top of it. 

   In the new paradigm there could be options called on the resulting C of MatMatGetProduct() that would take effect before the C is fully formed to prevent the allocating and freeing for a huge array the same time as user array exists but with the current API we have for this release.



> On Sep 23, 2019, at 9:59 AM, Zhang, Hong <hzhang at mcs.anl.gov> wrote:
> 
> Yes, we should allow users to provide their own matrix array. 
> 
> We use MatDensePlaceArray() to plug an array into matrix C before MatMatMult(). If we cannot do this, we will have to copy from the internal array of the result C to our array.
> 
> Would the following sequence work?
> MatMatMultSymbolic()
> MatDensePlaceArray()
> MatMatMultNumeric()
> This seems a reasonable API, but it is not obvious to users when and where MatDensePlaceArray() should be called.
> Currently, most users call  MatMatMult(A,B, reuse,&C) instead of MatMatMultSymbolic/Numeric. 
> 
> We plan to add
> MatMatGetProduct(A,B,&C);
> Then,
> MatDensePlaceArray(C,array);
> 
> Hong



More information about the petsc-dev mailing list