Sierra Toolkit
Version of the Day
|
Parallel cross-reference index for a collection of keys. More...
#include <DistributedIndex.hpp>
Public Types | |
typedef uint64_t | KeyType |
typedef int | ProcType |
typedef std::pair< KeyType, KeyType > | KeySpan |
typedef std::pair< KeyType, ProcType > | KeyProc |
Public Member Functions | |
DistributedIndex (ParallelMachine comm, const std::vector< KeySpan > &partition_spans) | |
Construct a parallel index with a parititioning of the key space. More... | |
void | query (std::vector< KeyProc > &sharing_of_local_keys) const |
Query with which process the local added keys are shared. | |
void | query (const std::vector< KeyType > &keys, std::vector< KeyProc > &sharing_of_keys) const |
Query which processors added the given keys. The local processor is in the output if it submitted a queried key. | |
void | query_to_usage (const std::vector< KeyType > &keys, std::vector< KeyProc > &sharing_of_keys) const |
Query which processors added the given keys. The results of the query are pushed to the processes on which the keys are used. | |
void | update_keys (const std::vector< KeyType > &add_new_keys, const std::vector< KeyType > &remove_existing_keys) |
Update a parallel index with new and changed keys. FIRST: Remove this process' participation in the existing keys. SECOND: Add this process' participation in the new keys. | |
void | generate_new_keys (const std::vector< size_t > &requests, std::vector< std::vector< KeyType > > &requested_keys) |
Request a collection of unused keys. More... | |
Friends | |
class | ::UnitTestSTKParallelDistributedIndex |
Parallel cross-reference index for a collection of keys.
All methods use parallel collective communication operations.
Each processor constructs a DistributedIndex with its local collection of keys. The resulting DistributedIndex may be queried for
When construction the key space is partitioned into N spans defined by a minimum and maximum key value for each span.
Definition at line 40 of file DistributedIndex.hpp.
stk_classic::parallel::DistributedIndex::DistributedIndex | ( | ParallelMachine | comm, |
const std::vector< KeySpan > & | partition_spans | ||
) |
Construct a parallel index with a parititioning of the key space.
To guarantee parallel consistency process zero broadcasts the partition bounds and all other processes accept those bounds.
The vector of spans must be well-ordered and not overlap; e.g., partition_spans[i].first <= partition_spans[i].second partition_spans[i].second < partition_spans[i+1].first
Definition at line 128 of file DistributedIndex.cpp.
void stk_classic::parallel::DistributedIndex::generate_new_keys | ( | const std::vector< size_t > & | requests, |
std::vector< std::vector< KeyType > > & | requested_keys | ||
) |
Request a collection of unused keys.
Each process inputs its independent request for keys which do not currenly appear in the distributed index. The output keys are grouped by partition_spans. The output keys are guaranteed to be unique among all processes. The output keys are added into the distributed index.
Multiple request should be bundled to reduce parallel communication costs. The output 'requested_keys' are sorted according to the policy.
The the 'first' member of the requests are the lower bound value for the keys.
Throw | an exception on all process if any request cannot be satisfied. |
Definition at line 905 of file DistributedIndex.cpp.