[petsc-dev] Bug in MatZeroRows_MPIAIJ

Stefano Zampini stefano.zampini at gmail.com
Thu Jun 23 07:46:06 CDT 2016


If you are worried about doing memcmp on the ranges, it should be in the order of microseconds. few milliseconds with millions of processes.
On Lisandro workstation, it took 600 microseconds comparing two equal sets of  a million of integers.
Since the square case with same row and col layout covers the 90% of the cases (and memcmp need to sweep the entire ranges),
we can always have an int flag for MPIAIJ and its variants which is set to -1 at creation  and set  up properly the first time MatZeroRow_MPIAIJ is called.
 
On Jun 22, 2016, at 8:08 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:

> 
>> On Jun 22, 2016, at 1:24 AM, Lisandro Dalcin <dalcinl at gmail.com> wrote:
>> 
>> On 22 June 2016 at 00:30, Barry Smith <bsmith at mcs.anl.gov> wrote:
>>> Why not just remove the first if test (below) and just have the two conditions diag != 0.0 and drag == 0.0
>>> 
>>>    if ((diag != 0.0) && (mat->A->rmap->N == mat->A->cmap->N)) {
>>>       ierr = MatZeroRows(mat->A, len, lrows, diag, NULL, NULL);CHKERRQ(ierr);
>> 
>> What about comparing mat->rmap->N and mat->cmap->N, then compare
>> size(mat->rmap->comm) and size(mat->cmap->comm), and finally compare
>> (memcmp) mat->rmap-range and mat->rmap-range? If everything matches,
>> the row&col layout is square, you know that in all processes so no
>> need to do reductions, and then  you can take the fast path zeroing
>> rows on the diagonal block mat->A.
> 
>   By then it is worth the optimization?
> 
>> 
>> 
>> -- 
>> Lisandro Dalcin
>> ============
>> Research Scientist
>> Computer, Electrical and Mathematical Sciences & Engineering (CEMSE)
>> Extreme Computing Research Center (ECRC)
>> King Abdullah University of Science and Technology (KAUST)
>> http://ecrc.kaust.edu.sa/
>> 
>> 4700 King Abdullah University of Science and Technology
>> al-Khawarizmi Bldg (Bldg 1), Office # 0109
>> Thuwal 23955-6900, Kingdom of Saudi Arabia
>> http://www.kaust.edu.sa
>> 
>> Office Phone: +966 12 808-0459
> 




More information about the petsc-dev mailing list