Skip to content

Commit 686dc24

Browse files
committed
added test_graphs.hpp
1 parent 6c889a1 commit 686dc24

15 files changed

+299
-139
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ main
8787
*.test
8888
tests/*
8989
!tests/*.cpp
90+
!tests/*.hpp
9091
!tests/include/
9192
!tests/include/*.hpp
9293
!lib/**/*

include/osp/auxiliary/io/hdag_graph_file_writer.hpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,11 @@ void writeComputationalDagHyperdagFormatDB(std::ostream &os, const Graph_t &grap
4545
const auto num_vertices = graph.num_vertices();
4646
unsigned num_hyperedges = 0;
4747
unsigned num_pins = 0;
48-
49-
std::vector<unsigned> node_to_hyperedge_idx(num_vertices);
50-
std::vector<const vertex_idx_t<Graph_t> *> hyperedge_idx_to_node;
48+
std::vector<vertex_idx_t<Graph_t>> hyperedge_idx_to_node;
5149

5250
for (const auto &u : graph.vertices()) {
5351
if (graph.out_degree(u) > 0) {
54-
node_to_hyperedge_idx[u] = num_hyperedges;
55-
hyperedge_idx_to_node.push_back(&u);
52+
hyperedge_idx_to_node.push_back(u);
5653
num_hyperedges++;
5754
num_pins += (graph.out_degree(u) + 1);
5855
}
@@ -65,7 +62,7 @@ void writeComputationalDagHyperdagFormatDB(std::ostream &os, const Graph_t &grap
6562
// Hyperedges
6663
os << "%% Hyperedges: ID comm_weight mem_weight\n";
6764
for (unsigned i = 0; i < num_hyperedges; ++i) {
68-
const auto u = *hyperedge_idx_to_node[i];
65+
const auto u = hyperedge_idx_to_node[i];
6966
os << i << " " << graph.vertex_comm_weight(u) << " " << graph.vertex_mem_weight(u) << "\n";
7067
}
7168

@@ -84,7 +81,7 @@ void writeComputationalDagHyperdagFormatDB(std::ostream &os, const Graph_t &grap
8481
// Pins
8582
os << "%% Pins: HyperedgeID NodeID\n";
8683
for (unsigned i = 0; i < num_hyperedges; ++i) {
87-
const auto u = *hyperedge_idx_to_node[i];
84+
const auto u = hyperedge_idx_to_node[i];
8885
os << i << " " << u << "\n"; // Source pin
8986
for (const auto &v : graph.children(u)) {
9087
os << i << " " << v << "\n"; // Target pins

tests/bsp_schedulers.cpp

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -45,30 +45,10 @@ limitations under the License.
4545
#include "osp/auxiliary/io/arch_file_reader.hpp"
4646
#include "osp/auxiliary/io/hdag_graph_file_reader.hpp"
4747
#include "osp/auxiliary/io/general_file_reader.hpp"
48+
#include "test_graphs.hpp"
4849

4950
using namespace osp;
5051

51-
std::vector<std::string> tiny_spaa_graphs() {
52-
return {"data/spaa/tiny/instance_bicgstab.hdag",
53-
"data/spaa/tiny/instance_CG_N2_K2_nzP0d75.hdag",
54-
"data/spaa/tiny/instance_CG_N3_K1_nzP0d5.hdag",
55-
"data/spaa/tiny/instance_CG_N4_K1_nzP0d35.hdag",
56-
"data/spaa/tiny/instance_exp_N4_K2_nzP0d5.hdag",
57-
"data/spaa/tiny/instance_exp_N5_K3_nzP0d4.hdag",
58-
"data/spaa/tiny/instance_exp_N6_K4_nzP0d25.hdag",
59-
"data/spaa/tiny/instance_k-means.hdag",
60-
"data/spaa/tiny/instance_k-NN_3_gyro_m.hdag",
61-
"data/spaa/tiny/instance_kNN_N4_K3_nzP0d5.hdag",
62-
"data/spaa/tiny/instance_kNN_N5_K3_nzP0d3.hdag",
63-
"data/spaa/tiny/instance_kNN_N6_K4_nzP0d2.hdag",
64-
"data/spaa/tiny/instance_pregel.hdag",
65-
"data/spaa/tiny/instance_spmv_N6_nzP0d4.hdag",
66-
"data/spaa/tiny/instance_spmv_N7_nzP0d35.hdag",
67-
"data/spaa/tiny/instance_spmv_N10_nzP0d25.hdag",
68-
"data/dot/empty_graph.dot"
69-
};
70-
}
71-
7252
std::vector<std::string> test_architectures() { return {"data/machine_params/p3.arch"}; }
7353

7454
template<typename Graph_t>

tests/bsp_schedulers_mem_const.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,10 @@ limitations under the License.
3737
#include "osp/auxiliary/io/hdag_graph_file_reader.hpp"
3838
#include "osp/bsp/scheduler/LocalSearch/KernighanLin/kl_total_comm.hpp"
3939
#include "osp/bsp/scheduler/LocalSearch/KernighanLin/kl_total_cut.hpp"
40-
40+
#include "test_graphs.hpp"
4141

4242
using namespace osp;
4343

44-
std::vector<std::string> test_graphs() {
45-
return {"data/spaa/tiny/instance_bicgstab.hdag", "data/spaa/tiny/instance_CG_N2_K2_nzP0d75.hdag"};
46-
}
47-
4844
std::vector<std::string> test_architectures() { return {"data/machine_params/p3.arch"}; }
4945

5046
template<typename Graph_t>

tests/coarser.cpp

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -40,26 +40,7 @@ limitations under the License.
4040
#include "osp/auxiliary/io/arch_file_reader.hpp"
4141
#include "osp/auxiliary/io/hdag_graph_file_reader.hpp"
4242
#include "osp/auxiliary/io/general_file_reader.hpp"
43-
44-
std::vector<std::string> tiny_spaa_graphs() {
45-
return {"data/spaa/tiny/instance_bicgstab.hdag",
46-
"data/spaa/tiny/instance_CG_N2_K2_nzP0d75.hdag",
47-
"data/spaa/tiny/instance_CG_N3_K1_nzP0d5.hdag",
48-
"data/spaa/tiny/instance_CG_N4_K1_nzP0d35.hdag",
49-
"data/spaa/tiny/instance_exp_N4_K2_nzP0d5.hdag",
50-
"data/spaa/tiny/instance_exp_N5_K3_nzP0d4.hdag",
51-
"data/spaa/tiny/instance_exp_N6_K4_nzP0d25.hdag",
52-
"data/spaa/tiny/instance_k-means.hdag",
53-
"data/spaa/tiny/instance_k-NN_3_gyro_m.hdag",
54-
"data/spaa/tiny/instance_kNN_N4_K3_nzP0d5.hdag",
55-
"data/spaa/tiny/instance_kNN_N5_K3_nzP0d3.hdag",
56-
"data/spaa/tiny/instance_kNN_N6_K4_nzP0d2.hdag",
57-
"data/spaa/tiny/instance_pregel.hdag",
58-
"data/spaa/tiny/instance_spmv_N6_nzP0d4.hdag",
59-
"data/spaa/tiny/instance_spmv_N7_nzP0d35.hdag",
60-
"data/spaa/tiny/instance_spmv_N10_nzP0d25.hdag",
61-
"data/dot/empty_graph.dot"};
62-
}
43+
#include "test_graphs.hpp"
6344

6445
using namespace osp;
6546

tests/cuthill_mckee.cpp

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -24,25 +24,7 @@ limitations under the License.
2424
#include "osp/graph_algorithms/directed_graph_top_sort.hpp"
2525
#include "osp/graph_implementations/boost_graphs/boost_graph.hpp"
2626
#include "osp/auxiliary/io/hdag_graph_file_reader.hpp"
27-
28-
std::vector<std::string> tiny_spaa_graphs() {
29-
return {"data/spaa/tiny/instance_bicgstab.hdag",
30-
"data/spaa/tiny/instance_CG_N2_K2_nzP0d75.hdag",
31-
"data/spaa/tiny/instance_CG_N3_K1_nzP0d5.hdag",
32-
"data/spaa/tiny/instance_CG_N4_K1_nzP0d35.hdag",
33-
"data/spaa/tiny/instance_exp_N4_K2_nzP0d5.hdag",
34-
"data/spaa/tiny/instance_exp_N5_K3_nzP0d4.hdag",
35-
"data/spaa/tiny/instance_exp_N6_K4_nzP0d25.hdag",
36-
"data/spaa/tiny/instance_k-means.hdag",
37-
"data/spaa/tiny/instance_k-NN_3_gyro_m.hdag",
38-
"data/spaa/tiny/instance_kNN_N4_K3_nzP0d5.hdag",
39-
"data/spaa/tiny/instance_kNN_N5_K3_nzP0d3.hdag",
40-
"data/spaa/tiny/instance_kNN_N6_K4_nzP0d2.hdag",
41-
"data/spaa/tiny/instance_pregel.hdag",
42-
"data/spaa/tiny/instance_spmv_N6_nzP0d4.hdag",
43-
"data/spaa/tiny/instance_spmv_N7_nzP0d35.hdag",
44-
"data/spaa/tiny/instance_spmv_N10_nzP0d25.hdag"};
45-
}
27+
#include "test_graphs.hpp"
4628

4729
using namespace osp;
4830

tests/directed_graph_algorithms.cpp

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,20 +33,10 @@ limitations under the License.
3333
#include "osp/graph_implementations/boost_graphs/boost_graph.hpp"
3434
#include "osp/auxiliary/io/hdag_graph_file_reader.hpp"
3535
#include "test_utils.hpp"
36-
37-
38-
std::vector<std::string> large_spaa_graphs() {
39-
return {"data/spaa/large/instance_exp_N50_K12_nzP0d15.hdag",
40-
"data/spaa/large/instance_CG_N24_K22_nzP0d2.hdag",
41-
"data/spaa/large/instance_kNN_N45_K15_nzP0d16.hdag",
42-
"data/spaa/large/instance_spmv_N120_nzP0d18.hdag"
43-
};
44-
}
45-
36+
#include "test_graphs.hpp"
4637

4738
using namespace osp;
4839

49-
5040
BOOST_AUTO_TEST_CASE(longest_edge_triangle_parallel) {
5141

5242

tests/heavy_edge_preprocessing.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@
88
#include "osp/bsp/scheduler/LoadBalanceScheduler/HeavyEdgePreProcess.hpp"
99
#include "osp/graph_implementations/boost_graphs/boost_graph.hpp"
1010
#include "osp/auxiliary/io/hdag_graph_file_reader.hpp"
11-
12-
std::vector<std::string> test_graphs() {
13-
return {"data/spaa/tiny/instance_bicgstab.hdag", "data/spaa/tiny/instance_CG_N2_K2_nzP0d75.hdag"};
14-
}
11+
#include "test_graphs.hpp"
1512

1613
using namespace osp;
1714

tests/hill_climbing.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,11 @@ limitations under the License.
2424
#include "osp/bsp/scheduler/LocalSearch/HillClimbing/hill_climbing_for_comm_schedule.hpp"
2525
#include "osp/auxiliary/io/hdag_graph_file_reader.hpp"
2626
#include <filesystem>
27-
27+
#include "test_graphs.hpp"
2828
#include "osp/graph_implementations/adj_list_impl/computational_dag_vector_impl.hpp"
2929

3030
using namespace osp;
3131

32-
std::vector<std::string> test_graphs() {
33-
return {"data/spaa/tiny/instance_k-means.hdag", "data/spaa/tiny/instance_bicgstab.hdag",
34-
"data/spaa/tiny/instance_CG_N4_K1_nzP0d35.hdag"};
35-
}
3632

3733
BOOST_AUTO_TEST_CASE(hill_climbing) {
3834

tests/kl.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,11 @@ limitations under the License.
2626
#include "osp/bsp/scheduler/LocalSearch/KernighanLin/kl_total_cut.hpp"
2727
#include "osp/auxiliary/io/arch_file_reader.hpp"
2828
#include "osp/auxiliary/io/hdag_graph_file_reader.hpp"
29-
29+
#include "test_graphs.hpp"
3030
#include "osp/graph_implementations/adj_list_impl/computational_dag_edge_idx_vector_impl.hpp"
3131

3232
using namespace osp;
3333

34-
std::vector<std::string> test_graphs() {
35-
return {"data/spaa/tiny/instance_k-means.hdag", "data/spaa/tiny/instance_bicgstab.hdag",
36-
"data/spaa/tiny/instance_CG_N3_K1_nzP0d5.hdag"};
37-
}
38-
3934
template<typename Graph_t>
4035
void add_mem_weights(Graph_t &dag) {
4136

0 commit comments

Comments
 (0)