[petsc-dev] MatAssembly and VecAssembly

Jed Brown jed at jedbrown.org
Fri Oct 20 12:46:02 CDT 2017


If you're using the same sparsity layout, you can use -vec_assembly_bts
and VecSetOption(X,VEC_SUBSET_OFF_PROC_ENTRIES) to make repeat
assemblies just send empty messages to neighbors to notify when nothing
needs to be done.  Similar with Mat SUBSET_NONZERO_PATTERN.

But MOOSE should really think through the order of operations so it only
needs one assembly to set up a system.

"Kong, Fande" <fande.kong at inl.gov> writes:

> How about to do  a global check (MPI_Allreduce)? If we do not set values at
> all and the matrix is already assembled, we just return without doing
> anything?
>
> How expensive, in the current implementation,  to call MatAssemblyBegin/End
> if there are no any stashed data? Is it so cheap that we can just ignore
> it?
>
> I am asking because we call MatAssemblyBegin/End so often in MOOSE. I want
> to make sure this is not going to bring up any performance issue.
>
>
> Fande,
>
> On Fri, Oct 20, 2017 at 11:08 AM, Barry Smith <bsmith at mcs.anl.gov> wrote:
>
>>
>>   One process sets a value in the matrix, the others do not. They all call
>> MatAssemblyBegin(). Some processes will skip the assembly and hence the
>> code will hang.
>>
>>
>> > On Oct 20, 2017, at 12:03 PM, Kong, Fande <fande.kong at inl.gov> wrote:
>> >
>> > Hi All,
>> >
>> > In Mat/VecAssemblyBegin/End, why we do not check if or not mat/vec is
>> assembled. If mat/vec is already assembled, should we just return without
>> doing anything?
>> >
>> > I think we have some particular reasons not to check if the matrix is
>> assembled. I honestly do not know why.
>> >
>> > Thanks,
>> >
>> > Fande,
>>
>>


More information about the petsc-dev mailing list