[petsc-dev] [petsc-maint] Proposal to improve MatSetValuesBlocked

Jed Brown jed at jedbrown.org
Tue Dec 29 23:22:22 CST 2020


I typically use a static inlining approach to specialization. I have an old branch somewhere with experiments along these lines for BAIJ, but this is the strategy in real code (for small tensor contractions).

https://github.com/CEED/libCEED/blob/main/backends/avx/ceed-avx-tensor.c#L240-L246


The SF case is unique in that most of the genericness is to cover different types, not just array lengths to specialize on. Junchao used C++ templates to do the same things in the Kokkos SF backend and I think it's fair to say the C++ version is at least as good provided you're willing to use C++.

Mark Adams <mfadams at lbl.gov> writes:

> That sounds like a good idea.
> We can do this incrementally: add some (Jed's) preprocessor into configure,
> let Frank use that and we can replace old flexible ones as desired.
>
> On Tue, Dec 29, 2020 at 6:41 PM Matthew Knepley <knepley at gmail.com> wrote:
>
>> I do not mind accepting Frank's MR. However, if this is a 2x improvement
>> for something that is often done, should we think about having
>> a nicer way to add block sizes? Jed has code for different blocks using
>> the preprocessor (I think) in sfbasic, and we have top-level switches
>> in PBJACOBI and (I think) MatInvertDiagonal. Should we agree on a good
>> strategy and use it everywhere?
>>
>>   Matt
>>
>> On Tue, Dec 29, 2020 at 10:32 AM Mark Adams <mfadams at lbl.gov> wrote:
>>
>>> Yes, this is a useful thing to have. AIJ assembly is always a problem and
>>> this seems like a good optimization to have in there.
>>> Thanks,
>>> Mark
>>>
>>> On Tue, Dec 29, 2020 at 9:47 AM Frank Bramkamp <bramkamp at nsc.liu.se>
>>> wrote:
>>>
>>>>
>>>> Dear Mark,
>>>>
>>>> then I can do this.
>>>> I will add it to the sequential and parallel part.
>>>> Probably useful for everyone.
>>>>
>>>> Greetings, Frank
>>>>
>>>>
>>>>
>>>>
>>
>> --
>> What most experimenters take for granted before they begin their
>> experiments is infinitely more interesting than any results to which their
>> experiments lead.
>> -- Norbert Wiener
>>
>> https://www.cse.buffalo.edu/~knepley/
>> <http://www.cse.buffalo.edu/~knepley/>
>>


More information about the petsc-dev mailing list