[petsc-users] Flexiable AIJ matrix for nonzeros -- hash table version

Barry Smith bsmith at mcs.anl.gov
Mon May 9 20:35:52 CDT 2011


On May 9, 2011, at 6:07 PM, Lisandro Dalcin wrote:

> 2011/5/9 Gong Ding <gdiso at ustc.edu>:
>> Hi
>> I created a flexible AIJ matrix type –named as FAIJ. It has an extra hash table for nonzero which do not have pre-allocated position. And the buffered values in hash table will be flushed to AIJ array at MatAssemblyEnd. Both sequential and parallel version have been implemented and tested.
>> 
> 
> Great!! Have you thought about extending regular AIJ matrices to use a
> hash table on first assembly (perhaps activated with an option) and
> switch back to regular assembly for the next assemblies? I'm assuming
> here that calls to MatSetValues() fill the hash table even if values
> are zero.
> 
>> The test results show that for middle size problem – matrix size around 1M, FAIJ without any pre-allocation still pretty fast. The shortcoming is memory overkill exists. Fortunately, modern computers have larger and larger memory.  User with FAIJ matrix only needs to provide approximate nonzero pattern or even skip this step.
>> 
> 
> How did you wrote your hash table? What are the keys and values? Are
> you using a hash table per row? Or it is actuallyan  (i,j)->a hash
> table?
> 
>> However, direct solvers such as mumps and superlu_dist will crash. This is caused by type compare functions, i.e.:
>> ierr = PetscTypeCompare((PetscObject)A,MATMPIAIJ,&isAIJ);CHKERRQ(ierr);
>> FAIJ matrix is derived from AIJ, but it has its own type name, i.e. MATMPIFAIJ. The above function will assign isAIJ false.
>> 
> 
> That's the reason I think that adding this feature to regular AIJ
> matrices could be better.

   It can be implemented as a "subclass" of AIJ where just a few of the function pointers are changed to provide the hash support. Yes it doesn't make sense to copy the entire class code and so there may not need to be this problem with FAIJ.
> 
>> Is there any function like “PetscBaseType” exist?  FAIJ matrix can hold its type name as well as its base type name.
>> 
>> I hope FAIJ can be accepted by petsc 3.2.
>> Thanks.
>> 
> 
> I think Satish pushed something related to this a few days ago...

   That was a different matrix class, extensions to BAIJ for faster operations by streaming. That again can be a small subclass addition to BAIJ.

   Barry

> 
> 
> -- 
> 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-users mailing list