[petsc-users] MPIAIJ MatMult and non conforming object sizes
Junchao Zhang
junchao.zhang at gmail.com
Thu Sep 5 17:03:57 CDT 2024
It is triggered by
PetscCheck(mat->rmap->N == y->map->N, PetscObjectComm((PetscObject)mat),
PETSC_ERR_ARG_SIZ, "Mat mat,Vec y: global dim %" PetscInt_FMT " %"
PetscInt_FMT, mat->rmap->N, y->map->N);
The error says in your y = Ax, A has 40 rows but y has 25.
Generally, VecDuplicate(par_xcoord,&par_xvec) is wrong since you assume x,
y have the same size.
--Junchao Zhang
On Thu, Sep 5, 2024 at 4:20 PM Karthikeyan Chockalingam - STFC UKRI via
petsc-users <petsc-users at mcs.anl.gov> wrote:
> Hello,
>
>
>
> I am unsure why the program crashes even while running the code serially
>
>
>
>
>
> petscErr = MatCreate(mesh.comm().get(), &par_G);
>
> petscErr = MatSetType(par_G, MATMPIAIJ);
>
> petscErr = MatSetSizes(par_G, local_num_rows, local_num_cols,
> total_num_rows, total_num_cols);
>
> PetscInt d_nz = 2;
>
> PetscInt o_nz = 2;
>
> petscErr = MatMPIAIJSetPreallocation(par_G, d_nz, NULL, o_nz, NULL);
>
>
>
> petscErr =
> VecCreateMPI(mesh.comm().get(),local_num_cols,total_num_cols,&par_xcoord);
>
> petscErr = VecDuplicate(par_xcoord,&par_xvec);
>
>
>
> petscErr = MatMult(par_G, par_xcoord, par_xvec);
>
>
>
>
>
>
>
>
>
> [0]PETSC ERROR: --------------------- Error Message
> --------------------------------------------------------------
>
> [0]PETSC ERROR: Nonconforming object sizes
>
> [0]PETSC ERROR: Mat mat,Vec y: global dim 40 25
>
> [0]PETSC ERROR: WARNING! There are unused option(s) set! Could be the
> program crashed before usage or a spelling mistake, etc!
>
> [0]PETSC ERROR: Option left: name:--keep-cout (no value) source: command
> line
>
> [0]PETSC ERROR: See https://urldefense.us/v3/__https://petsc.org/release/faq/__;!!G_uCfscf7eWS!auIH0jsOSEODe54KPaiJXMFaybeyFhBQSkvRAJLVAxRJbngqy9YCy0HUTTTAeLyEKq2W392V9Qix5MS7MaYhlkgHlnvb$
> <https://urldefense.us/v3/__https://petsc.org/release/faq/__;!!G_uCfscf7eWS!eNf_b1At1lAvdYeAlplIXxQN9WwVYKe1gkVUZRvNkdF0V6JCbVOG_mYTuCQrp2rs8FMod_waFjX0LLNuAvMcHmdf7Hrzm4s3JaQT$>
> for trouble shooting.
>
> [0]PETSC ERROR: Petsc Release Version 3.20.3, unknown
>
> [0]PETSC ERROR: ./example-dbg on a arch-moose named HC20210312 by
> karthikeyan.chockalingam Thu Sep 5 22:16:54 2024
>
> [0]PETSC ERROR: Configure options --with-64-bit-indices
> --with-cxx-dialect=C++17 --with-debugging=no --with-fortran-bindings=0
> --with-mpi=1 --with-openmp=1 --with-shared-libraries=1 --with-sowing=0
> --download-fblaslapack=1 --download-hypre=1 --download-metis=1
> --download-mumps=1 --download-ptscotch=1 --download-parmetis=1
> --download-scalapack=1 --download-slepc=1 --download-strumpack=1
> --download-superlu_dist=1 --download-bison=1 --download-hdf5=1
> --with-hdf5-fortran-bindings=0
> --download-hdf5-configure-arguments="--with-zlib" --with-make-np=4
>
> [0]PETSC ERROR: #1 MatMult() at
> /Users/karthikeyan.chockalingam/moose/petsc/src/mat/interface/matrix.c:2587
>
> Vec Object: 1 MPI process
>
>
>
>
>
> Many thanks for the help!
>
>
>
> Karthik.
>
>
>
>
>
>
>
> --
>
> *Karthik Chockalingam, Ph.D.*
>
> Senior Research Software Engineer
>
> High Performance Systems Engineering Group
>
> Hartree Centre | Science and Technology Facilities Council
>
> karthikeyan.chockalingam at stfc.ac.uk
>
>
>
> [image: signature_3970890138]
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20240905/5d38d445/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 18270 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20240905/5d38d445/attachment-0001.png>
More information about the petsc-users
mailing list