Dear Barry,

Thanks for your help. Now the code works as expected (attached). There
is one more problem that I am facing.

If you remember I have 

vec = (vec1^t, vec2^t,...,veck^t)^t

and given the MAIJ matrix X I need to compute

fx = (X.vec1, X.vec2, ...,X.veck)

>From what I understand so far, if I compute X.vec then I get a vector of
the form

x_1.vec1
x_1.vec2
.
.
.
x_n.veck

where x_i denotes the i-th row of X. 

In my application I need access to (x_i.vec1, x_i.vec2, ...., x_i.veck)
on the same processor. If I use the local size provided by the
MatGetLocalSize how do I ensure that the local vectors are aligned w.r.t
k?

vishy

 

On Thu, 2011-01-06 at 21:53 -0600, Barry Smith wrote:
> You've assumed that the PETSC_DECIDE for the MatLoad() for local sizes will 
> match that for the VecCreate(). In general they will not be the same.
> Once you've created your MATMAIJ   (by they way you don't need to call 
> MatAssembly on the MAIJ matrix) call MatGetLocalSize() and use that local 
> size in the construction of the vector.
> 
>    Barry
> 
> 
> On Jan 6, 2011, at 9:46 PM, S V N Vishwanathan wrote:
> 
> >>> 
> >>> Is there any place to read up about MAIJ matrices. I read the manual
> >>> pages but they were rather cryptic. Perhaps some example code?
> >> 
> >> http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/src/snes/examples/tutorials/ex48.c.html
> >>  is the only example that uses. 
> > 
> > I wrote a little example (attached) to test my understanding of the MAIJ
> > matrices. When I run it on a single processor I have no trouble but when
> > I use mpiexec -n 2 I get the following errors. Any pointers on how to
> > overcome this problem are appreciated. The code loads a matrix from a
> > file, which can be downloaded from
> > 
> > http://www.stat.purdue.edu/~vishy/adult9.train.x
> > 
> > Before someone has ideas ;-), I should clarify that this is a standard
> > machine learning dataset.
> > 
> > [0]PETSC ERROR: --------------------- Error Message
> > ------------------------------------
> > [0]PETSC ERROR: Nonconforming object sizes!
> > [0]PETSC ERROR: Mat mat,Vec y: local dim 48843 48842!
> > [0]PETSC ERROR:
> > ------------------------------------------------------------------------
> > [0]PETSC ERROR: Petsc Release Version 3.1.0, Patch 7, Mon Dec 20
> > 14:26:37 CST 2010
> > [0]PETSC ERROR: See docs/changes/index.html for recent updates.
> > [0]PETSC ERROR: See docs/faq.html for hints about trouble shooting.
> > [0]PETSC ERROR: See docs/index.html for manual pages.
> > [0]PETSC ERROR:
> > ------------------------------------------------------------------------
> > [0]PETSC ERROR: ./chumma on a linux-gnu named vishy-laptop by vishy Thu
> > Jan  6 22:28:26 2011
> > [0]PETSC ERROR: Libraries linked
> > from 
> > /home/vishy/Repositories/GenEntropy/Code/hpc/petsc-3.1-p7/linux-gnu-cxx-debug/lib
> > [0]PETSC ERROR: Configure run at Thu Dec 30 23:48:41 2010
> > [0]PETSC ERROR: Configure options --with-debugging=yes
> > --with-clanguage=C++ --with-shared --download-mpich=ifneeded
> > [0]PETSC ERROR:
> > ------------------------------------------------------------------------
> > [0]PETSC ERROR: MatMult() line 1889 in src/mat/interface/matrix.c
> > [0]PETSC ERROR: main() line 61 in chumma.cpp
> > application called MPI_Abort(MPI_COMM_WORLD, 60) - process 0[cli_0]:
> > aborting job:
> > application called MPI_Abort(MPI_COMM_WORLD, 60) - process 0
> > [0]0:Return code = 60
> > [0]1:Return code = 0, signaled with Interrupt
> > 
> > vishy
> > <chumma.cpp>
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: chumma.cpp
Type: text/x-c++src
Size: 2659 bytes
Desc: not available
URL: 
<http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20110107/f3bef795/attachment.cpp>

Reply via email to