Commit 42c0fef5 authored by David Rich's avatar David Rich Committed by Rob Latham

Clean up build process to support selective builds.

parent 00efe1c1
......@@ -67,7 +67,7 @@ test_test_server_SOURCES = test/test-server.cc
test_test_server_CXXFLAGS = -pthread -std=c++11 -g -Wall -mcx16 -Wno-invalid-offsetof
test_test_server_CPPFLAGS = ${CPPFLAGS} -I${srcdir}/src
test_test_server_DEPENDENCIES = lib/libkvserver.la
test_test_server_LDFLAGS = -Llib -lkvserver -lssg -lleveldb -ldb_cxx -lboost_filesystem -lboost_system
test_test_server_LDFLAGS = -Llib -lkvserver -lssg -lboost_filesystem -lboost_system
test_test_mpi_SOURCES = test/test-mpi.cc
......@@ -76,7 +76,7 @@ test_test_mpi_CPPFLAGS = ${CPPFLAGS} -I${srcdir}/src
test_test_mpi_DEPENDENCIES = lib/libkvserver.la lib/libkvclient.la
test_test_mpi_LDFLAGS = -Llib -lkvclient -lkvserver -lssg -lleveldb -ldb_cxx -lboost_filesystem -lboost_system
test_test_mpi_LDFLAGS = -Llib -lkvclient -lkvserver -lssg -lboost_filesystem -lboost_system
test_test_mpi_group_SOURCES = test/test-mpi-group.cc
test_test_mpi_group_CXXFLAGS = -pthread -std=c++11 -g -Wall -mcx16 -Wno-invalid-offsetof
......@@ -89,3 +89,4 @@ pkgconfig_DATA = maint/kv-server.pc \
maint/kv-client.pc
To Build:
./prepare.sh
On Darwin, run configure like this:
With BwTree: ./configure CC=mpicc CXX=mpicxx --prefix=$HOME/mochi --enable-BWTREE
With BerkeleyDB: ./configure CC=mpicc CXX=mpicxx --prefix=$HOME/mochi --enable-BERKELEYDB
With LevelDB: ./configure CC=mpicc CXX=mpicxx --prefix=$HOME/mochi --enable-LEVELDB
On Cori, run configure like this:
With BwTree: ./configure CC=cc CXX=CC LDFLAGS="-dynamic -latomic" --prefix=$HOME/mochi --enable-BWTREE
With BerkeleyDB: ./configure CC=cc CXX=CC LDFLAGS="-dynamic -latomic" --prefix=$HOME/mochi --enable-BERKELEYDB
With LevelDB: ./configure CC=cc CXX=CC LDFLAGS="-dynamic -latomic" --prefix=$HOME/mochi --enable-LEVELDB
make -j16
make install
For MPI test clients:
make test/test-mpi
make test/test-mpi-group
On Darwin, run configure like this:
./configure CC=mpicc CXX=mpicxx LDFLAGS="`pkg-config --libs leveldb`" --prefix=$HOME/mochi
On Cori, run configure like this:
./configure CXX=CC CC=cc LDFLAGS="-dynamic -latomic" --prefix=$HOME/mochi
......@@ -28,6 +28,28 @@ if test "x$PKG_CONFIG" == "x"; then
AC_MSG_ERROR([Could not find pkg-config utility!])
fi
PKG_CHECK_MODULES([MARGO],[margo],[],
AC_MSG_ERROR([Could not find working margo installation!]) )
LIBS="$MARGO_LIBS $LIBS"
CPPFLAGS="$MARGO_CFLAGS $CPPFLAGS"
CFLAGS="$MARGO_CFLAGS $CFLAGS"
AC_ARG_ENABLE([BWTREE], [],
[CPPFLAGS="-DBWTREE $CPPFLAGS"
CFLAGS="-DBWTREE $CFLAGS"])
AC_ARG_ENABLE([BERKELEYDB], [],
[CPPFLAGS="-DBERKELEYDB $CPPFLAGS"
CFLAGS="-DBERKELEYDB $CFLAGS"
LDFLAGS="-ldb_cxx"])
AC_ARG_ENABLE([LEVELDB], [],
[PKG_CHECK_MODULES([LEVELDB],[leveldb],[],
AC_MSG_ERROR([Could not find working leveldb installation!]) )
LIBS="$LIBS $LEVELDB_LIBS"
CPPFLAGS="$LEVELDB_CFLAGS -DLEVELDB $CPPFLAGS"
CFLAGS="$LEVELDB_CFLAGS -DLEVELDB $CFLAGS"])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_INLINE
AC_TYPE_INT64_T
......
......@@ -23,6 +23,7 @@ AbstractDataStore::AbstractDataStore(Duplicates duplicates, bool eraseOnGet, boo
AbstractDataStore::~AbstractDataStore()
{};
#if BWTREE
BwTreeDataStore::BwTreeDataStore() :
AbstractDataStore(Duplicates::IGNORE, false, false) {
_tree = NULL;
......@@ -32,7 +33,7 @@ BwTreeDataStore::BwTreeDataStore(Duplicates duplicates, bool eraseOnGet, bool de
AbstractDataStore(duplicates, eraseOnGet, debug) {
_tree = NULL;
};
BwTreeDataStore::~BwTreeDataStore() {
// deleting BwTree can cause core dump
delete _tree;
......@@ -127,8 +128,9 @@ bool BwTreeDataStore::get(ds_bulk_t &key, std::vector<ds_bulk_t> &data) {
void BwTreeDataStore::BwTreeDataStore::set_in_memory(bool enable)
{};
#endif
#if LEVELDB
LevelDBDataStore::LevelDBDataStore() :
AbstractDataStore(Duplicates::IGNORE, false, false) {
_dbm = NULL;
......@@ -241,8 +243,10 @@ bool LevelDBDataStore::get(ds_bulk_t &key, std::vector<ds_bulk_t> &data) {
void LevelDBDataStore::LevelDBDataStore::set_in_memory(bool enable)
{};
#endif
#if BERKELEYDB
BerkeleyDBDataStore::BerkeleyDBDataStore() :
AbstractDataStore(Duplicates::IGNORE, false, false) {
_dbm = NULL;
......@@ -438,3 +442,4 @@ bool BerkeleyDBDataStore::get(ds_bulk_t &key, std::vector<ds_bulk_t> &data) {
void BerkeleyDBDataStore::BerkeleyDBDataStore::set_in_memory(bool enable) {
_in_memory = enable;
};
#endif
......@@ -58,6 +58,7 @@ protected:
bool _in_memory;
};
#if BWTREE
class BwTreeDataStore : public AbstractDataStore {
public:
BwTreeDataStore();
......@@ -73,7 +74,9 @@ protected:
my_less, my_equal, my_hash,
my_equal, my_hash> *_tree = NULL;
};
#endif
#if LEVELDB
// may want to implement some caching for persistent stores like LevelDB
class LevelDBDataStore : public AbstractDataStore {
public:
......@@ -91,7 +94,9 @@ private:
std::string toString(ds_bulk_t &key);
ds_bulk_t fromString(std::string &keystr);
};
#endif
#if BERKELEYDB
// may want to implement some caching for persistent stores like BerkeleyDB
class BerkeleyDBDataStore : public AbstractDataStore {
public:
......@@ -107,5 +112,6 @@ protected:
DbEnv *_dbenv = NULL;
Db *_dbm = NULL;
};
#endif
#endif // datastore_h
......@@ -30,10 +30,15 @@ static hg_return_t open_handler(hg_handle_t handle)
#endif
if (!datastore) {
//datastore = new BwTreeDataStore(); // testing BwTree
datastore = new LevelDBDataStore(); // testing LevelDB
//datastore = new BerkeleyDBDataStore(); // testing BerkeleyDB
#if BWTREE
datastore = new BwTreeDataStore(); // testing BwTree
#elif BERKELEYDB
datastore = new BerkeleyDBDataStore(); // testing BerkeleyDB
// in-memory implementation not working, needs debugging
//datastore->set_in_memory(true); // testing in-memory BerkeleyDB
#elif LEVELDB
datastore = new LevelDBDataStore(); // testing LevelDB
#endif
db_name = in_name;
datastore->createDatabase(db_name);
#ifdef KV_DEBUG
......@@ -363,6 +368,7 @@ static void shutdown_handler(hg_handle_t handle)
}
DEFINE_MARGO_RPC_HANDLER(shutdown_handler)
#if BWTREE
/*
* from BwTree tests:
* RandomInsertSpeedTest() - Tests how fast it is to insert keys randomly
......@@ -443,6 +449,16 @@ static void RandomInsertSpeedTest(int32_t key_num, bench_result_t *results)
return;
}
#else
static void RandomInsertSpeedTest(int32_t key_num, bench_result_t *results)
{
std::cout << "BwTree not enabled, no results" << std::endl;
results->nkeys = 0;
results->insert_time = 0.0;
results->read_time = 0.0;
results->overhead = 0.0;
}
#endif
static hg_return_t bench_handler(hg_handle_t handle)
{
......
......@@ -65,7 +65,6 @@ int main(int argc, char **argv)
{
hg_return_t ret;
bench_result_t rpc;
bench_result_t *server;
kv_context_t *context;
assert(argc == 3);
......@@ -81,7 +80,8 @@ int main(int argc, char **argv)
RandomInsertSpeedTest(context, items, &rpc);
print_results(&rpc);
#if 1 // ifdef out when testing with LevelDB or BerkeleyDB
#if BWTREE // kv_benchmark code only supported when BwTree enabled
bench_result_t *server;
server = kv_benchmark(context, items);
print_results(server);
free(server);
......
......@@ -64,7 +64,7 @@ int main(int argc, char **argv) {
std::cout << "remote_bulk_val: " << remote_bulk_val[0] << std::endl;
}
#if 1 // ifdef out when testing with LevelDB or BerkeleyDB
#if BWTREE // kv_benchmark code only supported when BwTree enabled
bench_result_t *output;
output = kv_benchmark(context, 1000);
printf("inserts: %zd keys in %f seconds: %f Million-inserts per sec\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment