Skip to content

Commit 046ccb4

Browse files
authored
Bench (#124)
* Add load_matrix_market() * Add load_graph for vector<vector<tuple<int,int>>> & compressed_graph * Use load_graph() in mm_bench_dijkstra Cleanup unused code * Use new load_graph with dijkstra benchmarks Refine visitor_dijkstra & co_dijkstra to be closer to BGL impl * Misc improvements Added formatters for mm types Sources in Floating Point are converted to ints Builds & runs in Windows & Linux * priority_queue wasn't comparing distances * Output benchmarks for all sources * Add examine_vertex as benchmark option * Refinements to benchmarking * Enable nwgraph algo for benchmarking * Add output_algo_results class * Add option for inline relax_target() Tighten up options for benchmark options by moving macros & variables to beginning of mm_bench_dijkstra.cpp so they aren't missed as easily. * Fix gcc warnings * Attempt to defined queue as parameter in dijkstra_with_visitor * Move visitor param after weight function Rename g_ to g in dijkstra_with_visitor * Minor changes for vistor_dijkstra * Fix issues for gcc Upgrade to fmt 11.0.2 * Use fmt::format instead of std:;format For some reason the Mac & coverage builds fail when #include <format> * Replace std::format with fmt::format * Disable benchmark code by default Requires C++23 zip; not avail on mac or coverage
1 parent 2e99fdb commit 046ccb4

18 files changed

+1173
-536
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ if(ENABLE_BENCHMARKING)
116116
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
117117
set(BENCHMARK_DATA_DIR "${CMAKE_SOURCE_DIR}/../data/")
118118
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
119-
set(BENCHMARK_DATA_DIR "/mnt/d/dev_graph/data/")
119+
set(BENCHMARK_DATA_DIR "/mnt/c/dev_graph/data/")
120120
endif()
121121

122122
add_subdirectory(benchmark)

benchmark/CMakeLists.txt

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,20 @@
33
# C++23 needed for zip view
44
set (CMAKE_CXX_STANDARD 23)
55

6+
add_library(common_bench INTERFACE)
7+
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
8+
target_compile_options(common_bench INTERFACE -Wno-sign-conversion)
9+
endif()
10+
target_link_libraries(common_bench INTERFACE project_warnings project_options fmt::fmt)
11+
612
add_executable(graph_bench graph_bench.cpp "mm_simple.cpp" "mm_load_example.cpp" "mm_bench_dijkstra.cpp" "timer.cpp" "mm_files.cpp")
7-
target_link_libraries(graph_bench PRIVATE project_warnings project_options graph fmt::fmt fast_matrix_market::fast_matrix_market)
13+
target_link_libraries(graph_bench PRIVATE common_bench graph fast_matrix_market::fast_matrix_market)
814
target_compile_definitions(graph_bench PRIVATE BENCHMARK_DATA_DIR="${BENCHMARK_DATA_DIR}")
15+
#if (MSVC)
16+
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /PROFILE")
17+
# #target_link_options(graph_bench PRIVATE -pthread)
18+
#endif()
919

1020
# An executable to sort a matrix market file
1121
add_executable(sort_matrix_market "sort_matrix_market.cpp" "timer.cpp")
12-
target_link_libraries(sort_matrix_market PRIVATE fast_matrix_market::fast_matrix_market fmt::fmt)
22+
target_link_libraries(sort_matrix_market PRIVATE common_bench fast_matrix_market::fast_matrix_market)

benchmark/graph_bench.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
void mm_simple1();
99
void mm_load_example();
1010
void mm_load_file_example();
11-
void bench_dijkstra();
11+
void bench_dijkstra_main();
12+
void bench_dijkstra_runner();
1213

1314
int main() {
1415
#ifdef _MSC_VER
@@ -18,8 +19,9 @@ int main() {
1819
std::locale::global(std::locale(""));
1920
//mm_simple1();
2021
//mm_load_example();
21-
mm_load_file_example();
22-
//bench_dijkstra();
22+
//mm_load_file_example();
23+
//bench_dijkstra_main();
24+
bench_dijkstra_runner();
2325

2426
return 0;
2527
}

0 commit comments

Comments
 (0)