Problem creating a non-square MPIAIJ Matrix
Shi Jin
jinzishuai at yahoo.com
Fri Feb 16 14:47:00 CST 2007
I actually used MatGetLocalSize(A,&m,&n) in the code.
They give me
m=4,n=3, as expected.
I can also specify m=4,n=3 in MatCreateMPIAIJ() which
is exactly identical to the previous code. If I
specify anything else, I get error saying that they
don't agree with the global sizes.
But I don't understand why we need to make n=N/2?
Are we storing the whole rows of the matrix? Just like
the mannual says, the local submatrix is of size m*N.
Shi
--- Satish Balay <balay at mcs.anl.gov> wrote:
>
> >
>
MatCreateMPIAIJ(PETSC_COMM_WORLD,PETSC_DECIDE,PETSC_DECIDE,
> > 8,6,PETSC_DEFAULT,d_nnz ,PETSC_DEFAULT,
> o_nnz, &A);
>
> Here you are asking PETSc to decide tine local 'm,n'
> partition sizes.
>
> So you should use MatGetLocalSize() to get these
> values [and not
> assume they are sequare blocks]
>
> If you need to have the diagonal blocks square -
> then specify them
> appropriately at the matrix creation time [instead
> of using
> PETSC_DECIDE - for m,n parameters].
>
> However - note that you'll have to create Vectors
> with matching
> parallel layout [when using in MatVec()]
>
> i.e in y = Ax
>
> x should match column layout of A
> y should match row layout of A
>
> Satish
>
> On Fri, 16 Feb 2007, Shi Jin wrote:
>
> > Hi there,
> >
> > I am found a very mysterious problem of creating a
> MxN
> > matrix when M>N.
> > Please take a look at the attached short test code
> I
> > wrote to demonstrate the problem.
> >
> > Basically, I want to create a 8x6 matrix.
> > A={1 2 3 4 0 0;
> > 0 0 0 0 0 0;
> > 0 0 0 0 0 0;
> > 0 0 0 0 0 0;
> > 0 0 0 0 0 0;
> > 0 0 0 0 0 0;
> > 0 0 0 0 0 0;
> > 0 0 0 0 0 0
> >
> > If I do it with 2 processes, I suppose the local
> > submatrices should look like
> > p0:
> > 1 2 3 4 0 0;
> > 0 0 0 0 0 0;
> > 0 0 0 0 0 0;
> > 0 0 0 0 0 0;
> > p1:
> > 0 0 0 0 0 0;
> > 0 0 0 0 0 0;
> > 0 0 0 0 0 0;
> > 0 0 0 0 0 0
> > The problem is that on the first process, the
> diagonal
> > portion of the local submatrix is
> > 1 2 3 4 | 0 0;
> > 0 0 0 0 | 0 0;
> > 0 0 0 0 | 0 0;
> > 0 0 0 0 | 0 0;
> > So I need to set d_nnz[0]=4 on p0 since the first
> row
> > has 4 diagonal nonzero entries. However, when I
> run
> > the code by
> > mpiexec -n 2 ./mpiaij
> > I got error saying that
> > [0]PETSC ERROR: --------------------- Error
> Message
> > ------------------------------------
> > [0]PETSC ERROR: Argument out of range!
> > [0]PETSC ERROR: nnz cannot be greater than row
> length:
> > local row 0 value 4 rowlength 3!
> >
> > It seems that it is checking against the n
> parameter
> > which is set by petsc to be n=N/2=3.
> > But why should we do that? According the manual,
> the
> > local submatrix is of dimension m by N.
> >
> > Could you please help me understand the problem?
> > Thank you very much.
> > Shi
> >
> >
> >
> >
>
____________________________________________________________________________________
> > TV dinner still cooling?
> > Check out "Tonight's Picks" on Yahoo! TV.
> > http://tv.yahoo.com/
>
>
____________________________________________________________________________________
Have a burning question?
Go to www.Answers.yahoo.com and get answers from real people who know.
More information about the petsc-users
mailing list