Skip to content

Commit

Permalink
fixing pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
divija95 committed Apr 20, 2024
1 parent aeabd6f commit a68f7b8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
5 changes: 3 additions & 2 deletions libcusp/include/galois/graphs/DistributedLocalGraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,8 @@ class DistLocalGraph {
mirrorNodes[getHostID(token)].push_back(token);
}
i++;
if (isOwned(token) && (edge_begin(getLID(token)) == edge_end(getLID(token)))) {
if (isOwned(token) &&
(edge_begin(getLID(token)) == edge_end(getLID(token)))) {
numNodesWithEdges++;
}
}
Expand All @@ -1010,7 +1011,7 @@ class DistLocalGraph {

template <typename T>
void addVertex(T data) {
uint64_t token = data.id;
uint64_t token = data.id;
std::vector<T> dataVec;
dataVec.push_back(data);
updateVariables(true, token);
Expand Down
32 changes: 16 additions & 16 deletions libgalois/include/galois/runtime/GraphUpdateManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class graphUpdateManager {

template <typename N = NodeData, typename E = EdgeData>
void processEdges(std::vector<E>& edges) {
for(auto& edge : edges) {
for (auto& edge : edges) {
std::vector<uint64_t> dsts;
dsts.push_back(edge.dst);
std::vector<N> dstData = fileParser->GetDstData(edges);
Expand Down Expand Up @@ -80,17 +80,18 @@ class graphUpdateManager {
}

template <typename N = NodeData, typename E = EdgeData>
void processUpdates(std::vector<galois::graphs::ParsedGraphStructure<N, E>>& updateVector) {
void processUpdates(
std::vector<galois::graphs::ParsedGraphStructure<N, E>>& updateVector) {
std::vector<std::vector<EdgeData>> updateEdges;
std::vector<std::vector<NodeData>> updateNodes;
auto& net = galois::runtime::getSystemNetworkInterface();
updateNodes.resize(net.Num);
updateEdges.resize(net.Num);
for(auto& update : updateVector) {
if(update.isNode) {
for (auto& update : updateVector) {
if (update.isNode) {
updateNodes[graph->getHostID(update.node.id)].push_back(update.node);
} else {
for(auto& edge : update.edges) {
for (auto& edge : update.edges) {
updateEdges[graph->getHostID(edge.src)].push_back(edge);
}
}
Expand All @@ -104,24 +105,23 @@ class graphUpdateManager {
galois::runtime::SendBuffer b;
galois::runtime::gSerialize(b, updateNodes[i]);
net.sendTagged(i, galois::runtime::evilPhase, std::move(b));

}

//Receive vertex updates from other hosts
for(uint32_t i=0; i<net.Num-1; i++) {
// Receive vertex updates from other hosts
for (uint32_t i = 0; i < net.Num - 1; i++) {
decltype(net.recieveTagged(galois::runtime::evilPhase)) p;
do {
p = net.recieveTagged(galois::runtime::evilPhase);
} while (!p);
std::vector<N> recvNodes;
galois::runtime::gDeserialize(p->second, recvNodes);
processNodes(recvNodes);
processNodes(recvNodes);
}
galois::runtime::evilPhase++;

// Send Edge updates to the other hosts
for(uint32_t i = 0; i < net.Num; i++) {
if(i == net.ID) {
for (uint32_t i = 0; i < net.Num; i++) {
if (i == net.ID) {
continue;
}
galois::runtime::SendBuffer b;
Expand All @@ -130,18 +130,18 @@ class graphUpdateManager {
}

// Receive edge updates from other hosts
for(uint32_t i=0; i<net.Num-1; i++) {
for (uint32_t i = 0; i < net.Num - 1; i++) {
decltype(net.recieveTagged(galois::runtime::evilPhase)) p;
do {
p = net.recieveTagged(galois::runtime::evilPhase);
} while (!p);
std::vector<E> recvEdges;
galois::runtime::gDeserialize(p->second, recvEdges);
processEdges(recvEdges);
processEdges(recvEdges);
}
galois::runtime::evilPhase++;

//Process own updates
// Process own updates
processNodes(updateNodes[net.ID]);
processEdges(updateEdges[net.ID]);
}
Expand All @@ -160,13 +160,13 @@ class graphUpdateManager {
std::string line;
std::vector<galois::graphs::ParsedGraphStructure<N, E>> parsedData;
while ((std::getline(inputFile, line))) {
parsedData.push_back(fileParser->ParseLine(const_cast<char*>(line.c_str()), line.size()));
parsedData.push_back(fileParser->ParseLine(
const_cast<char*>(line.c_str()), line.size()));
}
processUpdates(parsedData);
inputFile.close();
}
auto& net = galois::runtime::getSystemNetworkInterface();
net.flush();
}

};

0 comments on commit a68f7b8

Please sign in to comment.