[Trilinos-Users] Epetra Vectors/Maps

Mitchell, John A jamitch at sandia.gov
Fri Jan 29 19:55:46 MST 2010

Thanks Mike.

Yes -- i will push ahead and continue asking questions until I get over the hump:)

Thanks for your explanation.   your right -- the confusion I had was that numGlobalElements != actual number of global elements in my problem.

int myNumLocalElements=numOwned+numShared;

If I sum myNumLocalElements over all processors, then that is numGlobalElements != actual number of global elements in my problem.


From: Heroux, Michael A
Sent: Friday, January 29, 2010 6:57 PM
To: Mitchell, John A; trilinos-users at software.sandia.gov
Subject: Re: [Trilinos-Users] Epetra Vectors/Maps


numGlobalElements is the sum of numLocalElements across all processors.  I think the confusion is that numGlobalElements is not your number of global elements but the global length of the map including any repeated indices.  Epetra’s maps treat the index space as a collection of integer labels, not as a range of indices from 0 to numGlobalElements – 1, although there are efficiencies from using a contiguous range of indices that Epetra exploits if possible.

There is a certain learning curve to use the data migration facilities of Epetra.  Some of what you have to learn is from the essential complexity of parallel data movement.  Recently I have been convinced by my patient and persistent colleagues that we can remove some of the complexity by introducing a meta class that handles both import and export and does not reduce efficiency.  We will be working on this easier-to-use interface in the near future.

In the mean time, many people have been down the path you are starting on, so don’t labor too long with something before asking for assistance.

Best regards,


On 1/29/10 7:33 PM, "John Mitchell" <jamitch at sandia.gov> wrote:

Obviously I'm no trilinos expert but the first sentence in your second paragraph is basically the question that I was asking and no --  numGlobalElements is NOT equal to sum(numMyElements) -- at least that's what both Alan and Mike said. The documentation is apparently wrong.

Now concerning your second question -- I'll let the experts say.  I'm interested in hearing back on that:)

Littlewood, David John wrote:
Re: [Trilinos-Users] Epetra Vectors/Maps John,

I was also confused when I read this documentation.  I’m only slightly less confused now.

The way I understand it is that numGlobalElements is equal to sum(numMyElements), even in cases where there are shared IDs.  I’m guessing that the argument numGlobalElements can be provided by the user to avoid the vector having to compute numGlobalElements itself (requiring parallel communication).

Trilinos experts please correct me if I’m wrong here, but I believe the assembly operation you’re talking about requires two vectors, for example vector A of length(owned+shared) and vector B of length(owned).  If you have local data for owned and shared nodes in vector A, and you want to do an assemble add, you could do an export add from vector A to vector B, and then to an import insert from vector B to vector A.  Then your local copies of A would be updated with the summed values.


On 1/29/10 4:55 PM, "John Mitchell" <jamitch at sandia.gov> wrote:

Thanks Alan and Mike.

The reason I was asking is because the documentation says:

    \param In
            NumGlobalElements - Number of elements to distribute.  Must be
     either -1 or equal to the computed sum of NumMyElements across all
     processors in the Epetra_Comm communicator.

This documentation must not be correct or I'm reading it the wrong way?


Williams, Alan B wrote:
> Hi John,
> Yes you can have vectors/maps that overlap in the way that you describe. We have finite-element codes that use epetra in exactly that way.
> Alan
>> -----Original Message-----
>> From: trilinos-users-bounces at software.sandia.gov [mailto:trilinos-
>> users-bounces at software.sandia.gov] On Behalf Of John Mitchell
>> Sent: Friday, January 29, 2010 4:38 PM
>> To: trilinos-users at software.sandia.gov
>> Subject: [Trilinos-Users] Epetra Vectors/Maps
>> I am new to the use of Epetra and have a couple basic questions that
>> don't appear to be directly addressed in the tutorial.
>> Is it possible to create an
>> Epetra_Map(numGlobalElements,numMyElements,myElements,0,comm)
>> where sum(numMyElements) over all processors != numGlobalElements?
>> What I have, is a list of ids that I own, and then a list of ids that I
>> share but don't own.  I need to do parallel calculations and assemblies
>> on a vector that is of length numOwned+numShared.  Assembly operations
>> for both owned and shared may require off-processor communications.  I
>> have a vector f = {f_owned, f_shared}; If a point that is owned on
>> processor is shared on another processor, then the assembly of f_owned
>> will require contributions f_shared from the sharing off processor
>> I was planning on using the above Epetra_Map as a target map for
>> creating an Epetra_Import -- does that make sense?
>> Thanks,
>> John
>> _______________________________________________
>> 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

More information about the Trilinos-Users mailing list