[petsc-users] MPIAIJ MatMult and non conforming object sizes

Barry Smith bsmith at petsc.dev
Thu Sep 5 17:19:30 CDT 2024


  You can use MatCreateVecs() to create vectors sized properly for both x and y in y = Ax when A is not square.


> On Sep 5, 2024, at 5: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!bSaK_Wa6QhLPg-VTwXikWgAOcFo9HA3dOF3pqzXGgsJFZH1LHVzj4YWXyrj_lxhs5Thig6VFoXMS4dnkpcyJGYw$  <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 <mailto:karthikeyan.chockalingam at stfc.ac.uk>
>   
>  <image001.png>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20240905/1f765a39/attachment.html>


More information about the petsc-users mailing list