[petsc-users] MatMatMult size error

Hong Zhang hzhang at mcs.anl.gov
Tue Jan 15 15:43:49 CST 2013


Jim :
Can you switch to petsc-dev? MatMatMult()
has been updated significantly in petsc-dev
If you still see problem in petsc-dev, send us a short code that
produce the error. We'll check it.

Hong

> Hi,
> We are in the process of upgrading from Petsc 3.2 to 3.3p5.
>
> We are creating  matrices A and B in this way.
>       petsc_matrix = new Mat;
>       ierr = MatCreateDense(comm, m, num_cols ,num_rows,num_cols,data,A);
>
> Elsewhere, we have this. It gets called a few times, and on the 4th time,
> the size of matrix is C is wrong. Please see the output below. What could be
> the problem?
>      C = new Mat;
>      double fill = PETSC_DEFAULT;
>      MatMatMult(A,B,MAT_INITIAL_MATRIX, fill, C);
>      {
>        int m,n;
>        MatGetOwnershipRange(A, &m, &n);
>        cerr << "A.m = " <<  m << "\n";
>        cerr << "A.n = " <<  n << "\n";
>        MatGetSize(A,&m,&n);
>        cerr << "A global rows = " <<  m << "\n";
>        cerr << "A global cols = " <<  n << "\n";
>
>        MatGetOwnershipRange(B, &m, &n);
>        cerr << "B.m = " <<  m << "\n";
>        cerr << "B.n = " <<  n << "\n";
>        MatGetSize(B,&m,&n);
>        cerr << "B global rows = " <<  m << "\n";
>        cerr << "B global cols = " <<  n << "\n";
>
>        MatGetOwnershipRange(*C, &m, &n);
>        cerr << "C.m = " <<  m << "\n";
>        cerr << "C.n = " <<  n << "\n";
>
>        MatGetSize(*C,&m,&n);
>        cerr << "C global rows = " <<  m << "\n";
>        cerr << "C global cols = " <<  n << "\n";
>
>      }
>
> A.m = 0
> A.n = 59
> A global rows = 59
> A global cols = 320
> B.m = 0
> B.n = 320
> B global rows = 320
> B global cols = 320
> C.m = 0
> C.n = 59
> C global rows = 59
> C global cols = 320
> A.m = 0
> A.n = 59
> A global rows = 59
> A global cols = 320
> B.m = 0
> B.n = 320
> B global rows = 320
> B global cols = 59
> C.m = 10922
> C.n = -1389327096
> C global rows = -1389327112
> C global cols = -1389327112
>
>
> Thanks,
> Jim
> --
> Jim Fonseca, PhD
> Research Scientist
> Network for Computational Nanotechnology
> Purdue University
> 765-496-6495
> www.jimfonseca.com
>
>


More information about the petsc-users mailing list