27 #ifndef _GALOIS_CUSP_PSCAFFOLD_H_
28 #define _GALOIS_CUSP_PSCAFFOLD_H_
43 std::vector<std::pair<uint64_t, uint64_t>>
_gid2host;
65 void saveGIDToHost(std::vector<std::pair<uint64_t, uint64_t>>& gid2host) {
94 if (gid >= start && gid < end) {
119 template <
typename EdgeTy>
121 const std::vector<uint32_t>&,
122 std::unordered_map<uint64_t, uint32_t>&,
123 const std::vector<uint64_t>&,
125 const std::vector<uint64_t>&,
134 std::vector<uint32_t>&, uint64_t) {}
167 if (gid >= start && gid < end) {
196 uint32_t mappedMaster = gidMasterIter->second;
208 GALOIS_DIE(
"should not fail to find a GID after stage 2 "
209 "of master assignment phase");
216 assert(offsetIntoMap != (uint32_t)-1);
237 std::vector<uint32_t>& localNodeToMaster,
238 uint64_t nodeOffset) {
243 for (
auto i = gid2offsets.begin(); i != gid2offsets.end(); i++) {
244 assert(i->second < localNodeToMaster.size());
245 galois::gDebug(
"Map ", i->first,
" to ", localNodeToMaster[i->second]);
248 assert(
_gid2masters.size() == (originalSize + gid2offsets.size()));
253 assert((myLocalNodes +
_gid2masters.size() - originalSize) ==
254 localNodeToMaster.size());
257 assert(myLocalNodes <= _localNodeToMaster.size());
260 _localNodeToMaster.resize(myLocalNodes);
281 template <
typename EdgeTy>
283 const std::vector<uint32_t>&,
284 std::unordered_map<uint64_t, uint32_t>&,
285 const std::vector<uint64_t>&,
287 const std::vector<uint64_t>&,
312 offsetIntoMapIter->second,
"!");
313 assert(offsetIntoMapIter->second == mappedMaster);
void saveGIDToHost(std::vector< std::pair< uint64_t, uint64_t >> &gid2host)
Save a provided map from host to nodes a host has read into this object.
Definition: BasePolicies.h:65
std::unordered_map< uint64_t, uint32_t > _gid2masters
Map GID to its master.
Definition: BasePolicies.h:153
bool addMasterMapping(uint32_t, uint32_t)
Technically doesn't nothing and should never be called because no master assignment phase...
Definition: BasePolicies.h:139
uint64_t _numEdges
number of edges in graph
Definition: BasePolicies.h:42
uint32_t _numHosts
total number of hosts
Definition: BasePolicies.h:40
Class that loads a portion of a Galois graph from disk directly into memory buffers for access...
Definition: BufferedGraph.h:49
Policies that use the read assignment of nodes as the masters.
Definition: BasePolicies.h:74
void saveGID2HostInfo(std::unordered_map< uint64_t, uint32_t > &gid2offsets, std::vector< uint32_t > &localNodeToMaster, uint64_t nodeOffset)
Given gid to master mapping info, save it into a local map.
Definition: BasePolicies.h:236
void gDebug(Args &&...GALOIS_USED_ONLY_IN_DEBUG(args))
Prints a debug string from a sequence of things; prints nothing if NDEBUG is defined.
Definition: gIO.h:72
uint32_t getMaster(uint32_t, galois::graphs::BufferedGraph< EdgeTy > &, const std::vector< uint32_t > &, std::unordered_map< uint64_t, uint32_t > &, const std::vector< uint64_t > &, std::vector< galois::CopyableAtomic< uint64_t >> &, const std::vector< uint64_t > &, std::vector< galois::CopyableAtomic< uint64_t >> &)
Does nothing because this policy doesn't have a master assignment phase.
Definition: BasePolicies.h:120
#define GALOIS_DIE(...)
Definition: gIO.h:96
uint32_t retrieveMaster(uint32_t gid) const
Retrieves a saved master mapping: does not fail if a GID mapping is not found but instead returns -1 ...
Definition: BasePolicies.h:189
Class that inherits from std::atomic to make it copyable by defining a copy constructor.
Definition: AtomicWrapper.h:40
uint32_t _hostID
host ID of owner of this object
Definition: BasePolicies.h:39
char _status
Specifies what phase of master assignment partitioner is on.
Definition: BasePolicies.h:149
uint32_t getMaster(uint32_t, galois::graphs::BufferedGraph< EdgeTy > &, const std::vector< uint32_t > &, std::unordered_map< uint64_t, uint32_t > &, const std::vector< uint64_t > &, std::vector< galois::CopyableAtomic< uint64_t >> &, const std::vector< uint64_t > &, std::vector< galois::CopyableAtomic< uint64_t >> &)
CuSP's "getMaster" function.
Definition: BasePolicies.h:282
uint32_t retrieveMaster(uint32_t gid) const
Returns the host ID of the host that read a particular node and its edges from disk.
Definition: BasePolicies.h:90
bool addMasterMapping(uint32_t gid, uint32_t mappedMaster)
Add a new master mapping to the local map: needs to be in stage 1.
Definition: BasePolicies.h:300
void enterStage2()
Does nothing as this policy doesn't have a master assignment phase.
Definition: BasePolicies.h:113
CustomMasterAssignment(uint32_t hostID, uint32_t numHosts, uint64_t numNodes, uint64_t numEdges)
Calls parent constructor to initialize common data.
Definition: BasePolicies.h:176
uint64_t _nodeOffset
This host's node offset (each host reads a distinct contiguous portion of graph.
Definition: BasePolicies.h:156
Policies that use a custom assignment of masters (from the user).
Definition: BasePolicies.h:147
std::vector< std::pair< uint64_t, uint64_t > > _gid2host
maps from host id to nodes that host as read from disk
Definition: BasePolicies.h:44
void enterStage2()
Shifts master assignment phase to stage 2.
Definition: BasePolicies.h:271
bool masterAssignPhase() const
Returns true as policies that inherit from this should define master assignment function.
Definition: BasePolicies.h:269
unsigned getHostReader(uint64_t gid) const
Return the reader of a particular node.
Definition: BasePolicies.h:163
std::vector< uint32_t > _localNodeToMaster
Metadata for determining where a node's master is.
Definition: BasePolicies.h:151
PartitioningScaffold(uint32_t hostID, uint32_t numHosts, uint64_t numNodes, uint64_t numEdges)
Constructor for Scaffold.
Definition: BasePolicies.h:55
void saveGID2HostInfo(std::unordered_map< uint64_t, uint32_t > &, std::vector< uint32_t > &, uint64_t)
No-op because no master assignment phase.
Definition: BasePolicies.h:133
uint64_t _numNodes
number of nodes in graph
Definition: BasePolicies.h:41
bool masterAssignPhase() const
Returns false as this partitioning policy doesn't have a master assignment phase. ...
Definition: BasePolicies.h:109
ReadMasterAssignment(uint32_t hostID, uint32_t numHosts, uint64_t numNodes, uint64_t numEdges)
Constructor simply calls parent constructor.
Definition: BasePolicies.h:79
Default fields and functions all CuSP partitioners use; this is a class to inherit from...
Definition: BasePolicies.h:37