From cfa64a7994835e72f2335814c3fa5718fddb4bcd Mon Sep 17 00:00:00 2001 From: Takayuki Tanabe Date: Tue, 4 Aug 2020 01:52:12 +0900 Subject: [PATCH] adapt si cmake. --- .gitignore | 1 - common/Makefile | 8 ----- si/CMakeLists.txt | 75 +++++++++++++++++++++++++++++++++++++++++++++++ si/README.md | 27 +++++++++++++---- 4 files changed, 96 insertions(+), 15 deletions(-) create mode 100644 si/CMakeLists.txt diff --git a/.gitignore b/.gitignore index 66a13f42..cd2abb0f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ -*.txt *.dat *.eps *.data diff --git a/common/Makefile b/common/Makefile index 551feb3c..f795bc7f 100644 --- a/common/Makefile +++ b/common/Makefile @@ -1,12 +1,4 @@ -MOCC_SRCS1+=\ -$(REL)result.cc\ -$(REL)util.cc\ - -SI_SRCS1+=\ -$(REL)result.cc\ -$(REL)util.cc\ - SS2PL_SRCS1+=\ $(REL)result.cc\ $(REL)util.cc\ diff --git a/si/CMakeLists.txt b/si/CMakeLists.txt new file mode 100644 index 00000000..801b8d79 --- /dev/null +++ b/si/CMakeLists.txt @@ -0,0 +1,75 @@ +cmake_minimum_required(VERSION 3.10) + +project(ccbench_si + VERSION 0.0.1 + DESCRIPTION "si of ccbench" + LANGUAGES CXX) + +list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/../cmake") + +option(ENABLE_SANITIZER "enable sanitizer on debug build" ON) +option(ENABLE_UB_SANITIZER "enable undefined behavior sanitizer on debug build" OFF) +option(ENABLE_COVERAGE "enable coverage on debug build" OFF) + +find_package(Doxygen) +find_package(Threads REQUIRED) +find_package(gflags REQUIRED) +find_package(glog REQUIRED) +find_package(Boost + COMPONENTS filesystem) + +include(GNUInstallDirs) +include(CMakePackageConfigHelpers) +include(CompileOptions) + +file(GLOB SI_SOURCES + "../common/result.cc" + "../common/util.cc" + "si.cc" + "garbage_collection.cc" + "result.cc" + "transaction.cc" + "util.cc" + ) + +add_executable(si.exe ${SI_SOURCES}) + +target_link_libraries(si.exe + Boost::filesystem + gflags::gflags + ${PROJECT_SOURCE_DIR}/../third_party/mimalloc/out/release/libmimalloc.a + ${PROJECT_SOURCE_DIR}/../third_party/masstree/libkohler_masstree_json.a + Threads::Threads + ) + +if (DEFINED ADD_ANALYSIS) + add_definitions(-DADD_ANALYSIS=${ADD_ANALYSIS}) +else () + add_definitions(-DADD_ANALYSIS=0) +endif () + +if (DEFINED BACK_OFF) + add_definitions(-DBACK_OFF=${BACK_OFF}) +else () + add_definitions(-DBACK_OFF=0) +endif () + +add_definitions(-DCCTR_ON) + +if (DEFINED KEY_SIZE) + add_definitions(-DKEY_SIZE=${KEY_SIZE}) +else () + add_definitions(-DKEY_SIZE=8) +endif () + +if (DEFINED MASSTREE_USE) + add_definitions(-DMASSTREE_USE=${MASSTREE_USE}) +else () + add_definitions(-DMASSTREE_USE=1) +endif () + +if (DEFINED VAL_SIZE) + add_definitions(-DVAL_SIZE=${VAL_SIZE}) +else () + add_definitions(-DVAL_SIZE=4) +endif () diff --git a/si/README.md b/si/README.md index 19b887e5..f8f650f6 100644 --- a/si/README.md +++ b/si/README.md @@ -8,10 +8,19 @@ So some parts is like ERMIA in implementation, configuration, and design to anal $ cd ../ $ ./bootstrap.sh ``` -This makes ../third_party/masstree/libkohler_masstree_json.a used below building. +This makes ../third_party/masstree/libkohler_masstree_json.a used by building cicada. +- Build mimalloc +``` +$ cd ../ +$ ./bootstrap_mimalloc.sh +``` +This makes ../third_party/mimalloc/out/release/libmimalloc.a used by building cicada. - Build ``` -$ make +$ mkdir build +$ cd build +$ cmake -G Ninja -DCMAKE_BUILD_TYPE=Release .. +$ ninja ``` - Confirm usage ``` @@ -22,11 +31,17 @@ $ ./si.exe $ numactl --interleave=all ./si.exe 1000 10 224 100 off 0 off 2100 10 100 0 3 ``` -## How to select build options in Makefile -- `VAL_SIZE` : Value of key-value size. In other words, payload size. -- `ADD_ANALYSIS` : If this is 1, it is deeper analysis than setting 0. -- `BACK_OFF` : If this is 1, it use Cicada's backoff. +## How to customize options in CMakeLists.txt +- `ADD_ANALYSIS` : If this is 1, it is deeper analysis than setting 0.
+default : `0` +- `BACK_OFF` : If this is 1, it use Cicada's backoff.
+default : `0` +- `KEY_SORT` : If this is 1, its transaction accesses records in ascending key order.
+default : `0` - `MASSTREE_USE` : If this is 1, it use masstree as data structure. If not, it use simple array αs data structure. +default : `1` +- `VAL_SIZE` : Value of key-value size. In other words, payload size.
+default : `4` - CFLAGS - Use either `-DCCTR_ON` or `-DCCTR_TW`. These meanings is described below in section **Details of Implementation**.