From 3c775b11be72d50828e446a1b1cdbab395efd146 Mon Sep 17 00:00:00 2001 From: Dean De Leo Date: Mon, 22 Jun 2020 19:04:46 +0200 Subject: [PATCH] LLAMA/ Test performance, give the option to set the number of threads to use --- tests/test_performance.cpp | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/tests/test_performance.cpp b/tests/test_performance.cpp index 941f9b7..4347a88 100644 --- a/tests/test_performance.cpp +++ b/tests/test_performance.cpp @@ -39,10 +39,20 @@ using namespace gfe::library; using namespace std; extern char** environ; - -constexpr static int num_threads = 1; constexpr static bool is_directed = false; // whether the graph is directed +static int num_threads_default = 1; +static int get_num_threads(){ + static const char* gfe_num_threads = getenv("GFE_NUM_THREADS"); + if(gfe_num_threads == nullptr){ + cout << "Warning: env. var. GFE_NUM_THREADS not set. Using the default: " << num_threads_default << endl; + return num_threads_default; + } else { + return atoi(gfe_num_threads); + } +} + + static const string path_graph_default = common::filesystem::directory_executable() + "/graphs/ldbc_graphalytics/example-undirected.properties"; static string get_path_graph(){ static const char* path_graph = getenv("GFE_PATH_GRAPH"); @@ -77,8 +87,8 @@ TEST(Performance, InsertOnly) { cout << "Graph loaded in " << timer << "\n"; stream->permute(1910); - - cout << "[Performance::InsertOnly] Executing the insertions ...\n"; + int num_threads = get_num_threads(); + cout << "[Performance::InsertOnly] Executing the insertions using " << num_threads << " threads ...\n"; timer.start(); InsertOnly experiment(impl, move(stream), num_threads); experiment.execute(); @@ -99,8 +109,8 @@ TEST(Performance, LCC) { cout << "Graph loaded in " << timer << "\n"; stream->permute(1910); - - cout << "[Performance::LCC] Executing the insertions ...\n"; + int num_threads = get_num_threads(); + cout << "[Performance::LCC] Executing the insertions using " << num_threads << " threads ...\n"; timer.start(); InsertOnly experiment(impl, move(stream), num_threads); experiment.execute(); @@ -127,15 +137,14 @@ static void _test_perf_run_llama(){ cout << "Graph loaded in " << timer << "\n"; stream->permute(1910); - - cout << "[Performance::LLAMA_Iterator_Overhead] Executing the insertions ...\n"; + int num_threads = get_num_threads(); + cout << "[Performance::LLAMA_Iterator_Overhead] Executing the insertions using " << num_threads << " threads...\n"; timer.start(); InsertOnly experiment(impl, move(stream), num_threads); experiment.execute(); timer.stop(); cout << "Execution completed in " << timer << "\n"; - uint64_t num_iterations = get_num_iterations(); uint64_t num_vertices = impl->num_vertices(); cout << "[Performance::LLAMA_Iterator_Overhead] Initialising " << num_iterations << " the output iterator...\n";