Skip to content

Commit 95c5d77

Browse files
authored
Clang format new (#67)
* clang files * applyied clang-format * added headers back
1 parent 60d340a commit 95c5d77

File tree

279 files changed

+18376
-15950
lines changed

Some content is hidden

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

279 files changed

+18376
-15950
lines changed

.clang-format

Lines changed: 264 additions & 64 deletions
Large diffs are not rendered by default.

.clang-tidy

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Checks: '-*,readability-identifier-naming'
2+
3+
CheckOptions:
4+
# 1. Member Variables: camelBack with a trailing underscore (e.g., memberVariableTest_)
5+
- key: readability-identifier-naming.MemberCase
6+
value: camelBack
7+
- key: readability-identifier-naming.MemberSuffix
8+
value: _
9+
10+
# 2. Functions: CamelCase (e.g., CalculateTotal)
11+
- key: readability-identifier-naming.FunctionCase
12+
value: CamelCase
13+
14+
# 3. Local Variables/Parameters: camelBack (e.g., totalValue)
15+
- key: readability-identifier-naming.VariableCase
16+
value: camelBack
17+
- key: readability-identifier-naming.ParameterCase
18+
value: camelBack
19+
20+
# 4. Classes/Structs: CamelCase (e.g., MyClass)
21+
- key: readability-identifier-naming.ClassCase
22+
value: CamelCase
23+
- key: readability-identifier-naming.StructCase
24+
value: CamelCase

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: 6 additions & 9 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,7 +60,7 @@ 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) {
6865
for (const auto &vert : graph_copy.vertices()) {
6966
graph_copy.set_vertex_type(vert, 0);
@@ -74,7 +71,7 @@ int main(int argc, char *argv[]) {
7471

7572
std::vector<unsigned> colours(contraction_map.size());
7673
for (std::size_t i = 0; i < contraction_map.size(); ++i) {
77-
colours[i] = static_cast<unsigned>( contraction_map[i] );
74+
colours[i] = static_cast<unsigned>(contraction_map[i]);
7875
}
7976

8077
std::ofstream out_dot(argv[2]);
@@ -86,7 +83,7 @@ int main(int argc, char *argv[]) {
8683
DotFileWriter writer;
8784
writer.write_colored_graph(out_dot, graph, colours);
8885

89-
if (argc >=4 ) {
86+
if (argc >= 4) {
9087
std::ofstream coarse_out_dot(argv[3]);
9188
if (!coarse_out_dot.is_open()) {
9289
std::cout << "Unable to write/open output file.\n";
@@ -100,4 +97,4 @@ int main(int argc, char *argv[]) {
10097
}
10198

10299
return 0;
103-
}
100+
}

apps/graph_analyser.cpp

Lines changed: 9 additions & 7 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

@@ -151,22 +151,24 @@ int main(int argc, char *argv[]) {
151151
<< std::endl;
152152

153153
for (const auto &dirEntry : std::filesystem::recursive_directory_iterator(graph_dir)) {
154-
if (std::filesystem::is_directory(dirEntry))
154+
if (std::filesystem::is_directory(dirEntry)) {
155155
continue;
156+
}
156157

157158
std::cout << "Processing: " << dirEntry << std::endl;
158159

159160
std::string path_str = dirEntry.path();
160-
161+
161162
ComputationalDag graph;
162163
bool status = file_reader::readGraph(dirEntry.path(), graph);
163164
if (!status) {
164165
std::cout << "Failed to read graph\n";
165166
return 1;
166-
}
167+
}
167168

168-
if (!status)
169+
if (!status) {
169170
continue;
171+
}
170172

171173
std::string graph_name = path_str.substr(path_str.rfind("/") + 1);
172174
graph_name = graph_name.substr(0, graph_name.rfind("."));
@@ -177,4 +179,4 @@ int main(int argc, char *argv[]) {
177179
}
178180

179181
return 0;
180-
}
182+
}

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: 9 additions & 11 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/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
}
@@ -97,19 +96,18 @@ int main(int argc, char *argv[]) {
9796
std::ofstream graph_write;
9897
graph_write.open(graph_name);
9998
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";
99+
graph_write << std::to_string(graph.num_vertices()) + " " + std::to_string(graph.num_vertices()) + " "
100+
+ std::to_string(graph.num_edges() + graph.num_vertices()) + "\n";
102101
for (VertexType i = 0; i < num_vert; i++) {
103102
double val = (1 - 2 * randInt(2)) * std::exp(unif_log(re));
104103
graph_write << std::to_string(i + 1) + " " + std::to_string(i + 1) + " " + std::to_string(val) + "\n";
105104
for (const auto &chld : graph.children(i)) {
106105
val = unif(re);
107-
graph_write << std::to_string(chld + 1) + " " + std::to_string(i + 1) + " " + std::to_string(val) +
108-
"\n";
106+
graph_write << std::to_string(chld + 1) + " " + std::to_string(i + 1) + " " + std::to_string(val) + "\n";
109107
}
110108
}
111109
graph_write.close();
112110
}
113111

114112
return 0;
115-
}
113+
}

apps/graph_generator/gen_near_diag_random_graph.cpp

Lines changed: 9 additions & 11 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
}
@@ -103,19 +102,18 @@ int main(int argc, char *argv[]) {
103102
std::ofstream graph_write;
104103
graph_write.open(graph_name);
105104
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";
105+
graph_write << std::to_string(graph.num_vertices()) + " " + std::to_string(graph.num_vertices()) + " "
106+
+ std::to_string(graph.num_edges() + graph.num_vertices()) + "\n";
108107
for (VertexType j = 0; j < num_vert; j++) {
109108
double val = (1 - 2 * randInt(2)) * std::exp(unif_log(re));
110109
graph_write << std::to_string(j + 1) + " " + std::to_string(j + 1) + " " + std::to_string(val) + "\n";
111110
for (const auto &chld : graph.children(j)) {
112111
val = unif(re);
113-
graph_write << std::to_string(chld + 1) + " " + std::to_string(j + 1) + " " + std::to_string(val) +
114-
"\n";
112+
graph_write << std::to_string(chld + 1) + " " + std::to_string(j + 1) + " " + std::to_string(val) + "\n";
115113
}
116114
}
117115
graph_write.close();
118116
}
119117

120118
return 0;
121-
}
119+
}

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)