Skip to content

Commit

Permalink
LLAMA / Test init time for the iterator
Browse files Browse the repository at this point in the history
  • Loading branch information
Dean De Leo committed Jun 22, 2020
1 parent c8f8d1f commit 6322a95
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 0 deletions.
2 changes: 2 additions & 0 deletions library/llama/llama_class.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class ll_database; // forward declaration
class ll_mlcsr_ro_graph; // forward declaration
namespace gfe::utility { class TimeoutService; } // forward declaration
[[maybe_unused]] static void _bm_run_llama(); // bm tool
[[maybe_unused]] static void _test_perf_run_llama(); // Performance test

namespace gfe::library {

Expand All @@ -52,6 +53,7 @@ namespace gfe::library {
*/
class LLAMAClass : public virtual UpdateInterface, public virtual GraphalyticsInterface {
friend void ::_bm_run_llama(); // bm tool
friend void ::_test_perf_run_llama(); // performance test
protected:
LLAMAClass(const LLAMAClass&) = delete;
LLAMAClass& operator=(const LLAMAClass&) = delete;
Expand Down
67 changes: 67 additions & 0 deletions tests/test_performance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
#include "graph/edge_stream.hpp"
#include "library/baseline/adjacency_list.hpp"

#if defined(HAVE_LLAMA)
#include "library/llama/llama_internal.hpp"
#include "library/llama/llama_ref.hpp"
#endif

using namespace common;
using namespace gfe::experiment;
using namespace gfe::library;
Expand All @@ -49,6 +54,16 @@ static string get_path_graph(){
}
}

static const uint64_t num_iterations_default = 1ull << 10;
[[maybe_unused]] static uint64_t get_num_iterations(){
static const char* gfe_num_iterations = getenv("GFE_NUM_ITERATIONS");
if(gfe_num_iterations == nullptr){
cout << "Warning: env. var. GFE_NUM_ITERATIONS not set. Using the default: " << num_iterations_default << endl;
return num_iterations_default;
} else {
return strtoull(gfe_num_iterations, nullptr, 10);
}
}

TEST(Performance, InsertOnly) {
auto impl = make_shared<AdjacencyList>(is_directed);
Expand Down Expand Up @@ -97,5 +112,57 @@ TEST(Performance, LCC) {
impl->lcc();
timer.stop();
cout << "Execution completed in " << timer << "\n";
}

#if defined(HAVE_LLAMA)
static void _test_perf_run_llama(){
auto impl = make_shared<LLAMAClass>(is_directed);
Timer timer;
string path_graph = get_path_graph();

cout << "[Performance::LLAMA_Iterator_Overhead] Loading the graph from `" << path_graph << "' ... \n";
timer.start();
auto stream = make_shared<gfe::graph::WeightedEdgeStream>(path_graph);
timer.stop();
cout << "Graph loaded in " << timer << "\n";
stream->permute(1910);


cout << "[Performance::LLAMA_Iterator_Overhead] Executing the insertions ...\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";
auto instance = dynamic_cast<LLAMAClass*>(impl.get());
shared_lock<LLAMAClass::shared_mutex_t> slock(instance->m_lock_checkpoint);
auto graph = instance->get_snapshot();
timer.start();
for(uint64_t i = 0; i < num_iterations; i++){
ll_edge_iterator iterator;
graph.out_iter_begin(iterator, i % num_vertices);
}
timer.stop();
double time_per_item_usecs = static_cast<double>(timer.microseconds()) / num_iterations;
cout << "Execution completed in " << timer << ". Init time per item: " << time_per_item_usecs << " microseconds\n";

cout << "[Performance::LLAMA_Iterator_Overhead] Initialising " << num_iterations << " the input iterator...\n";
timer.start();
for(uint64_t i = 0; i < num_iterations; i++){
ll_edge_iterator iterator;
graph.out_iter_begin(iterator, i % num_vertices);
}
timer.stop();
time_per_item_usecs = static_cast<double>(timer.microseconds()) / num_iterations;
cout << "Execution completed in " << timer << ". Init time per item: " << time_per_item_usecs << " microseconds\n";
}

TEST(Performance, LLAMA_Iterator_Overhead) {
_test_perf_run_llama();
}
#endif

0 comments on commit 6322a95

Please sign in to comment.