[Trilinos-Users] CrsMatrix with col map is broken

Matt G mgoodman at email.arizona.edu
Sat Mar 26 11:26:16 MDT 2011


   I had some trouble with this a year ago or so.  The solution I came
across was to instantiate the matrix with a RowMap, do the filling, then
when calling fill complete, pass the same row map, as well as the column
map.  If you don't pass the column map during the fillComplete, things get
very confused, as I recall it assumes a square matrix, but does not prune
values outside the bounds there of.  As a result, many operations will run,
but give confusing/wrong results, like when you use the print method, it
will reports it is a (N x N) with row-col-value tuples outside that range.

You can find this code in my GitHub
Repo<https://github.com/meawoppl/ndsolver/blob/master/core.py>,
somewhere
around line 422 the matrices are fill-completed, the the AztecOO solving
setup starts around 604.      It is python, but the calls are basically the
same, so I suspect it will still be helpful.  One of the other things I did
not appreciate at first is that almost all of the Trilinos methods you use
give integer return codes, if any of these are non-zero, something is
probably not happening how you expect it to later.

I hope some of this is helpful!
--Matthew Goodman

=====================
Check Out My Website: http://craneium.net
Find me on LinkedIn: http://tinyurl.com/d6wlch



On Sat, Mar 26, 2011 at 10:04 AM, Williams, Alan B <william at sandia.gov>wrote:

> Jonathan,
> I agree that the error message from Aztec is not meaningful to most users.
> Basically, Aztec is picky about which order elements are stored in, and it
> is quite difficult to get it right in parallel. When Epetra generates the
> column map internally, it solves that problem, relieving you of needing to
> know the internal requirements of Aztec.
> In almost every case, it is advisable to construct epetra matrices with
> only a row-map and allow the column-map to be generated internally.
> Especially if you have a rectangular matrix, which is even trickier to get
> correct.
> There are only a few cases where extreme power users should explicitly
> create the column-map in parallel.
>
> Sorry that is not documented sufficiently.
> Alan
>
>
> > -----Original Message-----
> > From: trilinos-users-bounces at software.sandia.gov [mailto:trilinos-
> > users-bounces at software.sandia.gov] On Behalf Of Jonathan Guyer
> > Sent: Friday, March 25, 2011 2:12 PM
> > To: Trilinos Mailing List
> > Subject: [Trilinos-Users] CrsMatrix with col map is broken
> >
> > I asked about this a week ago and haven't seen a reply, so I'm trying
> > again with a more antagonistic subject.
> >
> > If I declare an Epetra.CrsMatrix with both a row map and a col map, I
> > can do matvec operations with it, but I cannot build an AztecOO with
> > it. Am I doing something wrong?
> >
> > Details below.
> >
> >
> > On Mar 17, 2011, at 9:24 AM, I wrote:
> >
> > > In the course of trying to sort out a use case where sometimes I want
> > to build part of a system of equations and calculate its residual and
> > other times I want to build the entire set and solve it, I've run into
> > an issue that I don't understand. At first I thought this was some
> > issue with rectangular matrices, but I see the same issues with square
> > matrices.
> > >
> > > I found a presentation by Mike Heroux at
> > http://www.hpcsw.org/presentations/workshops/scalable_tools/heroux_101.
> > pdf that seems to cover the situations I'm interested in and I've
> > attempted to replicate his Case 1, Case 2: Twist 1 and Case 2: Twist 2
> > with PyTrilinos at http://matforge.org/fipy/wiki/TrilinosMapPuzzle, and
> > I get the same errors.
> > >
> > > I am able to do the matvec operation to calculate the residual, but
> > unless I instantiate the `CrsMatrix` with only a row map, `AztecOO`
> > aborts with inexplicable things like "Received elements must be stored
> > after all 1 local elements". Um... OK... I see where that error is
> > generated in `az_comm.c`, but what does it mean?
> > >
> > > It seems like the only reason the `CrsMatrix`-with-row-map-only case
> > works at all is because `InsertValues()` magically ignores the fact
> > that the columns overlap other nodes when `Graph_.HaveColMap()` is
> > false. Otherwise, without an overlapping column map, I can't build the
> > matrix properly, but if I use an overlapping column map, I can't solve
> > the thing, no matter what I tell it about its domain and range maps.
> > I've also tried `ReplaceColMap()` to no avail.
> > >
> > > What am I missing?
> > >
> > > I'm using:
> > >
> > > PyTrilinos 10.2.0
> > > OpenMPI 1.4.1
> > > Apple System Python 2.6.1
> > > Snow Leopard 10.6.6
> > >
> > >
> > >
> > > --
> > > Jonathan E. Guyer, PhD
> > > Metallurgy Division
> > > National Institute of Standards and Technology
> > > <http://www.nist.gov/msel/metallurgy>
> > >
> > >
> > >
> > >
> > >
> > >
> > > _______________________________________________
> > > Trilinos-Users mailing list
> > > Trilinos-Users at software.sandia.gov
> > > http://software.sandia.gov/mailman/listinfo/trilinos-users
> > >
> >
> >
> >
> > _______________________________________________
> > Trilinos-Users mailing list
> > Trilinos-Users at software.sandia.gov
> > http://software.sandia.gov/mailman/listinfo/trilinos-users
>
>
> _______________________________________________
> Trilinos-Users mailing list
> Trilinos-Users at software.sandia.gov
> http://software.sandia.gov/mailman/listinfo/trilinos-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://software.sandia.gov/pipermail/trilinos-users/attachments/20110326/9c66346c/attachment-0001.html 


More information about the Trilinos-Users mailing list