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

Barry Smith bsmith at petsc.dev
Thu Jul 9 07:53:15 CDT 2020


  Change PETSC_COMM_WORLD to PETSC_COMM_SELF

  Barry


> On Jul 9, 2020, at 7:48 AM, Serge Van Criekingen <serge.van.criekingen at idris.fr> wrote:
> 
> 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
> 
> 
> <mat.c>



More information about the petsc-users mailing list