[petsc-users] converting matrices between petsc and scalapack/blacs format?

Giacomo Mulas giacomo.mulas at inaf.it
Fri Aug 31 06:34:04 CDT 2018


Hello.

I have a relatively silly problem: in a software I developed, which
originally always used SLEPC, I now introduced support for using also
scalapack and elpa as eigensolvers, in cases in which this is convenient. 
Is there a simple way to have PETSC create a matrix in blacs compatible
format?

Alternatively, I am thinking to use MatView to write the PETSC matrix to a
file and then read it back.  This would also have the nice side-effect to
enable me to separate the part of the code the sets up and creates the
matrix from the part the calls the appropriate eigensolver.  The best thing
would be to use MatView to write a binary file and then create a simple
function to reread it, create a blacs matrix and populate it appropriately. 
In the docs for MatLoad() the format of binary files created by MatView is
given in terms of int and PetscScalar values.  Now, since in some cases (on
some machines) I compiled PETSC to use 64 bit indices, I need to be extra
careful on what "int" means!  Is it just "int", or PetscInt, or
PetscBLASInt, or...?  From a quick look at MatView_MPIAIJ_Binary() I would
guess they are PetscInt and are written by calls to PetscBinaryWrite(),
meaning I should use calls to PetscBinaryRead() to get them back.  Is this
correct?

Thanks in advance
Giacomo

-- 
_________________________________________________________________

Giacomo Mulas <giacomo.mulas at inaf.it>
_________________________________________________________________

INAF - Osservatorio Astronomico di Cagliari
via della scienza 5 - 09047 Selargius (CA)

tel.   +39 070 71180255
mob. : +39 329  6603810
_________________________________________________________________

"When the storms are raging around you, stay right where you are"
                          (Freddy Mercury)
_________________________________________________________________


More information about the petsc-users mailing list