column map in Mat MPIAdj

Lisandro Dalcin dalcinl at gmail.com
Wed Dec 3 14:06:04 CST 2008


On Wed, Dec 3, 2008 at 5:28 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:
>
>   The normal pattern (for example MPIAIJ, MPIBAIJ) is for the PetscMap setup
> being done in the associated MatXXXSetPreallocation() routine.
>
>   I think the correct fix is
> 1) change the  ierr = MatSetSizes(*A,m,n,PETSC_DETERMINE,n);CHKERRQ(ierr);
> in MatCreateMPIAdj to  ierr =
> MatSetSizes(*A,m,PETSC_DECIDE,PETSC_DETERMINE,n);CHKERRQ(ierr);

Yep, this seems to be fix. I believe I'll even change the name of the
'n' argument to 'N' and put it VERY clear in the docs that 'N' is de
global number of columns.

> 2) remove the two lines
>  if (B->cmap->n  < 0) B->cmap->n = B->cmap->N;
>  if (B->cmap->N  < 0) B->cmap->N = B->cmap->n;
> from MatCreate_MPIAdj()
>
> 3) either add the   ierr = PetscMapSetUp(B->cmap);CHKERRQ(ierr); to
> MatCreate_MPIAdj() OR put the PetscMapSetUp() for both rmap and
> cmap into MatMPIAdjSetPreallocation() [this would be best cause it matches
> the pattern of the others]

I agree. Let's setup the maps in MatMPIAdjSetPreallocation().


>
>   Or am I missing something.
>
>   Barry
>
> The business of setting the local column size to the global column size came
> from
> long ago and probably makes no sense any more.
>
> On Dec 3, 2008, at 9:36 AM, Lisandro Dalcin wrote:
>
>> Sorry, my comment about PETSC_COMM_SELF was a nonsense :-(
>>
>> Let me write the rule in C-Python-pseudocode
>>
>> rank = mat->comm->rank
>> size = mat->comm->size
>>
>> cmap->N = # total_columns
>>
>> for p in range(size):
>>  if p == rank:
>>     mat->cmap->n = cmap->N
>>  else:
>>     mat->cmap->n = 0
>>
>> # and finally
>> PetscMapSetUp(mat->cmap)
>>
>> That would be fine?
>>
>>
>> On Wed, Dec 3, 2008 at 1:19 PM, Lisandro Dalcin <dalcinl at gmail.com> wrote:
>>>
>>> Can someone help me to review this routine?
>>>
>>> MatCreate_MPIAdj(Mat B)
>>>
>>> I understand that MATMPIADJ is rather special, but the call above is
>>> never made
>>>
>>> PetscMapSetUp(B->cmap)
>>>
>>> then It seems that some stuff (ranges) in the column map will be
>>> uninitialized.
>>>
>>> What values should have the entries in "cmap" for mpiadj matrices?
>>> Should the "comm" in "cmap" be MPI_COMM_SELF, then we can call
>>> PetscMapSetUp?
>>>
>>>
>>>
>>>
>>> --
>>> Lisandro Dalcín
>>> ---------------
>>> Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
>>> Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
>>> Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
>>> PTLC - Güemes 3450, (3000) Santa Fe, Argentina
>>> Tel/Fax: +54-(0)342-451.1594
>>>
>>
>>
>>
>> --
>> Lisandro Dalcín
>> ---------------
>> Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
>> Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
>> Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
>> PTLC - Güemes 3450, (3000) Santa Fe, Argentina
>> Tel/Fax: +54-(0)342-451.1594
>>
>
>



-- 
Lisandro Dalcín
---------------
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594




More information about the petsc-dev mailing list