[Trilinos-Users] Reading Epetra_Vector element owned by another processor?
MHeroux at CSBSJU.EDU
Sat Feb 9 21:13:18 EST 2019
I don’t know if you have figured this out on your own or not, but if I understand what you want to do, I would suggest you send the value State (using an MPI broadcast function) to each MPI process and have each MPI process call std::find() on its portion of the Epetra_Vector.
What to do next depends on whether the value State can occur zero, only one, or more than one time in your states vector. For example, if States exists once and only once in the vector, you can you use the GID() method on your Epetra_Map to find the global ID of the states vector on the MPI process that contains the value. This would be the value of stateIndex. Then there is a variety of ways to use MPI collectives to communicate the value of stateIndex to other processes.
My reply is fairly terse and non-specific, but hopefully it helps. The key idea is that you want to perform the find on each MPI process, and then communicate its location.
I hope this helps.
From: Trilinos-Users <trilinos-users-bounces at trilinos.org> on behalf of "S. F. Duki" <solomonfd at gmail.com>
Date: Tuesday, January 22, 2019 at 5:47 PM
To: "trilinos-users at trilinos.org" <trilinos-users at trilinos.org>
Subject: [Trilinos-Users] Reading Epetra_Vector element owned by another processor?
I am wondering if you could help me how I can read/search an element of a distributed Epetra_Vector owned by another processor: Say I want to read an element owned by processor 1 from processor 2? Here is an example I have
map is defined.........
RCP<Epera_Vector> states = rcp( new Epetra_Vector( *map ) );
states->ExtractView( &s_values );
stateIndex = std::distance(s_values, std::find(s_values, s_values + estimated_size, State));
But this searches/reads only on the processor that owns the elements of states. I want to read/serach elements owned by all processors as my estimated_size is much greater than states->MyLength() on a given processor.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Trilinos-Users