Skip to content

Commit

Permalink
Wrapper for the library GraphOne
Browse files Browse the repository at this point in the history
  • Loading branch information
whatsthecraic committed Dec 5, 2019
1 parent e77edcf commit 1a93f90
Show file tree
Hide file tree
Showing 109 changed files with 2,747 additions and 373 deletions.
7 changes: 5 additions & 2 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ ifneq (,$(findstring -DHAVE_LLAMA,${ALL_CPPFLAGS}))
sources += $(addprefix library/llama/, llama_bfs.cpp llama_class.cpp llama_cdlp.cpp llama_internal.cpp llama_lcc.cpp llama_pagerank.cpp llama_sssp.cpp llama_wcc.cpp)
sources += $(addprefix library/llama-dv/, llama-dv.cpp)
endif
ifneq (,$(findstring -DHAVE_GRAPHONE,${ALL_CPPFLAGS}))
sources += $(addprefix library/graphone/, graphone.cpp)
endif


#############################################################################
Expand All @@ -111,7 +114,7 @@ all: ${builddir}/gfe_driver
#############################################################################
# Artifacts to build
${builddir}/gfe_driver: ${objectdir}/main_driver.o ${dependencies} | ${builddir}
${CXX} ${LDFLAGS} $^ -o $@
${CXX} $^ ${LDFLAGS} -o $@

#############################################################################
# Compiling the objects
Expand Down Expand Up @@ -170,7 +173,7 @@ check: ${testartifacts}

${testartifacts}: ${dependencies} | ${gtestlibs}
${testartifacts}: % : %.cpp | ${testbindir} ${testgraphs}
${CXX} -I ${srcdir}/third-party/googletest/googletest/include $(ALL_CXXFLAGS) ${LDFLAGS} $< -o $@ ${dependencies} ${gtestlibs}
${CXX} $(ALL_CXXFLAGS) -I ${srcdir}/third-party/googletest/googletest/include $< ${dependencies} ${gtestlibs} ${LDFLAGS} -o $@

${gtestlibs}: ${gtestdir}
${gtestdir}:
Expand Down
8 changes: 6 additions & 2 deletions configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ using namespace common;
using namespace std;

#undef CURRENT_ERROR_TYPE
#define CURRENT_ERROR_TYPE ConfigurationError
#define CURRENT_ERROR_TYPE ::gfe::ConfigurationError

namespace gfe {

/*****************************************************************************
* *
Expand Down Expand Up @@ -239,7 +241,7 @@ bool Configuration::has_database() const {
return !m_database_path.empty();
}

common::Database* Configuration::db(){
::common::Database* Configuration::db(){
if(m_database == nullptr && has_database()){
m_database = new Database{m_database_path};
auto params = m_database->create_execution();
Expand Down Expand Up @@ -366,3 +368,5 @@ void Configuration::save_parameters() {
sort(begin(params), end(params));
db()->store_parameters(params);
}

} // namespace
10 changes: 7 additions & 3 deletions configuration.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@

#include "common/error.hpp"

class Configuration; // forward declaration
namespace common { class Database; } // forward declaration
namespace library { class Interface; } // forward declaration
namespace gfe { class Configuration; } // forward declaration
namespace gfe::library { class Interface; } // forward declaration

namespace gfe {

// Singleton interface
Configuration& configuration(); // retrieve the current singleton (client, server or standalone)
Expand Down Expand Up @@ -155,7 +157,7 @@ class Configuration {
bool has_database() const;

// Retrieve the handle to the database connection, where the final results of the experiments are stored
common::Database* db();
::common::Database* db();

// Save the configuration properties into the database
void save_parameters();
Expand All @@ -170,3 +172,5 @@ class Configuration {
const std::string& get_database_path() const { return m_database_path; }
};

} // namespace

117 changes: 96 additions & 21 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,29 @@ if test x"${have_openmp}" == x"yes"; then
CPPFLAGS="${CPPFLAGS} -DHAVE_OPENMP"
fi

#############################################################################
# Intel TBB
have_tbb="unknown"; # Perform the check only once when invoking MY_INTEL_TBB()
AC_DEFUN([MY_INTEL_TBB], [
if test x"${have_tbb}" == x"unknown"; then
have_tbb="yes" # assume so
AC_CHECK_HEADER([tbb/tbb.h], [
AC_SEARCH_LIBS([TBB_runtime_interface_version], [tbb],
[CPPFLAGS="${CPPFLAGS} -DHAVE_TBB"],
[have_tbb="no"])
], [have_tbb="no"], [ [/* avoid default includes */] ])
fi
if test x"${have_tbb}" == x"no"; then
AC_MSG_ERROR(["The dependency library Intel TBB is not available in this machine"]);
fi
])

#############################################################################
# pthreads
AC_SEARCH_LIBS([pthread_create], [pthread], [],
[ AC_MSG_ERROR([missing prerequisite: this program requires pthreads to work (dependency for sqlite3)]) ])

#############################################################################
# libnuma
have_libnuma="yes"
Expand Down Expand Up @@ -331,25 +349,13 @@ elif ( test x"${with_llama}" != x"yes" && test x"${with_llama}" != x"auto" ); th
fi

dnl check whether we can compile & link a program that makes usage of omp.h
if ( test x"${with_llama}" != x"no" ); then
AC_MSG_CHECKING([whether the llama library can include <omp.h>, the OpenMP runtime library])
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[
@%:@include <omp.h>
]], [[
/* nop */
]])
], [
AC_MSG_RESULT([yes])
], [
AC_MSG_RESULT([no])
if ( test x"${with_llama}" = x"auto" ); then
AC_MSG_NOTICE([llama support disabled: the OpenMP header omp.h is missing.])
with_llama="no";
else
AC_MSG_FAILURE([llama: missing prerequisite header omp.h (OpenMP runtime library)])
fi
])
if ( test "${have_openmp}" == "no" ); then
if ( test x"${with_llama}" = x"auto" ); then
AC_MSG_NOTICE([llama support disabled: the OpenMP header omp.h is missing.])
with_llama="no";
else
AC_MSG_FAILURE([llama: missing prerequisite header omp.h (OpenMP runtime library)])
fi
fi

dnl check whether we can compile & link a simple program invoking functions from the llama library
Expand Down Expand Up @@ -379,12 +385,81 @@ if ( test x"${with_llama}" != x"no" ); then
])
fi

dnl add the definition HAVE_STINGER into the list of preprocessor variables $CPPFLAGS
dnl add the definition HAVE_LLAMA into the list of preprocessor variables $CPPFLAGS
if( test x"${with_llama}" != x"no" ); then
AC_MSG_NOTICE([llama support enabled])
AS_VAR_APPEND([CPPFLAGS], [" -DHAVE_LLAMA"])
fi

#############################################################################
# Support for the GraphOne framework
# Usage:
# --with-graphone=/path/to/graphone/build
#
AC_ARG_WITH([graphone], [AS_HELP_STRING([--with-graphone@<:@=ARG@:>@], [
Link to the GraphOne library. The argument needs to be the path where the library has been built.
])], [])

if ( test x"${with_graphone}" != x"" && test x"${with_graphone}" != "no" ); then
dnl check whether we can compile & link a program that makes usage of omp.h
if ( test "${have_openmp}" == "no" ); then
AC_MSG_FAILURE([GraphOne: missing prerequisite header omp.h (OpenMP runtime library)])
fi

AC_MSG_NOTICE([GraphOne: checking whether Intel TBB is present in the machine...])
MY_INTEL_TBB()

if( test x"${with_graphone}" == x"yes" ); then
AC_MSG_ERROR(["the full path to the GraphOne build needs to be specified, e.g. --with-graphone=/path/to/graphone/build"]);
fi

path_onedata=$(realpath "${with_graphone}/onedata/libonedata64.a")
AC_CHECK_FILE([${path_onedata}],
[ LIBS="${path_onedata} ${LIBS}" ],
[ AC_MSG_ERROR(["file not found: ${path_onedata}"]) ]
)

path_graphone_library=$(realpath "${with_graphone}/src/libsrc64.a")
AC_CHECK_FILE([${path_graphone_library}],
[ LIBS="${path_graphone_library} ${LIBS}" ],
[ AC_MSG_ERROR(["file not found: ${path_graphone_library}"]) ]
)

path_graphone_cmakecache=$(realpath "${with_graphone}/CMakeCache.txt")
AC_CHECK_FILE([${path_graphone_cmakecache}], [], [AC_MSG_ERROR(["file not found: ${path_graphone_cmakecache}. This file is used to infer the path to the source directory of GraphOne"])])
path_graphone_srcdir=$(awk -F= '$1 ~ /CMAKE_HOME_DIRECTORY/ {print $2}' ${path_graphone_cmakecache})
AC_MSG_NOTICE([GraphOne source directory: ${path_graphone_srcdir}])
AS_VAR_APPEND([CPPFLAGS], [" -I${path_graphone_srcdir}/src -I${path_graphone_srcdir}/include -I${path_graphone_srcdir}/include -I${path_graphone_srcdir}/gview -I${path_graphone_srcdir}/gview -I${path_graphone_srcdir}/analytics -I${path_graphone_srcdir}/onedata"])

dnl check whether we can compile & link a simple program invoking functions from the graphone library
AC_MSG_CHECKING([whether we can compile and link against the GraphOne library])
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[
#define OVER_COMMIT
#define TBB
#define PLAIN_GRAPH
#define B64
#define DEL
@%:@include <omp.h>
@%:@include "graph.h"
/* required globals */
graph* g = new graph;
int THD_COUNT = omp_get_max_threads() -1;
]], [[
/* empty main, it uses the global variable g as a global */
]])
], [
AC_MSG_RESULT([yes])
], [
AC_MSG_RESULT([no])
AC_MSG_FAILURE([unable to compile and link an executable with GraphOne])
])

AC_MSG_NOTICE([GraphOne support enabled])
AS_VAR_APPEND([CPPFLAGS], [" -DHAVE_GRAPHONE"])
fi

#############################################################################
# Remove extra blanks from our variables
EXTRA_CPPFLAGS=$(echo ${EXTRA_CPPFLAGS} | xargs)
Expand Down
7 changes: 3 additions & 4 deletions experiment/aging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
#include "configuration.hpp"

using namespace common;
using namespace experiment::details;
using namespace gfe::experiment::details;
using namespace std;

/*****************************************************************************
Expand All @@ -66,7 +66,7 @@ extern mutex _log_mutex [[maybe_unused]];
* Aging *
* *
*****************************************************************************/
namespace experiment {
namespace gfe::experiment {

Aging::Aging(std::shared_ptr<library::UpdateInterface> interface, std::shared_ptr<graph::WeightedEdgeStream> stream, double mult_num_operations, int64_t num_threads) :
Aging(interface,stream, stream->num_edges() * mult_num_operations, num_threads, interface->is_directed(), stream->max_weight()) { }
Expand Down Expand Up @@ -366,5 +366,4 @@ void Aging::save() {
}
}


} // namespace experiment
} // namespace
18 changes: 9 additions & 9 deletions experiment/aging.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,21 @@
#include "third-party/libcuckoo/cuckoohash_map.hh"

// forward declarations
namespace graph { class WeightedEdgeStream; }
namespace experiment::details { class AgingThread; }
namespace experiment::details { class AsyncBatch; }
namespace library { class UpdateInterface; }
namespace gfe::graph { class WeightedEdgeStream; }
namespace gfe::experiment::details { class AgingThread; }
namespace gfe::experiment::details { class AsyncBatch; }
namespace gfe::library { class UpdateInterface; }

namespace experiment {
namespace gfe::experiment {

class Aging {
friend class details::AgingThread;

Aging(const Aging&) = delete;
Aging& operator=(const Aging&) = delete;

std::shared_ptr<library::UpdateInterface> m_interface; // the library where vertices and edges will be inserted
std::shared_ptr<graph::WeightedEdgeStream> m_stream; // the final graph to insert
std::shared_ptr<gfe::library::UpdateInterface> m_interface; // the library where vertices and edges will be inserted
std::shared_ptr<gfe::graph::WeightedEdgeStream> m_stream; // the final graph to insert

cuckoohash_map<uint64_t, bool> m_vertices_present; // current list of vertices present
const cuckoohash_map<uint64_t, uint64_t> m_vertices_final; // list of vertices in the final graph
Expand Down Expand Up @@ -106,10 +106,10 @@ class Aging {
* @param mult_num_operations coefficient for the total number of operations to perform, the final amount is given by mult_num_operations * stream->num_edges()
* @param num_threads number of threads to use
*/
Aging(std::shared_ptr<library::UpdateInterface> interface, std::shared_ptr<graph::WeightedEdgeStream> stream, double mult_num_operations, int64_t num_threads);
Aging(std::shared_ptr<library::UpdateInterface> interface, std::shared_ptr<gfe::graph::WeightedEdgeStream> stream, double mult_num_operations, int64_t num_threads);


Aging(std::shared_ptr<library::UpdateInterface> interface, std::shared_ptr<graph::WeightedEdgeStream> stream, uint64_t num_operations, int64_t num_threads, bool is_directed, double max_weight);
Aging(std::shared_ptr<library::UpdateInterface> interface, std::shared_ptr<gfe::graph::WeightedEdgeStream> stream, uint64_t num_operations, int64_t num_threads, bool is_directed, double max_weight);

// destructor
~Aging();
Expand Down
2 changes: 1 addition & 1 deletion experiment/aging2_experiment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ extern mutex _log_mutex [[maybe_unused]];
* *
*****************************************************************************/

namespace experiment {
namespace gfe::experiment {

Aging2Experiment::Aging2Experiment(){ }

Expand Down
16 changes: 8 additions & 8 deletions experiment/aging2_experiment.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@
#include "aging2_result.hpp"

// forward declarations
namespace graph { class WeightedEdgeStream; }
namespace experiment { class Aging2Experiment; }
namespace experiment::details { class Aging2Master; }
namespace experiment::details { class Aging2Worker; }
namespace library { class UpdateInterface; }
namespace gfe::graph { class WeightedEdgeStream; }
namespace gfe::experiment { class Aging2Experiment; }
namespace gfe::experiment::details { class Aging2Master; }
namespace gfe::experiment::details { class Aging2Worker; }
namespace gfe::library { class UpdateInterface; }

namespace experiment {
namespace gfe::experiment {

/**
* Builder/factory class to create & execute instances of the Aging experiment.
Expand All @@ -42,7 +42,7 @@ class Aging2Experiment {
friend class details::Aging2Master;
friend class details::Aging2Worker;

std::shared_ptr<library::UpdateInterface> m_library; // the library to evaluate
std::shared_ptr<gfe::library::UpdateInterface> m_library; // the library to evaluate
std::string m_path_log; // the path to the log file [graphlog] with the sequence of updates to perform
uint64_t m_num_threads = 1; // set the number of threads to use
uint64_t m_worker_granularity = 1024; // the granularity of a task for a worker, that is the number of contiguous operations (inserts/deletes) performed inside the threads between each invocation to the scheduler.
Expand All @@ -56,7 +56,7 @@ class Aging2Experiment {
Aging2Experiment();

// Set the library to evaluate
void set_library(std::shared_ptr<library::UpdateInterface> library);
void set_library(std::shared_ptr<gfe::library::UpdateInterface> library);

// Set the path to the log file with all updates
void set_log(const std::string& path_log);
Expand Down
2 changes: 1 addition & 1 deletion experiment/aging2_result.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
using namespace common;
using namespace std;

namespace experiment {
namespace gfe::experiment {

Aging2Result::Aging2Result(const Aging2Experiment& parameters) : m_num_threads(parameters.m_num_threads), m_worker_granularity(parameters.m_worker_granularity){

Expand Down
13 changes: 8 additions & 5 deletions experiment/aging2_result.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,16 @@

// forward declarations
namespace common { class Database; }
namespace experiment { class Aging2Experiment; }
namespace experiment::details { class Aging2Master; }
namespace experiment::details { class Aging2Worker; }
namespace experiment::details { class LatencyStatistics; }
namespace gfe::experiment { class Aging2Experiment; }
namespace gfe::experiment::details { class Aging2Master; }
namespace gfe::experiment::details { class Aging2Worker; }
namespace gfe::experiment::details { class LatencyStatistics; }

namespace experiment {
namespace gfe::experiment {

/**
* This is a container for the parameters and the measured results of a single execution of the Aging2 experiment
*/
class Aging2Result {
friend class details::Aging2Master;
friend class details::Aging2Worker;
Expand Down
2 changes: 1 addition & 1 deletion experiment/details/aging2_master.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ extern mutex _log_mutex [[maybe_unused]];
* Init *
* *
*****************************************************************************/
namespace experiment::details {
namespace gfe::experiment::details {

Aging2Master::Aging2Master(const Aging2Experiment& parameters) :
m_parameters(parameters),
Expand Down
Loading

0 comments on commit 1a93f90

Please sign in to comment.