Skip to content

Commit

Permalink
[all] fix typos in comments found by clang-tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
sbeamer committed Oct 5, 2023
1 parent 24261d2 commit dabb16b
Show file tree
Hide file tree
Showing 14 changed files with 38 additions and 43 deletions.
4 changes: 2 additions & 2 deletions src/bc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Author: Scott Beamer
Will return array of approx betweenness centrality scores for each vertex
This BC implementation makes use of the Brandes [1] algorithm with
implementation optimizations from Madduri et al. [2]. It is only an approximate
implementation optimizations from Madduri et al. [2]. It is only approximate
because it does not compute the paths from every start vertex, but only a small
subset of them. Additionally, the scores are normalized to the range [0,1].
Expand Down Expand Up @@ -199,7 +199,7 @@ bool BCVerifier(const Graph &g, SourcePicker<Graph> &sp, NodeID num_iters,
verts_at_depth[depths[n]].push_back(n);
}
}
// Going from farthest to clostest, compute "depencies" (deltas)
// Going from farthest to closest, compute "dependencies" (deltas)
pvector<ScoreT> deltas(g.num_nodes(), 0);
for (int depth=verts_at_depth.size()-1; depth >= 0; depth--) {
for (NodeID u : verts_at_depth[depth]) {
Expand Down
2 changes: 1 addition & 1 deletion src/benchmark.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class SourcePicker {
};


// Returns k pairs with largest values from list of key-value pairs
// Returns k pairs with the largest values from list of key-value pairs
template<typename KeyT, typename ValT>
std::vector<std::pair<ValT, KeyT>> TopK(
const std::vector<std::pair<KeyT, ValT>> &to_sort, size_t k) {
Expand Down
2 changes: 1 addition & 1 deletion src/bfs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ false-sharing for the top-down approach, thread-local QueueBuffer's are used.
To save time computing the number of edges exiting the frontier, this
implementation precomputes the degrees in bulk at the beginning by storing
them in parent array as negative numbers. Thus the encoding of parent is:
them in the parent array as negative numbers. Thus, the encoding of parent is:
parent[x] < 0 implies x is unvisited and parent[x] = -out_degree(x)
parent[x] >= 0 implies x been visited
Expand Down
10 changes: 5 additions & 5 deletions src/builder.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ GAP Benchmark Suite
Class: BuilderBase
Author: Scott Beamer
Given arguements from the command line (cli), returns a built graph
- MakeGraph() will parse cli and obtain edgelist and call
MakeGraphFromEL(edgelist) to perform actual graph construction
- edgelist can be from file (reader) or synthetically generated (generator)
Given arguments from the command line (cli), returns a built graph
- MakeGraph() will parse cli and obtain edgelist to call
MakeGraphFromEL(edgelist) to perform the actual graph construction
- edgelist can be from file (Reader) or synthetically generated (Generator)
- Common case: BuilderBase typedef'd (w/ params) to be Builder (benchmark.h)
*/

Expand Down Expand Up @@ -291,7 +291,7 @@ class BuilderBase {
}

/*
Graph Bulding Steps (for CSR):
Graph Building Steps (for CSR):
- Read edgelist once to determine vertex degrees (CountDegrees)
- Determine vertex offsets by a prefix sum (ParallelPrefixSum)
- Allocate storage and set points according to offsets (GenIndex)
Expand Down
3 changes: 1 addition & 2 deletions src/cc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include "command_line.h"
#include "graph.h"
#include "pvector.h"
#include "timer.h"


/*
Expand Down Expand Up @@ -120,7 +119,7 @@ pvector<NodeID> Afforest(const Graph &g, bool logging_enabled = false,
// compression, this value represents the largest intermediate component
NodeID c = SampleFrequentElement(comp, logging_enabled);

// Final 'link' phase over remaining edges (excluding largest component)
// Final 'link' phase over remaining edges (excluding the largest component)
if (!g.directed()) {
#pragma omp parallel for schedule(dynamic, 16384)
for (NodeID u = 0; u < g.num_nodes(); u++) {
Expand Down
1 change: 0 additions & 1 deletion src/cc_sv.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include "command_line.h"
#include "graph.h"
#include "pvector.h"
#include "timer.h"


/*
Expand Down
1 change: 0 additions & 1 deletion src/converter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include "builder.h"
#include "command_line.h"
#include "graph.h"
#include "reader.h"
#include "writer.h"

using namespace std;
Expand Down
4 changes: 2 additions & 2 deletions src/graph.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Author: Scott Beamer
Simple container for graph in CSR format
- Intended to be constructed by a Builder
- To make weighted, set DestID_ template type to NodeWeight
- MakeInverse parameter controls whether graph stores its inverse
- MakeInverse parameter controls whether graph stores incoming edges
*/


Expand Down Expand Up @@ -69,7 +69,7 @@ std::istream& operator>>(std::istream& is, NodeWeight<NodeID_, WeightT_>& nw) {



// Syntatic sugar for an edge
// Syntactic sugar for an edge
template <typename SrcT, typename DstT = SrcT>
struct EdgePair {
SrcT u;
Expand Down
13 changes: 6 additions & 7 deletions src/pr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ Author: Scott Beamer
Will return pagerank scores for all vertices once total change < epsilon
This PR implementation uses the traditional iterative approach. It perform
This PR implementation uses the traditional iterative approach. It performs
updates in the pull direction to remove the need for atomics, and it allows
new values to be immediately visible (like Gauss-Seidel method). The prior PR
implemention is still available in src/pr_spmv.cc.
implementation is still available in src/pr_spmv.cc.
*/


Expand Down Expand Up @@ -68,7 +68,6 @@ void PrintTopScores(const Graph &g, const pvector<ScoreT> &scores) {
}
int k = 5;
vector<pair<ScoreT, NodeID>> top_k = TopK(score_pairs, k);
k = min(k, static_cast<int>(top_k.size()));
for (auto kvp : top_k)
cout << kvp.second << ":" << kvp.first << endl;
}
Expand All @@ -79,16 +78,16 @@ void PrintTopScores(const Graph &g, const pvector<ScoreT> &scores) {
bool PRVerifier(const Graph &g, const pvector<ScoreT> &scores,
double target_error) {
const ScoreT base_score = (1.0f - kDamp) / g.num_nodes();
pvector<ScoreT> incomming_sums(g.num_nodes(), 0);
pvector<ScoreT> incoming_sums(g.num_nodes(), 0);
double error = 0;
for (NodeID u : g.vertices()) {
ScoreT outgoing_contrib = scores[u] / g.out_degree(u);
for (NodeID v : g.out_neigh(u))
incomming_sums[v] += outgoing_contrib;
incoming_sums[v] += outgoing_contrib;
}
for (NodeID n : g.vertices()) {
error += fabs(base_score + kDamp * incomming_sums[n] - scores[n]);
incomming_sums[n] = 0;
error += fabs(base_score + kDamp * incoming_sums[n] - scores[n]);
incoming_sums[n] = 0;
}
PrintTime("Total Error", error);
return error < target_error;
Expand Down
11 changes: 5 additions & 6 deletions src/pr_spmv.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Will return pagerank scores for all vertices once total change < epsilon
This legacy PR implementation uses the traditional iterative approach. This is
done to ease comparisons to other implementations (often use same algorithm),
but it is not necesarily the fastest way to implement it. It performs each
but it is not necessarily the fastest way to implement it. It performs each
iteration as a sparse-matrix vector multiply (SpMV), and values are not visible
until the next iteration (like Jacobi-style method).
*/
Expand Down Expand Up @@ -68,7 +68,6 @@ void PrintTopScores(const Graph &g, const pvector<ScoreT> &scores) {
}
int k = 5;
vector<pair<ScoreT, NodeID>> top_k = TopK(score_pairs, k);
k = min(k, static_cast<int>(top_k.size()));
for (auto kvp : top_k)
cout << kvp.second << ":" << kvp.first << endl;
}
Expand All @@ -79,16 +78,16 @@ void PrintTopScores(const Graph &g, const pvector<ScoreT> &scores) {
bool PRVerifier(const Graph &g, const pvector<ScoreT> &scores,
double target_error) {
const ScoreT base_score = (1.0f - kDamp) / g.num_nodes();
pvector<ScoreT> incomming_sums(g.num_nodes(), 0);
pvector<ScoreT> incoming_sums(g.num_nodes(), 0);
double error = 0;
for (NodeID u : g.vertices()) {
ScoreT outgoing_contrib = scores[u] / g.out_degree(u);
for (NodeID v : g.out_neigh(u))
incomming_sums[v] += outgoing_contrib;
incoming_sums[v] += outgoing_contrib;
}
for (NodeID n : g.vertices()) {
error += fabs(base_score + kDamp * incomming_sums[n] - scores[n]);
incomming_sums[n] = 0;
error += fabs(base_score + kDamp * incoming_sums[n] - scores[n]);
incoming_sums[n] = 0;
}
PrintTime("Total Error", error);
return error < target_error;
Expand Down
4 changes: 2 additions & 2 deletions src/pvector.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ GAP Benchmark Suite
Class: pvector
Author: Scott Beamer
Vector class with ability to not initialize or do initialize in parallel
- std::vector (when resizing) will always initialize, and does it serially
Vector class with ability to not initialize or do initialization in parallel
- std::vector (when resizing) will always initialize, and does so serially
- When pvector is resized, new elements are uninitialized
- Resizing is not thread-safe
*/
Expand Down
2 changes: 1 addition & 1 deletion src/reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class Reader {
std::string GetSuffix() {
std::size_t suff_pos = filename_.rfind('.');
if (suff_pos == std::string::npos) {
std::cout << "Could't find suffix of " << filename_ << std::endl;
std::cout << "Couldn't find suffix of " << filename_ << std::endl;
std::exit(-1);
}
return filename_.substr(suff_pos);
Expand Down
4 changes: 2 additions & 2 deletions src/sssp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ delta parameter (-d) should be set for each input graph. This implementation
incorporates a new bucket fusion optimization [2] that significantly reduces
the number of iterations (& barriers) needed.
The bins of width delta are actually all thread-local and of type std::vector
The bins of width delta are actually all thread-local and of type std::vector,
so they can grow but are otherwise capacity-proportional. Each iteration is
done in two phases separated by barriers. In the first phase, the current
shared bin is processed by all threads. As they find vertices whose distance
Expand All @@ -39,7 +39,7 @@ non-empty bin). In the next phase, each thread copies its selected
thread-local bin into the shared bin.
Once a vertex is added to a bin, it is not removed, even if its distance is
later updated and it now appears in a lower bin. We find ignoring vertices if
later updated and, it now appears in a lower bin. We find ignoring vertices if
their distance is less than the min distance for the current bin removes
enough redundant work to be faster than removing the vertex from older bins.
Expand Down
20 changes: 10 additions & 10 deletions src/tc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ Author: Scott Beamer
Will count the number of triangles (cliques of size 3)
Requires input graph:
- to be undirected
- no duplicate edges (or else will be counted as multiple triangles)
Input graph requirements:
- undirected
- has no duplicate edges (or else will be counted as multiple triangles)
- neighborhoods are sorted by vertex identifiers
Other than symmetrizing, the rest of the requirements are done by SquishCSR
Expand All @@ -38,12 +38,12 @@ once. A naive implementation will count the same triangle six times because
each of the three vertices (u, v, w) will count it in both ways. To count
a triangle only once, this implementation only counts a triangle if u > v > w.
Once the remaining unexamined neighbors identifiers get too big, it can break
out of the loop, but this requires that the neighbors to be sorted.
out of the loop, but this requires that the neighbors are sorted.
Another optimization this implementation has is to relabel the vertices by
degree. This is beneficial if the average degree is high enough and if the
degree distribution is sufficiently non-uniform. To decide whether or not
to relabel the graph, we use the heuristic in WorthRelabelling.
This implementation relabels the vertices by degree. This optimization is
beneficial if the average degree is sufficiently high and if the degree
distribution is sufficiently non-uniform. To decide whether to relabel the
graph, we use the heuristic in WorthRelabelling.
*/


Expand Down Expand Up @@ -71,7 +71,7 @@ size_t OrderedCount(const Graph &g) {
}


// heuristic to see if sufficently dense power-law graph
// Heuristic to see if sufficiently dense power-law graph
bool WorthRelabelling(const Graph &g) {
int64_t average_degree = g.num_edges() / g.num_nodes();
if (average_degree < 10)
Expand All @@ -91,7 +91,7 @@ bool WorthRelabelling(const Graph &g) {
}


// uses heuristic to see if worth relabeling
// Uses heuristic to see if worth relabeling
size_t Hybrid(const Graph &g) {
if (WorthRelabelling(g))
return OrderedCount(Builder::RelabelByDegree(g));
Expand Down

0 comments on commit dabb16b

Please sign in to comment.