Skip to content

Commit 3009f8e

Browse files
committed
applied clang-format
1 parent 2010c4f commit 3009f8e

276 files changed

Lines changed: 17767 additions & 19034 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

apps/bsp_test_suite.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ limitations under the License.
2626
using graph_t = osp::computational_dag_edge_idx_vector_impl_def_int_t;
2727

2828
int main(int argc, char *argv[]) {
29-
3029
osp::BspScheduleRecompTestSuiteRunner<graph_t> runner;
3130
return runner.run(argc, argv);
3231

apps/coarser_plotter.cpp

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ int main(int argc, char *argv[]) {
3535
}
3636

3737
std::string graph_file = argv[1];
38-
std::string graph_name = graph_file.substr(graph_file.rfind("/") + 1,
39-
graph_file.rfind(".") - graph_file.rfind("/") - 1);
40-
38+
std::string graph_name = graph_file.substr(graph_file.rfind("/") + 1, graph_file.rfind(".") - graph_file.rfind("/") - 1);
4139

4240
Graph_t graph;
4341
bool status = file_reader::readGraph(graph_file, graph);
@@ -46,8 +44,7 @@ int main(int argc, char *argv[]) {
4644
return 1;
4745
}
4846

49-
50-
SarkarParams::MulParameters< v_workw_t<Graph_t> > params;
47+
SarkarParams::MulParameters<v_workw_t<Graph_t>> params;
5148
params.commCostVec = std::vector<v_workw_t<Graph_t>>({1, 2, 5, 10, 20, 50, 100, 200, 500, 1000});
5249
params.max_num_iteration_without_changes = 3;
5350
params.leniency = 0.005;
@@ -63,19 +60,15 @@ int main(int argc, char *argv[]) {
6360

6461
Graph_t graph_copy = graph;
6562
bool ignore_vertex_types = false;
66-
63+
6764
if (ignore_vertex_types) {
68-
for (const auto &vert : graph_copy.vertices()) {
69-
graph_copy.set_vertex_type(vert, 0);
70-
}
65+
for (const auto &vert : graph_copy.vertices()) { graph_copy.set_vertex_type(vert, 0); }
7166
}
7267

7368
coarser.coarsenDag(graph_copy, coarse_graph, contraction_map);
7469

7570
std::vector<unsigned> colours(contraction_map.size());
76-
for (std::size_t i = 0; i < contraction_map.size(); ++i) {
77-
colours[i] = static_cast<unsigned>( contraction_map[i] );
78-
}
71+
for (std::size_t i = 0; i < contraction_map.size(); ++i) { colours[i] = static_cast<unsigned>(contraction_map[i]); }
7972

8073
std::ofstream out_dot(argv[2]);
8174
if (!out_dot.is_open()) {
@@ -86,7 +79,7 @@ int main(int argc, char *argv[]) {
8679
DotFileWriter writer;
8780
writer.write_colored_graph(out_dot, graph, colours);
8881

89-
if (argc >=4 ) {
82+
if (argc >= 4) {
9083
std::ofstream coarse_out_dot(argv[3]);
9184
if (!coarse_out_dot.is_open()) {
9285
std::cout << "Unable to write/open output file.\n";
@@ -100,4 +93,4 @@ int main(int argc, char *argv[]) {
10093
}
10194

10295
return 0;
103-
}
96+
}

apps/graph_analyser.cpp

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ limitations under the License.
2323
#include <string>
2424
#include <vector>
2525

26+
#include "osp/auxiliary/io/bsp_schedule_file_writer.hpp"
27+
#include "osp/auxiliary/io/general_file_reader.hpp"
2628
#include "osp/auxiliary/misc.hpp"
2729
#include "osp/graph_algorithms/directed_graph_path_util.hpp"
2830
#include "osp/graph_implementations/adj_list_impl/computational_dag_edge_idx_vector_impl.hpp"
29-
#include "osp/auxiliary/io/bsp_schedule_file_writer.hpp"
30-
#include "osp/auxiliary/io/general_file_reader.hpp"
3131

3232
using namespace osp;
3333

@@ -46,20 +46,14 @@ void add_graph_stats(const ComputationalDag &graph, std::ofstream &outfile) {
4646

4747
edge_lengths.emplace(diff);
4848
sum_edge_length += diff;
49-
if (diff == 1) {
50-
short_edges += 1;
51-
}
49+
if (diff == 1) { short_edges += 1; }
5250
}
5351
unsigned median_edge_length = 0;
54-
if (!edge_lengths.empty()) {
55-
median_edge_length = Get_Median(edge_lengths);
56-
}
52+
if (!edge_lengths.empty()) { median_edge_length = Get_Median(edge_lengths); }
5753

5854
Get_Median(edge_lengths);
5955

60-
if (graph.num_edges() != 0) {
61-
avg_edge_length = static_cast<float>(sum_edge_length) / static_cast<float>(graph.num_edges());
62-
}
56+
if (graph.num_edges() != 0) { avg_edge_length = static_cast<float>(sum_edge_length) / static_cast<float>(graph.num_edges()); }
6357

6458
// Longest Path
6559
unsigned longest_path = 1;
@@ -77,9 +71,7 @@ void add_graph_stats(const ComputationalDag &graph, std::ofstream &outfile) {
7771
// Average bottom distance
7872
std::vector<unsigned> bot_level = get_bottom_node_distance(graph);
7973
size_t bot_level_sum = 0;
80-
for (size_t i = 0; i < bot_level.size(); i++) {
81-
bot_level_sum += bot_level[i];
82-
}
74+
for (size_t i = 0; i < bot_level.size(); i++) { bot_level_sum += bot_level[i]; }
8375
float avg_bot_level = static_cast<float>(bot_level_sum) / static_cast<float>(bot_level.size());
8476

8577
// // Number of Triangles
@@ -151,22 +143,20 @@ int main(int argc, char *argv[]) {
151143
<< std::endl;
152144

153145
for (const auto &dirEntry : std::filesystem::recursive_directory_iterator(graph_dir)) {
154-
if (std::filesystem::is_directory(dirEntry))
155-
continue;
146+
if (std::filesystem::is_directory(dirEntry)) { continue; }
156147

157148
std::cout << "Processing: " << dirEntry << std::endl;
158149

159150
std::string path_str = dirEntry.path();
160-
151+
161152
ComputationalDag graph;
162153
bool status = file_reader::readGraph(dirEntry.path(), graph);
163154
if (!status) {
164155
std::cout << "Failed to read graph\n";
165156
return 1;
166-
}
157+
}
167158

168-
if (!status)
169-
continue;
159+
if (!status) { continue; }
170160

171161
std::string graph_name = path_str.substr(path_str.rfind("/") + 1);
172162
graph_name = graph_name.substr(0, graph_name.rfind("."));
@@ -177,4 +167,4 @@ int main(int argc, char *argv[]) {
177167
}
178168

179169
return 0;
180-
}
170+
}

apps/graph_converter.cpp

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,19 @@ void print_usage(const char *prog_name) {
3333
std::cerr << "Graph Format Converter" << std::endl;
3434
std::cerr << "----------------------" << std::endl;
3535
std::cerr << "This tool converts a directed graph from one file format to another. The desired output" << std::endl;
36-
std::cerr << "format is determined by the file extension of the output file." << std::endl
37-
<< std::endl;
36+
std::cerr << "format is determined by the file extension of the output file." << std::endl << std::endl;
3837
std::cerr << "Usage: " << prog_name << " <input_file> <output_file>" << std::endl << std::endl;
3938
std::cerr << "Arguments:" << std::endl;
40-
std::cerr << " <input_file> Path to the input graph file." << std::endl
41-
<< std::endl;
39+
std::cerr << " <input_file> Path to the input graph file." << std::endl << std::endl;
4240
std::cerr << " <output_file> Path for the output graph file. Special values of '.dot' or '.hdag' can be" << std::endl;
4341
std::cerr << " used to automatically generate the output filename by replacing the input" << std::endl;
4442
std::cerr << " file's extension with the specified one." << std::endl;
4543
std::cerr << std::endl;
4644
std::cerr << "Supported Formats:" << std::endl;
4745
std::cerr << " Input (by extension): .hdag, .mtx, .dot" << std::endl;
48-
std::cerr << " Output (by extension): .hdag, .dot" << std::endl
49-
<< std::endl;
46+
std::cerr << " Output (by extension): .hdag, .dot" << std::endl << std::endl;
5047
std::cerr << "The .hdag format is the HyperdagDB format. A detailed description can be found at:" << std::endl;
51-
std::cerr << "https://github.com/Algebraic-Programming/HyperDAG_DB" << std::endl
52-
<< std::endl;
48+
std::cerr << "https://github.com/Algebraic-Programming/HyperDAG_DB" << std::endl << std::endl;
5349
std::cerr << "Examples:" << std::endl;
5450
std::cerr << " " << prog_name << " my_graph.mtx my_graph.hdag" << std::endl;
5551
std::cerr << " " << prog_name << " my_graph.hdag my_graph.dot" << std::endl;
@@ -98,8 +94,8 @@ int main(int argc, char *argv[]) {
9894
return 1;
9995
}
10096

101-
std::cout << "Successfully read graph with " << graph.num_vertices() << " vertices and " << graph.num_edges()
102-
<< " edges." << std::endl;
97+
std::cout << "Successfully read graph with " << graph.num_vertices() << " vertices and " << graph.num_edges() << " edges."
98+
<< std::endl;
10399

104100
std::filesystem::path output_path(output_filename);
105101
std::string output_ext = output_path.extension().string();
@@ -118,4 +114,4 @@ int main(int argc, char *argv[]) {
118114
std::cout << "Successfully wrote graph to " << output_filename << std::endl;
119115

120116
return 0;
121-
}
117+
}

apps/graph_generator/gen_Erdos-Renyi_graph.cpp

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,34 +16,31 @@ limitations under the License.
1616
@author Toni Boehnlein, Benjamin Lozes, Pal Andras Papp, Raphael S. Steiner
1717
*/
1818

19-
#include "osp/auxiliary/misc.hpp"
20-
#include "osp/auxiliary/random_graph_generator/Erdos_Renyi_graph.hpp"
21-
#include "osp/graph_implementations/adj_list_impl/computational_dag_vector_impl.hpp"
22-
2319
#include <fstream>
2420
#include <iostream>
2521
#include <random>
2622
#include <string>
2723

24+
#include "osp/auxiliary/misc.hpp"
25+
#include "osp/auxiliary/random_graph_generator/Erdos_Renyi_graph.hpp"
26+
#include "osp/graph_implementations/adj_list_impl/computational_dag_vector_impl.hpp"
27+
2828
using namespace osp;
2929

3030
using ComputationalDag = computational_dag_vector_impl_def_int_t;
3131
using VertexType = vertex_idx_t<ComputationalDag>;
3232

3333
int main(int argc, char *argv[]) {
3434
if (argc < 3) {
35-
std::cerr << "Usage: " << argv[0]
36-
<< " <number of vertices> <expected outdegree> (optional:) <number of graphs>\n"
35+
std::cerr << "Usage: " << argv[0] << " <number of vertices> <expected outdegree> (optional:) <number of graphs>\n"
3736
<< std::endl;
3837
return 1;
3938
}
4039

4140
size_t num_vert = static_cast<size_t>(std::stoul(argv[1]));
4241
double chance = 2 * std::atof(argv[2]);
4342
unsigned num_graphs = 1;
44-
if (argc > 3) {
45-
num_graphs = static_cast<unsigned>(std::stoul(argv[3]));
46-
}
43+
if (argc > 3) { num_graphs = static_cast<unsigned>(std::stoul(argv[3])); }
4744

4845
// Initiating random values
4946
double lower_bound = -2;
@@ -97,19 +94,18 @@ int main(int argc, char *argv[]) {
9794
std::ofstream graph_write;
9895
graph_write.open(graph_name);
9996
graph_write << header;
100-
graph_write << std::to_string(graph.num_vertices()) + " " + std::to_string(graph.num_vertices()) + " " +
101-
std::to_string(graph.num_edges() + graph.num_vertices()) + "\n";
97+
graph_write << std::to_string(graph.num_vertices()) + " " + std::to_string(graph.num_vertices()) + " "
98+
+ std::to_string(graph.num_edges() + graph.num_vertices()) + "\n";
10299
for (VertexType i = 0; i < num_vert; i++) {
103100
double val = (1 - 2 * randInt(2)) * std::exp(unif_log(re));
104101
graph_write << std::to_string(i + 1) + " " + std::to_string(i + 1) + " " + std::to_string(val) + "\n";
105102
for (const auto &chld : graph.children(i)) {
106103
val = unif(re);
107-
graph_write << std::to_string(chld + 1) + " " + std::to_string(i + 1) + " " + std::to_string(val) +
108-
"\n";
104+
graph_write << std::to_string(chld + 1) + " " + std::to_string(i + 1) + " " + std::to_string(val) + "\n";
109105
}
110106
}
111107
graph_write.close();
112108
}
113109

114110
return 0;
115-
}
111+
}

apps/graph_generator/gen_near_diag_random_graph.cpp

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,23 @@ limitations under the License.
1616
@author Toni Boehnlein, Benjamin Lozes, Pal Andras Papp, Raphael S. Steiner
1717
*/
1818

19-
#include "osp/auxiliary/misc.hpp"
20-
#include "osp/auxiliary/random_graph_generator/near_diagonal_random_graph.hpp"
21-
#include "osp/graph_implementations/adj_list_impl/computational_dag_vector_impl.hpp"
22-
2319
#include <fstream>
2420
#include <iostream>
2521
#include <random>
2622
#include <string>
2723

24+
#include "osp/auxiliary/misc.hpp"
25+
#include "osp/auxiliary/random_graph_generator/near_diagonal_random_graph.hpp"
26+
#include "osp/graph_implementations/adj_list_impl/computational_dag_vector_impl.hpp"
27+
2828
using namespace osp;
2929

3030
using ComputationalDag = computational_dag_vector_impl_def_int_t;
3131
using VertexType = vertex_idx_t<ComputationalDag>;
3232

3333
int main(int argc, char *argv[]) {
3434
if (argc < 4) {
35-
std::cerr << "Usage: " << argv[0]
36-
<< " <number of vertices> <probability> <bandwidth> (optional:) <number of graphs>\n"
35+
std::cerr << "Usage: " << argv[0] << " <number of vertices> <probability> <bandwidth> (optional:) <number of graphs>\n"
3736
<< std::endl;
3837
return 1;
3938
}
@@ -42,9 +41,7 @@ int main(int argc, char *argv[]) {
4241
double prob = std::atof(argv[2]);
4342
double bandwidth = std::atof(argv[3]);
4443
unsigned num_graphs = 1;
45-
if (argc > 4) {
46-
num_graphs = static_cast<unsigned>(std::stoul(argv[3]));
47-
}
44+
if (argc > 4) { num_graphs = static_cast<unsigned>(std::stoul(argv[3])); }
4845

4946
// std::cout << "Vert: " << num_vert << " prob: " << prob << " bandwidth: " << bandwidth << " graphs: " <<
5047
// num_graphs << std::endl;
@@ -103,19 +100,18 @@ int main(int argc, char *argv[]) {
103100
std::ofstream graph_write;
104101
graph_write.open(graph_name);
105102
graph_write << header;
106-
graph_write << std::to_string(graph.num_vertices()) + " " + std::to_string(graph.num_vertices()) + " " +
107-
std::to_string(graph.num_edges() + graph.num_vertices()) + "\n";
103+
graph_write << std::to_string(graph.num_vertices()) + " " + std::to_string(graph.num_vertices()) + " "
104+
+ std::to_string(graph.num_edges() + graph.num_vertices()) + "\n";
108105
for (VertexType j = 0; j < num_vert; j++) {
109106
double val = (1 - 2 * randInt(2)) * std::exp(unif_log(re));
110107
graph_write << std::to_string(j + 1) + " " + std::to_string(j + 1) + " " + std::to_string(val) + "\n";
111108
for (const auto &chld : graph.children(j)) {
112109
val = unif(re);
113-
graph_write << std::to_string(chld + 1) + " " + std::to_string(j + 1) + " " + std::to_string(val) +
114-
"\n";
110+
graph_write << std::to_string(chld + 1) + " " + std::to_string(j + 1) + " " + std::to_string(val) + "\n";
115111
}
116112
}
117113
graph_write.close();
118114
}
119115

120116
return 0;
121-
}
117+
}

apps/graph_generator/post_incomplete_cholesky.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,15 @@ limitations under the License.
1515
1616
@author Christos Matzoros, Toni Boehnlein, Pal Andras Papp, Raphael S. Steiner
1717
*/
18+
#include <Eigen/Core>
19+
#include <Eigen/Dense>
20+
#include <Eigen/IterativeLinearSolvers>
21+
#include <Eigen/OrderingMethods>
22+
#include <Eigen/SparseCore>
1823
#include <filesystem>
1924
#include <string>
20-
#include <vector>
21-
22-
#include <Eigen/SparseCore>
23-
#include <Eigen/IterativeLinearSolvers>
2425
#include <unsupported/Eigen/SparseExtra>
25-
#include <Eigen/Dense>
26-
#include <Eigen/Core>
27-
#include <Eigen/OrderingMethods>
26+
#include <vector>
2827

2928
int main(int argc, char *argv[]) {
3029
if (argc < 2) {
@@ -38,21 +37,22 @@ int main(int argc, char *argv[]) {
3837
name_graph = name_graph.substr(0, name_graph.find_last_of("."));
3938

4039
std::cout << "Graph: " << name_graph << std::endl;
41-
42-
using SM_csc = Eigen::SparseMatrix<double, Eigen::ColMajor, int32_t>; // Compressed Sparse Column format
43-
using SM_csr = Eigen::SparseMatrix<double, Eigen::RowMajor, int32_t>; // Compressed Sparse Row format
4440

45-
SM_csc L_csc; // Initialize a sparse matrix in CSC format
41+
using SM_csc = Eigen::SparseMatrix<double, Eigen::ColMajor, int32_t>; // Compressed Sparse Column format
42+
using SM_csr = Eigen::SparseMatrix<double, Eigen::RowMajor, int32_t>; // Compressed Sparse Row format
43+
44+
SM_csc L_csc; // Initialize a sparse matrix in CSC format
4645

4746
Eigen::loadMarket(L_csc, filename_graph);
4847

49-
SM_csr L_csr = L_csc; // Reformat the sparse matrix from CSC to CSR format
48+
SM_csr L_csr = L_csc; // Reformat the sparse matrix from CSC to CSR format
5049

5150
Eigen::IncompleteCholesky<double, Eigen::Lower, Eigen::AMDOrdering<int>> ichol(L_csc);
5251

5352
SM_csc LChol_csc = ichol.matrixL();
5453

55-
Eigen::saveMarket(LChol_csc, filename_graph.substr(0, filename_graph.find_last_of(".")) + "_postChol.mtx", Eigen::UpLoType::Symmetric);
54+
Eigen::saveMarket(
55+
LChol_csc, filename_graph.substr(0, filename_graph.find_last_of(".")) + "_postChol.mtx", Eigen::UpLoType::Symmetric);
5656

5757
return 0;
58-
}
58+
}

0 commit comments

Comments
 (0)