[petsc-users] MatCreateSubMatrices in PETSc 3.12.5 vs. 3.13.3

Serge Van Criekingen Serge.Van.Criekingen at idris.fr
Thu Jul 9 07:48:29 CDT 2020


Dear PETSc team,

I have a parallel matrix that, in some cases, I want  to turn into a 
sequential matrix on rank 0. I have been succesfully using 
"MatCreateSubMatrices" for this purpose, along the following lines (a 
small but complete reproducer is attached):
--
if (MPIrank==0){
       nSubMatToExtract=1;
       ierr = 
ISCreateStride(PETSC_COMM_WORLD,globalSizeOfTheMatrix,0,1,&IS_MPI); 
CHKERRQ(ierr);
} else {
       nSubMatToExtract=0;
       ierr = ISCreateStride(PETSC_COMM_WORLD,0,0,1,&IS_MPI); CHKERRQ(ierr);
}
ierr = 
MatCreateSubMatrices(A,nSubMatToExtract,&IS_MPI,&IS_MPI,MAT_INITIAL_MATRIX,Aseq);
--
Unfortunately this does not seem to work anymore with petsc 3.13.3 
(while it worked at least up to 3.12.5, the latest version I tried 
before 3.13.3).
The error message mainly says:
--
PETSC ERROR: Petsc has generated inconsistent data
PETSC ERROR: MPI_Allreduce() called in different locations (code lines) 
on different processors
--
So was I just lucky that it worked before? And/or is there another 
(better) way to reach this goal?

For your information, I had this implemented to obtain and then solve a 
coarse-level domain decomposition matrix before discovering the 
possibility of using the "Telescope" option to agglomerate the unknowns 
spread on the subdomains. I managed to use Telescope, but I wish to know 
if I could go on using my previous way of doing in case I want to gather 
all the coarse-level unknowns on only one rank.

Thanks a lot,

Serge


-------------- next part --------------
A non-text attachment was scrubbed...
Name: mat.c
Type: text/x-csrc
Size: 1886 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20200709/d1930ad5/attachment-0001.bin>


More information about the petsc-users mailing list