[Trilinos-Users] Gathering Non-Local Epetra MultiVector Data?

Heroux, Mike MHeroux at csbsju.edu
Sun Feb 16 06:37:39 MST 2014


If I understand your question correctly, you can gather all elements of a multivector by:
1. Create a new Epetra_Map where all the GIDS are assigned to one process (the GID lists for all other processes are empty).  
2. Create a new multivector using the new map.
3. Create an Epetra_Import object, using the original map and new map.
4. Execute the import.

>From memory, here is the (approximate ?) code:

// Assumptions:
// origMap - 100 elements on 4 processors, elements 0 - 24 on PE 0, 25 - 49 on PE 1, etc.
// origMV - original Multivector, distributed.

int numMyEntries = 0; // Assume no local entries
if (origMap.Comm().MyPID()==0) numMyEntries = 100; // Want all entries on PE 0
Epetra_Map rootMap(-1, numMyEntries, 0, origMap.Comm());
Epetra_MultiVector rootMV(rootMap, origMap.NumVectors());
Epetra_Import importer(rootMap, origMap); // This importer moves data to PE 0
rootMV.Import(origMV, importer, Insert);

Also, if you need to move data back to the original multivector (or any compatible one), you can export using your importer:

origMV.Export(rootMV, importer, Insert);

This operation permits you to update the state on the distributed object.

I hope this is helpful.  Let me know if you have further questions.


> On Feb 16, 2014, at 12:17 AM, "Clarissa G" <ccg1731 at gmail.com> wrote:
> Hi all,
> I am currently working on a program which uses distributed Epetra MultiVectors with MPI. There is a point at which one MPI process needs to reclaim/gather the distributed data for a MultiVector. Is there a simple way to do so? This seems very fundamental, but I am having trouble finding an answer in the documentation.
> Thanks,
> Clarissa G.
> _______________________________________________
> Trilinos-Users mailing list
> Trilinos-Users at software.sandia.gov
> http://software.sandia.gov/mailman/listinfo/trilinos-users

More information about the Trilinos-Users mailing list