Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified slides/experiment_results.pdf
Binary file not shown.
14 changes: 13 additions & 1 deletion src/experiment/bench_commons.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,23 @@ namespace bench {
};

template<typename AlgoType>
BenchmarkResult run_benchmark(const string &algo_name, const string &graph_path, int num_runs) {
BenchmarkResult run_benchmark(const string &algo_name, const string &graph_path, int warm_up_runs, int num_runs) {
BenchmarkResult result;
result.algorithm_name = algo_name;
result.graph_name = filesystem::path(graph_path).filename().string();

cout << "Warm up before exec " << algo_name << " on " << result.graph_name << "..." << endl;

for (int i = 0; i < warm_up_runs; ++i) {
const unique_ptr<Algorithm> algorithm(create_algorithm<AlgoType>());

cout << " Run " << (i + 1) << "/" << warm_up_runs << "..." << flush;

algorithm->load_graph(graph_path);
auto time = algorithm->compute();
cout << " " << fixed << setprecision(2) << time.count() << " ms" << endl;
}

cout << "Running " << algo_name << " on " << result.graph_name << "..." << endl;

result.execution_times.reserve(num_runs);
Expand Down
16 changes: 8 additions & 8 deletions src/experiment/bfs_benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,13 @@ int main() {
print_spla_accelerator_info();

// List of algorithms to benchmark
vector<pair<string, function<BenchmarkResult(const string &, int)>>> algorithms{};
vector<pair<string, function<BenchmarkResult(const string &, int, int)>>> algorithms{};

algorithms.emplace_back("BfsLagraph", [](const string &graph_path, int num_runs) {
return run_benchmark<ParentBfsLagraph>("BfsLagraph", graph_path,
num_runs);
algorithms.emplace_back("BfsLagraph", [](const string &graph_path, int warm_up, int measure) {
return run_benchmark<ParentBfsLagraph>("BfsLagraph", graph_path, warm_up, measure);
});
algorithms.emplace_back("BfsSpla", [](const string &graph_path, int num_runs) {
return run_benchmark<ParentBfsSpla>("BfsSpla", graph_path, num_runs);
algorithms.emplace_back("BfsSpla", [](const string &graph_path, int warm_up, int measure) {
return run_benchmark<ParentBfsSpla>("BfsSpla", graph_path, warm_up, measure);
});

vector<string> graph_files;
Expand All @@ -51,13 +50,14 @@ int main() {
cout << " - " << filesystem::path(file).filename().string() << endl;
}

const int NUM_RUNS = 20;
const int WARM_UP_RUNS = 3;
const int MEASURE_RUNS = 20;

vector<BenchmarkResult> all_results;
for (const auto &graph_file: graph_files) {
for (const auto &[algo_name, benchmark_func]: algorithms) {
try {
BenchmarkResult result = benchmark_func(graph_file, NUM_RUNS);
BenchmarkResult result = benchmark_func(graph_file, WARM_UP_RUNS, MEASURE_RUNS);
all_results.push_back(result);
} catch (const exception &e) {
cerr << "Error running " << algo_name << " on " << filesystem::path(graph_file).filename().string()
Expand Down
7 changes: 3 additions & 4 deletions src/experiment/mst_benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,13 @@ int main() {
// List of algorithms to benchmark
vector<pair<string, function<BenchmarkResult(const string &, int)>>>
algorithms = {{"PrimSpla", [](const string &graph_path, int num_runs) {
return run_benchmark<PrimSpla>("PrimSpla", graph_path,
num_runs);
return run_benchmark<PrimSpla>("PrimSpla", graph_path, 0, num_runs);
}}};
algorithms.emplace_back("BoruvkaSpla", [](const string &graph_path, int num_runs) {
return run_benchmark<BoruvkaSpla>("BoruvkaSpla", graph_path, num_runs);
return run_benchmark<BoruvkaSpla>("BoruvkaSpla", graph_path, 0, num_runs);
});
algorithms.emplace_back("BoruvkaLagraph", [](const string &graph_path, int num_runs) {
return run_benchmark<BoruvkaLagraph>("BoruvkaLagraph", graph_path, num_runs);
return run_benchmark<BoruvkaLagraph>("BoruvkaLagraph", graph_path, 0, num_runs);
});

#if USE_GUNROCK
Expand Down