Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
sds
sds-keyval
Commits
42c0fef5
Commit
42c0fef5
authored
Nov 20, 2017
by
David Rich
Committed by
Rob Latham
Nov 22, 2017
Browse files
Clean up build process to support selective builds.
parent
00efe1c1
Changes
9
Hide whitespace changes
Inline
Side-by-side
Makefile.am
View file @
42c0fef5
...
...
@@ -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
README.build
0 → 100644
View file @
42c0fef5
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
README.config
deleted
100644 → 0
View file @
00efe1c1
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
configure.ac
View file @
42c0fef5
...
...
@@ -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
...
...
src/datastore.cc
View file @
42c0fef5
...
...
@@ -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
src/datastore.h
View file @
42c0fef5
...
...
@@ -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
src/kv-server.cc
View file @
42c0fef5
...
...
@@ -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
)
{
...
...
test/bench-client.cc
View file @
42c0fef5
...
...
@@ -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
);
...
...
test/test-client.cc
View file @
42c0fef5
...
...
@@ -64,7 +64,7 @@ int main(int argc, char **argv) {
std
::
cout
<<
"remote_bulk_val: "
<<
remote_bulk_val
[
0
]
<<
std
::
endl
;
}
#if
1 // if
de
f
o
ut when testing with LevelDB or BerkeleyDB
#if
BWTREE // kv_benchmark co
de o
nly 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
"
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment