Vec: types, sizes, and block sizes...

Lisandro Dalcin dalcinl at gmail.com
Fri Jul 24 12:02:06 CDT 2009


On Fri, Jul 24, 2009 at 1:17 PM, Barry Smith<bsmith at mcs.anl.gov> wrote:
>
>  Or just throw away separate specification of block size completely from Vec
> and Mat and always have
> blocksize as an argument to Vec/MatSetSizes(). With languages that support
> it, the blocksize would be an
> optional argument.
>

BTW, I'm doing that in petsc4py:

cdef class Vec(Object):
    def setSizes(self, size, bsize=None):

cdef class Mat(Object):
    def setSizes(self, size, bsize=None):


However, for the case of Mat, the "bsize" arg is used just for
computing local/global sizes the right way. You know, I just cannot
call MatSetBlockSize(), as it will likely fail for almost all matrix
types :-)

>
> One could take two points of view
>
> 1) block size is just an implementation issues (for BAIJ matrices) so
> sticking it into the basic interface is bad design or
> 2) block size is actually providing additional information about the
> application to the library so belongs in the basic interface
>
> Originally with PETSc design I had point of view 1. Now I am not so sure.
>

Well, in petsc4py I have some pieces of code (a lot of hackery on
internal structures before and after PETSc calls) just for making the
whole beast closer to point of view (2) ... IMHO, block-sizes are
application-level data (how many "dofs" your "nodes" have). The
XXXSetValuesBlockedXXX calls take advantage of this, letting you set
values using "node" indices instead of "dof" indices. We should be
able to consistently use these API's with any matrix type.... BAIJ is
just a particular Mat type optimized for  bs>1.


So then... What should we do?

0) Nothing

1) Change the whole XXXSetSizes() to take the block-size? This is
going to be a lot of work

2) Introduce XXXSetSizesBlock() ? This would be less work for us, and
a far less cumbersome change for end-users of next PETSc release...

If you grep in all src/, you will notice that VecSetBlockSize is used
in relatively few places. This makes me thing that approach (2) is
feasible an convenient; that are the primary places were we should
make the change VecSetSizes&VecSetBlockSize -> VecSetSizesBlock....

What do you think?


-- 
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