[petsc-users] Noncomforming object sizes error in MatEqual

Eda Oktay eda.oktay at metu.edu.tr
Wed Dec 18 01:24:41 CST 2019


Hello everyone,

In a part of my code, I am trying to understand whether a matrix is equal
to its transpose, that is why I am using MatEqual(). However, for most of
the matrices I took from University of Florida State Sparse Matrix Library,
I get the following error for more than 2 processes, where main() line 155
is MatEqual:

[2]PETSC ERROR: --------------------- Error Message
--------------------------------------------------------------
[2]PETSC ERROR: Nonconforming object sizes
[2]PETSC ERROR: Mat A,Mat B: global dim 6 6 8 5
[2]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for
trouble shooting.
[2]PETSC ERROR: Petsc Release Version 3.11.1, Apr, 12, 2019
[2]PETSC ERROR: ./yeni_vertexweight_imbalance_without_spectral on a
arch-linux2-c-debug named d1e.wls.metu.edu.tr by edaoktay Wed Dec 18
10:18:30 2019
[2]PETSC ERROR: Configure options --download-mpich --download-openblas
--download-slepc --download-metis --download-parmetis --download-chaco
--with-X=1
[2]PETSC ERROR: #1 MatEqual() line 5130 in
/home/edaoktay/petsc-3.11.1/src/mat/interface/matrix.c
[2]PETSC ERROR: #2 MatEqual_MPIAIJ() line 2112 in
/home/edaoktay/petsc-3.11.1/src/mat/impls/aij/mpi/mpiaij.c
[2]PETSC ERROR: #3 MatEqual() line 5136 in
/home/edaoktay/petsc-3.11.1/src/mat/interface/matrix.c
[2]PETSC ERROR: #4 main() line 115 in
/home/edaoktay/petsc-3.11.1/arch-linux2-c-debug/share/slepc/examples/src/eda/yeni_vertexweight_imbalance_without_spectral.c
[2]PETSC ERROR: PETSc Option Table entries:
[2]PETSC ERROR: -f
/home/edaoktay/petsc-3.11.1/share/petsc/datafiles/matrices/binary_files/Ragusa16_binary
[2]PETSC ERROR: -mat_partitioning_type parmetis
[2]PETSC ERROR: ----------------End of Error Message -------send entire
error message to petsc-maint at mcs.anl.gov----------

And this is the part of my code:

  ierr = PetscInitialize(&argc,&argv,(char*)0,help);if (ierr) return ierr;

  /*
     Determine files from which we read matrix
  */

  ierr =
PetscOptionsGetString(NULL,NULL,"-f",file,PETSC_MAX_PATH_LEN,&flg);CHKERRQ(ierr);
  if (!flg) SETERRQ(PETSC_COMM_WORLD,1,"Must indicate binary file with the
-f option");

  /*
     Open binary file.  Note that we use FILE_MODE_READ to indicate
     reading from this file.
  */

  ierr =
PetscViewerBinaryOpen(PETSC_COMM_WORLD,file,FILE_MODE_READ,&fd);CHKERRQ(ierr);

  /*
    Load the matrix; then destroy the viewer.
  */

  ierr = MatCreate(PETSC_COMM_WORLD,&A);CHKERRQ(ierr);

  ierr = MatSetOptionsPrefix(A,"a_");CHKERRQ(ierr);
  ierr = MatSetFromOptions(A);CHKERRQ(ierr);
  ierr = MatLoad(A,fd);CHKERRQ(ierr);
  ierr = PetscViewerDestroy(&fd);CHKERRQ(ierr);

 /* PetscLogDouble v1,v2,elapsed_time;

  PetscTime(&v1);   */

    /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                    Create Partitioning
     - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

  ierr = MatConvert(A,MATMPIADJ,MAT_INITIAL_MATRIX,&AL);CHKERRQ(ierr);


  ierr = MatPartitioningCreate(MPI_COMM_WORLD,&part);CHKERRQ(ierr);
  ierr = MatPartitioningSetAdjacency(part,AL);CHKERRQ(ierr);

      /* Symmetry check */

      Mat Atr,SymmA,Atrabs,Aabs;
      PetscBool isEqual;
      Vec D;
      PetscInt i;

    ierr = MatTranspose(A,MAT_INITIAL_MATRIX,&Atr);CHKERRQ(ierr);
    ierr = MatDuplicate(Atr,MAT_COPY_VALUES,&SymmA);CHKERRQ(ierr);
    flg = PETSC_TRUE;

    PetscOptionsGetBool(NULL,NULL, "-check_symmetry", &flg,NULL);
    if (flg) {
        ierr = MatEqual(A,Atr,&isEqual);CHKERRQ(ierr);

For this specific error, the matrix is of size 24*24. When I checked, I
couldn't understand what is wrong when it comes to 3rd process. I will be
glad if someone can tell me what is wrong with my code that I get this
dimension error.

Thanks,

Eda
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20191218/3b639202/attachment.html>


More information about the petsc-users mailing list