[petsc-dev] Weird interaction between VecDuplicate and VecSetBlockSize

Lisandro Dalcin dalcinl at gmail.com
Fri Mar 30 12:44:07 CDT 2012


On 30 March 2012 19:34, Barry Smith <bsmith at mcs.anl.gov> wrote:
>
> On Mar 30, 2012, at 11:07 AM, Lisandro Dalcin wrote:
>
>> On 30 March 2012 19:00, Lisandro Dalcin <dalcinl at gmail.com> wrote:
>>> On 30 March 2012 18:20, Blaise Bourdin <bourdin at lsu.edu> wrote:
>>>>
>>>> On Mar 30, 2012, at 10:13 AM, Jed Brown wrote:
>>>>
>>>> The PetscLayout is shared. It should probably not be allowed to change block
>>>> size after duplicating.
>>>>
>>
>> Actually, reading my previous reply, I did not expressed it well. I DO
>> AGREE with you that blocksizes should not be allowed to change once
>> set for first time. However, I think PETSc do have some code around
>> (in PC?) relying on this and unashamedly changing the bs of an INPUT
>> vector! If that was fixed, then we can disable changing bs for Vec.
>> But as long as we need to support this misfeature, at least let's try
>> to do better around the lines of my patch (BTW, I'm not sure how to
>> handle the blocked local to global mapping.... perhaps we can
>> reconstruct another one?)
>
>
>   Let's locate all the code that changes the block size (after it is set) and eradicate it, then we won't need this bad patch.
>

I think I complained about this long, long ago:

$ grep VecSetBlockSize -nR src/ksp/pc/
src/ksp/pc/impls/fieldsplit/fieldsplit.c:637:  ierr =
VecSetBlockSize(x,jac->bs);CHKERRQ(ierr);
src/ksp/pc/impls/fieldsplit/fieldsplit.c:638:  ierr =
VecSetBlockSize(y,jac->bs);CHKERRQ(ierr);
src/ksp/pc/impls/fieldsplit/fieldsplit.c:710:  ierr =
VecSetBlockSize(x,jac->bs);CHKERRQ(ierr);
src/ksp/pc/impls/fieldsplit/fieldsplit.c:711:  ierr =
VecSetBlockSize(y,jac->bs);CHKERRQ(ierr);

>
>  I think this can be done by having VecSetBlockSize() simple error out it if the map->bs != -1 and new block size not equals current block size.
>

Are you sure? How are we going to support the usage below?:

VecCreateSeq(comm,n,&vec)
VecSetBlockSize(vec,bs)

We cannot certainly have a long-living vec with bs=-1, right?


-- 
Lisandro Dalcin
---------------
CIMEC (INTEC/CONICET-UNL)
Predio CONICET-Santa Fe
Colectora RN 168 Km 472, Paraje El Pozo
3000 Santa Fe, Argentina
Tel: +54-342-4511594 (ext 1011)
Tel/Fax: +54-342-4511169



More information about the petsc-dev mailing list