<div dir="ltr">So... what do I need to do, please?<br>Why am I getting wrong results when solving the linear system if the matrix is filled in with <font face="monospace">MatSetPreallocationCOO</font> and <font face="monospace">MatSetValuesCOO?</font></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Em ter., 20 de jun. de 2023 às 14:56, Jed Brown <<a href="mailto:jed@jedbrown.org">jed@jedbrown.org</a>> escreveu:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>> writes:<br>
<br>
>> The matrix entries are multiplied by 2, that is, the number of processes<br>
>> used to execute the code.<br>
>><br>
><br>
> No. This was mostly intended for GPUs, where there is 1 process. If you<br>
> want to use multiple MPI processes, then each process can only introduce<br>
> some disjoint subset of the values. This is also how MatSetValues() works,<br>
> but it might not be as obvious.<br>
<br>
They need not be disjoint, just sum to the expected values. This interface is very convenient for FE and FV methods. MatSetValues with ADD_VALUES has similar semantics without the intermediate storage, but it forces you to submit one element matrix at a time. Classic parallelism granularity versus memory use tradeoff with MatSetValuesCOO being a clear win on GPUs and more nuanced for CPUs.<br>
</blockquote></div>