Skip to content

Commit dc82427

Browse files
committed
one line if
1 parent 4ce1047 commit dc82427

192 files changed

Lines changed: 4953 additions & 1651 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/coarser_plotter.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,17 @@ int main(int argc, char *argv[]) {
6262
bool ignore_vertex_types = false;
6363

6464
if (ignore_vertex_types) {
65-
for (const auto &vert : graph_copy.vertices()) { graph_copy.set_vertex_type(vert, 0); }
65+
for (const auto &vert : graph_copy.vertices()) {
66+
graph_copy.set_vertex_type(vert, 0);
67+
}
6668
}
6769

6870
coarser.coarsenDag(graph_copy, coarse_graph, contraction_map);
6971

7072
std::vector<unsigned> colours(contraction_map.size());
71-
for (std::size_t i = 0; i < contraction_map.size(); ++i) { colours[i] = static_cast<unsigned>(contraction_map[i]); }
73+
for (std::size_t i = 0; i < contraction_map.size(); ++i) {
74+
colours[i] = static_cast<unsigned>(contraction_map[i]);
75+
}
7276

7377
std::ofstream out_dot(argv[2]);
7478
if (!out_dot.is_open()) {

apps/graph_analyser.cpp

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,20 @@ 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) { short_edges += 1; }
49+
if (diff == 1) {
50+
short_edges += 1;
51+
}
5052
}
5153
unsigned median_edge_length = 0;
52-
if (!edge_lengths.empty()) { median_edge_length = Get_Median(edge_lengths); }
54+
if (!edge_lengths.empty()) {
55+
median_edge_length = Get_Median(edge_lengths);
56+
}
5357

5458
Get_Median(edge_lengths);
5559

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

5864
// Longest Path
5965
unsigned longest_path = 1;
@@ -71,7 +77,9 @@ void add_graph_stats(const ComputationalDag &graph, std::ofstream &outfile) {
7177
// Average bottom distance
7278
std::vector<unsigned> bot_level = get_bottom_node_distance(graph);
7379
size_t bot_level_sum = 0;
74-
for (size_t i = 0; i < bot_level.size(); i++) { bot_level_sum += bot_level[i]; }
80+
for (size_t i = 0; i < bot_level.size(); i++) {
81+
bot_level_sum += bot_level[i];
82+
}
7583
float avg_bot_level = static_cast<float>(bot_level_sum) / static_cast<float>(bot_level.size());
7684

7785
// // Number of Triangles
@@ -143,7 +151,9 @@ int main(int argc, char *argv[]) {
143151
<< std::endl;
144152

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

148158
std::cout << "Processing: " << dirEntry << std::endl;
149159

@@ -156,7 +166,9 @@ int main(int argc, char *argv[]) {
156166
return 1;
157167
}
158168

159-
if (!status) { continue; }
169+
if (!status) {
170+
continue;
171+
}
160172

161173
std::string graph_name = path_str.substr(path_str.rfind("/") + 1);
162174
graph_name = graph_name.substr(0, graph_name.rfind("."));

apps/graph_generator/gen_Erdos-Renyi_graph.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ int main(int argc, char *argv[]) {
4040
size_t num_vert = static_cast<size_t>(std::stoul(argv[1]));
4141
double chance = 2 * std::atof(argv[2]);
4242
unsigned num_graphs = 1;
43-
if (argc > 3) { num_graphs = static_cast<unsigned>(std::stoul(argv[3])); }
43+
if (argc > 3) {
44+
num_graphs = static_cast<unsigned>(std::stoul(argv[3]));
45+
}
4446

4547
// Initiating random values
4648
double lower_bound = -2;

apps/graph_generator/gen_near_diag_random_graph.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ int main(int argc, char *argv[]) {
4141
double prob = std::atof(argv[2]);
4242
double bandwidth = std::atof(argv[3]);
4343
unsigned num_graphs = 1;
44-
if (argc > 4) { num_graphs = static_cast<unsigned>(std::stoul(argv[3])); }
44+
if (argc > 4) {
45+
num_graphs = static_cast<unsigned>(std::stoul(argv[3]));
46+
}
4547

4648
// std::cout << "Vert: " << num_vert << " prob: " << prob << " bandwidth: " << bandwidth << " graphs: " <<
4749
// num_graphs << std::endl;

apps/ilp_hypergraph_partitioner.cpp

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,9 @@ int main(int argc, char *argv[]) {
8585
if (file_ending == "hdag") {
8686
graph dag;
8787
file_status = file_reader::readComputationalDagHyperdagFormatDB(filename_hgraph, dag);
88-
if (file_status) { instance.getHypergraph() = convert_from_cdag_as_hyperdag<hypergraph, graph>(dag); }
88+
if (file_status) {
89+
instance.getHypergraph() = convert_from_cdag_as_hyperdag<hypergraph, graph>(dag);
90+
}
8991
} else if (file_ending == "mtx") {
9092
file_status = file_reader::readHypergraphMartixMarketFormat(filename_hgraph, instance.getHypergraph());
9193
} else {
@@ -105,8 +107,12 @@ int main(int argc, char *argv[]) {
105107
for (size_t node = 0; node < instance.getHypergraph().num_vertices(); ++node) {
106108
initial_partition.setAssignedPartition(node, static_cast<unsigned>(node % static_cast<size_t>(nr_parts)));
107109
}
108-
if (nr_parts == 2) { fm.ImprovePartitioning(initial_partition); }
109-
if (nr_parts == 4 || nr_parts == 8 || nr_parts == 16 || nr_parts == 32) { fm.RecursiveFM(initial_partition); }
110+
if (nr_parts == 2) {
111+
fm.ImprovePartitioning(initial_partition);
112+
}
113+
if (nr_parts == 4 || nr_parts == 8 || nr_parts == 16 || nr_parts == 32) {
114+
fm.RecursiveFM(initial_partition);
115+
}
110116

111117
if (replicate > 0) {
112118
PartitioningWithReplication<hypergraph> partition(instance);
@@ -115,7 +121,9 @@ int main(int argc, char *argv[]) {
115121
for (size_t node = 0; node < instance.getHypergraph().num_vertices(); ++node) {
116122
partition.setAssignedPartitions(node, {initial_partition.assignedPartition(node)});
117123
}
118-
if (partition.satisfiesBalanceConstraint()) { partitioner.setUseInitialSolution(true); }
124+
if (partition.satisfiesBalanceConstraint()) {
125+
partitioner.setUseInitialSolution(true);
126+
}
119127

120128
partitioner.setTimeLimitSeconds(600);
121129
if (replicate == 2) {
@@ -143,7 +151,9 @@ int main(int argc, char *argv[]) {
143151
for (size_t node = 0; node < instance.getHypergraph().num_vertices(); ++node) {
144152
partition.setAssignedPartition(node, initial_partition.assignedPartition(node));
145153
}
146-
if (partition.satisfiesBalanceConstraint()) { partitioner.setUseInitialSolution(true); }
154+
if (partition.satisfiesBalanceConstraint()) {
155+
partitioner.setUseInitialSolution(true);
156+
}
147157

148158
partitioner.setTimeLimitSeconds(600);
149159

apps/osp.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,9 @@ int main(int argc, char *argv[]) {
182182

183183
int tw = 1, ww = 1, cw = 1, nsw = 1, ct = 1;
184184
for (size_t i = 0; i < parser.scheduler.size(); i++) {
185-
if (schedulers_failed[i]) { continue; }
185+
if (schedulers_failed[i]) {
186+
continue;
187+
}
186188
tw = std::max(tw, 1 + int(std::log10(schedulers_costs[i])));
187189
ww = std::max(ww, 1 + int(std::log10(schedulers_work_costs[i])));
188190
cw = std::max(cw, 1 + int(std::log10(schedulers_costs[i] - schedulers_work_costs[i])));

apps/test_suite_runner/AbstractTestSuiteRunner.hpp

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,14 @@ class AbstractTestSuiteRunner {
7474
= parser.global_params.get_child("outputSchedule").get_value_optional<bool>().value_or(false);
7575

7676
graph_dir_path = parser.global_params.get_child("graphDirectory").get_value<std::string>();
77-
if (graph_dir_path.substr(0, 1) != "/") { graph_dir_path = executable_dir + graph_dir_path; }
77+
if (graph_dir_path.substr(0, 1) != "/") {
78+
graph_dir_path = executable_dir + graph_dir_path;
79+
}
7880

7981
machine_dir_path = parser.global_params.get_child("archDirectory").get_value<std::string>();
80-
if (machine_dir_path.substr(0, 1) != "/") { machine_dir_path = executable_dir + machine_dir_path; }
82+
if (machine_dir_path.substr(0, 1) != "/") {
83+
machine_dir_path = executable_dir + machine_dir_path;
84+
}
8185

8286
if (write_target_object_to_file) {
8387
output_target_object_dir_path = parser.global_params.get_child("scheduleDirectory").get_value<std::string>();
@@ -90,7 +94,9 @@ class AbstractTestSuiteRunner {
9094
}
9195

9296
log_file_path = parser.global_params.get_child("outputLogFile").get_value<std::string>();
93-
if (log_file_path.substr(0, 1) != "/") { log_file_path = executable_dir + log_file_path; }
97+
if (log_file_path.substr(0, 1) != "/") {
98+
log_file_path = executable_dir + log_file_path;
99+
}
94100

95101
statistics_output_file_path = parser.global_params.get_child("outputStatsFile").get_value<std::string>();
96102
if (statistics_output_file_path.substr(0, 1) != "/") {
@@ -106,7 +112,9 @@ class AbstractTestSuiteRunner {
106112

107113
virtual void setup_log_file() {
108114
log_stream.open(log_file_path, std::ios_base::app);
109-
if (!log_stream.is_open()) { std::cerr << "Error: Could not open log file: " << log_file_path << std::endl; }
115+
if (!log_stream.is_open()) {
116+
std::cerr << "Error: Could not open log file: " << log_file_path << std::endl;
117+
}
110118
}
111119

112120
virtual void setup_statistics_file() {
@@ -140,7 +148,9 @@ class AbstractTestSuiteRunner {
140148
for (size_t i = 0; i < all_csv_headers.size(); ++i) {
141149
expected_header_line += all_csv_headers[i] + (i == all_csv_headers.size() - 1 ? "" : ",");
142150
}
143-
if (first_line_in_file == expected_header_line) { file_exists_and_has_header = true; }
151+
if (first_line_in_file == expected_header_line) {
152+
file_exists_and_has_header = true;
153+
}
144154
stats_file_check.close();
145155
}
146156

@@ -172,8 +182,12 @@ class AbstractTestSuiteRunner {
172182
AbstractTestSuiteRunner() {}
173183

174184
virtual ~AbstractTestSuiteRunner() {
175-
if (log_stream.is_open()) { log_stream.close(); }
176-
if (stats_out_stream.is_open()) { stats_out_stream.close(); }
185+
if (log_stream.is_open()) {
186+
log_stream.close();
187+
}
188+
if (stats_out_stream.is_open()) {
189+
stats_out_stream.close();
190+
}
177191
}
178192

179193
int run(int argc, char *argv[]) {
@@ -184,7 +198,9 @@ class AbstractTestSuiteRunner {
184198
return 1;
185199
}
186200

187-
if (!parse_common_config()) { return 1; }
201+
if (!parse_common_config()) {
202+
return 1;
203+
}
188204

189205
setup_log_file();
190206

@@ -202,7 +218,9 @@ class AbstractTestSuiteRunner {
202218
create_and_register_statistic_modules(module_name);
203219
}
204220

205-
if (active_stats_modules.empty()) { log_stream << "No active statistic modules configured or loaded." << std::endl; }
221+
if (active_stats_modules.empty()) {
222+
log_stream << "No active statistic modules configured or loaded." << std::endl;
223+
}
206224

207225
setup_statistics_file();
208226

@@ -213,7 +231,9 @@ class AbstractTestSuiteRunner {
213231
}
214232
std::string filename_machine = machine_entry.path().string();
215233
std::string name_machine = filename_machine.substr(filename_machine.rfind('/') + 1);
216-
if (name_machine.rfind('.') != std::string::npos) { name_machine = name_machine.substr(0, name_machine.rfind('.')); }
234+
if (name_machine.rfind('.') != std::string::npos) {
235+
name_machine = name_machine.substr(0, name_machine.rfind('.'));
236+
}
217237

218238
BspArchitecture<GraphType> arch;
219239
if (!file_reader::readBspArchitecture(filename_machine, arch)) {
@@ -229,7 +249,9 @@ class AbstractTestSuiteRunner {
229249
}
230250
std::string filename_graph = graph_entry.path().string();
231251
std::string name_graph = filename_graph.substr(filename_graph.rfind('/') + 1);
232-
if (name_graph.rfind('.') != std::string::npos) { name_graph = name_graph.substr(0, name_graph.rfind('.')); }
252+
if (name_graph.rfind('.') != std::string::npos) {
253+
name_graph = name_graph.substr(0, name_graph.rfind('.'));
254+
}
233255
log_stream << "Start Graph: " + filename_graph + "\n";
234256

235257
BspInstance<GraphType> bsp_instance;

apps/test_suite_runner/ConfigParser.hpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ struct ConfigParser {
6969
bool algorithm_found = false;
7070
std::string algorithm_identifier = name;
7171

72-
while (algorithm_identifier.find("-") == 0) { algorithm_identifier = algorithm_identifier.substr(1); }
72+
while (algorithm_identifier.find("-") == 0) {
73+
algorithm_identifier = algorithm_identifier.substr(1);
74+
}
7375

7476
for (auto &algorithm : scheduler_config) {
7577
std::string alg_name = algorithm.second.get_child("name").get_value<std::string>();
@@ -97,7 +99,9 @@ struct ConfigParser {
9799

98100
pt::ptree scheduler_config_parse = loadPtreeRoot.get_child("algorithms");
99101
for (auto &algorithm : scheduler_config_parse) {
100-
if (algorithm.second.get_child("run").get_value<bool>()) { scheduler.push_back(algorithm); }
102+
if (algorithm.second.get_child("run").get_value<bool>()) {
103+
scheduler.push_back(algorithm);
104+
}
101105
}
102106
}
103107

apps/test_suite_runner/StatsModules/BspSptrsvStatsModule.hpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,13 @@ class BspSptrsvStatsModule : public IStatisticModule<TargetObjectType> {
168168
};
169169

170170
// Permute back if needed
171-
if (mode != NO_PERMUTE) { sim.permute_x_vector(perm); }
171+
if (mode != NO_PERMUTE) {
172+
sim.permute_x_vector(perm);
173+
}
172174

173-
if (!compare_vectors(L_x_ref, L_x_osp)) { std::cout << "Output is not equal" << std::endl; }
175+
if (!compare_vectors(L_x_ref, L_x_osp)) {
176+
std::cout << "Output is not equal" << std::endl;
177+
}
174178

175179
const std::string prefix = mode_tag(mode);
176180
stats[prefix + "SpTrSV_Runtime_Geomean(ns)"] = to_str(geom_mean);

apps/test_suite_runner/StringToScheduler/run_bsp_recomp_scheduler.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ RETURN_STATUS run_bsp_recomp_scheduler(const ConfigParser &parser,
5252

5353
BspScheduleCS<Graph_t> initial_schedule(std::move(bsp_schedule));
5454

55-
if (status == RETURN_STATUS::ERROR) { return RETURN_STATUS::ERROR; }
55+
if (status == RETURN_STATUS::ERROR) {
56+
return RETURN_STATUS::ERROR;
57+
}
5658

5759
GreedyRecomputer<Graph_t> scheduler;
5860

0 commit comments

Comments
 (0)