Skip to content

Commit

Permalink
Bench (#124)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
pratzl authored Aug 15, 2024
1 parent 2e99fdb commit 046ccb4
Show file tree
Hide file tree
Showing 18 changed files with 1,173 additions and 536 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ if(ENABLE_BENCHMARKING)
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
set(BENCHMARK_DATA_DIR "${CMAKE_SOURCE_DIR}/../data/")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(BENCHMARK_DATA_DIR "/mnt/d/dev_graph/data/")
set(BENCHMARK_DATA_DIR "/mnt/c/dev_graph/data/")
endif()

add_subdirectory(benchmark)
Expand Down
14 changes: 12 additions & 2 deletions benchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,20 @@
# C++23 needed for zip view
set (CMAKE_CXX_STANDARD 23)

add_library(common_bench INTERFACE)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_compile_options(common_bench INTERFACE -Wno-sign-conversion)
endif()
target_link_libraries(common_bench INTERFACE project_warnings project_options fmt::fmt)

add_executable(graph_bench graph_bench.cpp "mm_simple.cpp" "mm_load_example.cpp" "mm_bench_dijkstra.cpp" "timer.cpp" "mm_files.cpp")
target_link_libraries(graph_bench PRIVATE project_warnings project_options graph fmt::fmt fast_matrix_market::fast_matrix_market)
target_link_libraries(graph_bench PRIVATE common_bench graph fast_matrix_market::fast_matrix_market)
target_compile_definitions(graph_bench PRIVATE BENCHMARK_DATA_DIR="${BENCHMARK_DATA_DIR}")
#if (MSVC)
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /PROFILE")
# #target_link_options(graph_bench PRIVATE -pthread)
#endif()

# An executable to sort a matrix market file
add_executable(sort_matrix_market "sort_matrix_market.cpp" "timer.cpp")
target_link_libraries(sort_matrix_market PRIVATE fast_matrix_market::fast_matrix_market fmt::fmt)
target_link_libraries(sort_matrix_market PRIVATE common_bench fast_matrix_market::fast_matrix_market)
8 changes: 5 additions & 3 deletions benchmark/graph_bench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
void mm_simple1();
void mm_load_example();
void mm_load_file_example();
void bench_dijkstra();
void bench_dijkstra_main();
void bench_dijkstra_runner();

int main() {
#ifdef _MSC_VER
Expand All @@ -18,8 +19,9 @@ int main() {
std::locale::global(std::locale(""));
//mm_simple1();
//mm_load_example();
mm_load_file_example();
//bench_dijkstra();
//mm_load_file_example();
//bench_dijkstra_main();
bench_dijkstra_runner();

return 0;
}
Loading

0 comments on commit 046ccb4

Please sign in to comment.