Skip to content

Commit

Permalink
adapt mocc's cmake.
Browse files Browse the repository at this point in the history
  • Loading branch information
thawk105 committed Aug 3, 2020
1 parent 46f1f9d commit 3b5e293
Show file tree
Hide file tree
Showing 5 changed files with 121 additions and 61 deletions.
4 changes: 0 additions & 4 deletions common/Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@

ERMIA_SRCS1+=\
$(REL)result.cc\
$(REL)util.cc\

MOCC_SRCS1+=\
$(REL)result.cc\
$(REL)util.cc\
Expand Down
2 changes: 1 addition & 1 deletion ermia/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ $ ./ermia.exe -help
$ numactl --interleave=all ./ermia.exe -tuple_num=1000 -max_ope=10 -thread_num=224 -rratio=100 -rmw=0 -zipf_skew=0 -ycsb=1 -clocks_per_us=2100 -gc_inter_us=10 -pre_reserve_version=10000 -pre_reserve_tmt_element=100 -extime=3
```

## How to select build options in Makefile
## How to customize options in CMakeLists.txt
- `ADD_ANALYSIS` : If this is 1, it is deeper analysis than setting 0.<br>
default : `0`
- `BACK_OFF` : If this is 1, it use Cicada's backoff.<br>
Expand Down
87 changes: 87 additions & 0 deletions mocc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
cmake_minimum_required(VERSION 3.10)

project(ccbench_mocc
VERSION 0.0.1
DESCRIPTION "mocc 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 ERMIA_SOURCES
"../common/result.cc"
"../common/util.cc"
"lock.cc"
"mocc.cc"
"result.cc"
"transaction.cc"
"util.cc"
)

add_executable(mocc.exe ${ERMIA_SOURCES})

target_link_libraries(mocc.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 ()

if (DEFINED KEY_SIZE)
add_definitions(-DKEY_SIZE=${KEY_SIZE})
else ()
add_definitions(-DKEY_SIZE=8)
endif ()

if (DEFINED KEY_SORT)
add_definitions(-DKEY_SORT=${KEY_SORT})
else ()
add_definitions(-DKEY_SORT=0)
endif ()

if (DEFINED MASSTREE_USE)
add_definitions(-DMASSTREE_USE=${MASSTREE_USE})
else ()
add_definitions(-DMASSTREE_USE=1)
endif ()

add_definitions(-DRWLOCK)

if (DEFINED TEMPERATURE_RESET_OPT)
add_definitions(-DTEMPERATURE_RESET_OPT=${TEMPERATURE_RESET_OPT})
else ()
add_definitions(-DTEMPERATURE_RESET_OPT=1)
endif ()

if (DEFINED VAL_SIZE)
add_definitions(-DVAL_SIZE=${VAL_SIZE})
else ()
add_definitions(-DVAL_SIZE=4)
endif ()
48 changes: 0 additions & 48 deletions mocc/Makefile

This file was deleted.

41 changes: 33 additions & 8 deletions mocc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,19 @@ It was proposed at VLDB'2017 by Tianzheng Wang.
$ 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
```
Expand All @@ -21,13 +30,29 @@ $ ./mocc.exe -help
$ numactl --interleave=all ./mocc.exe -clocks_per_us=2100 -epoch_time=40 -extime=3 -max_ope=10 -rmw=0 -rratio=100 -thread_num=224 -tuple_num=1000000 -ycsb=1 -zipf_skew=0 -per_xx_temp=4096
```

## How to select build options in Makefile
- `ADD_ANALYSIS` : If this is 1, it is deeper analysis than setting 0.
- `BACK_OFF` : If this is 1, it use Cicada's backoff.
- `KEY_SORT` : If this is 1, its transaction accesses records in ascending key order.
## How to customize options in CMakeLists.txt
- `ADD_ANALYSIS` : If this is 1, it is deeper analysis than setting 0.<br>
default : `0`
- `BACK_OFF` : If this is 1, it use Cicada's backoff.<br>
default : `0`
- `KEY_SORT` : If this is 1, its transaction accesses records in ascending key order.<br>
default : `0`
- `MASSTREE_USE` : If this is 1, it use masstree as data structure. If not, it use simple array αs data structure.
- `TEMPERATURE_RESET_OPT` : If this is 1, it uses new temprature control protocol which reduces contentions and improves throughput much.
- `VAL_SIZE` : Value of key-value size. In other words, payload size.
default : `1`
- `TEMPERATURE_RESET_OPT` : If this is 1, it uses new temprature control protocol which reduces contentions and improves throughput much.<br>
default : `1`
- `VAL_SIZE` : Value of key-value size. In other words, payload size.<br>
default : `4`

## Custom build examples
```
$ cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DKEY_SIZE=1000 -DVAL_SIZE=1000 ..
```
- Note: If you re-run cmake, don't forget to remove cmake cache.
```
$ rm CMakeCache.txt
```
The cmake cache definition data is used in preference to the command line definition data.

## Optimizations
- Backoff.
Expand Down

0 comments on commit 3b5e293

Please sign in to comment.