[petsc-dev] Branches with additional features

Pierre Jolivet Pierre.Jolivet at enseeiht.fr
Wed May 31 01:28:52 CDT 2017


On Tue, 30 May 2017 13:32:18 -0500, Barry Smith wrote:
> Yeah, you have a valid point we really need a MatCreateDense() and a
> MatCreateDenseWithArray() like we have for vectors.
>
>     If we simply had a null array to indicate don't allocate space
> then uses would ALWAYS need to allocate the space themselves and pass
> it in which is annoying because most of the time users want PETSc to
> allocate the array.
>
>    In your case can't you create the matrix with the "first" array
> from the other code and then after that use MatDensePlaceArray()? 
> Then
> MatCreateDense() would not allocate any unneeded space.

I indeed can.

>    Barry
>
>
>> On May 30, 2017, at 3:46 AM, Pierre Jolivet 
>> <pierre.jolivet at enseeiht.fr> wrote:
>>
>> Thank you very much. One last thing: with VecCreateMPIWithArray, if 
>> I pass a NULL pointer for the array of values, then nothing is done 
>> and I need to use VecPlaceArray/VecResetArray.
>> With MatCreateDense, if I pass a NULL pointer for the array of 
>> values, then PETSc allocates the memory. Why is there such a 
>> difference? Is there a way to create a dense matrix with no storage 
>> attached to it (that will of course be then set via 
>> MatDensePlaceArray/MatDenseResetArray)?
>>
>> Thanks,
>> Pierre
>>
>> On Mon, 29 May 2017 19:45:27 -0500, Barry Smith wrote:
>>> I have added MatDensePlaceArray() and MatDenseResetArray() in
>>> 
>>> https://bitbucket.org/petsc/petsc/branch/barry/feature-matdenseplacearray
>>>
>>>   Barry
>>>
>>>> On May 29, 2017, at 3:46 PM, Pierre Jolivet 
>>>> <pierre.jolivet at enseeiht.fr> wrote:
>>>>
>>>>
>>>>> On 29 May 2017, at 22:20, Jed Brown <jed at jedbrown.org> wrote:
>>>>>
>>>>>> That makes perfect sense (assuming I'm not wrong about the
>>>>>> MatAssemblyBegin/MatAssemblyEnd). MatSetUpMultiply_MPIDense 
>>>>>> would still
>>>>>> be called at each iteration but I doubt this is too costly.
>>>>>
>>>>> It creates a VecScatter so it isn't nothing (in terms of parallel
>>>>> semantics), but I'd like to see profiling data before chasing 
>>>>> this
>>>>> around.
>>>>
>>>> Sure, I'll use that and will look out for any occurrence of 
>>>> "MatDensePlaceArray" (or stuff like that) in the logs, in case it is 
>>>> implemented.
>>>> Thanks!
>>




More information about the petsc-dev mailing list