Skip to content

Commit

Permalink
Merge branch 'master' into version_hashcode
Browse files Browse the repository at this point in the history
Updating my branch to reflect the file organization refactor that Weijia
just finished implementing.
  • Loading branch information
etremel committed Apr 10, 2019
2 parents c10edc2 + 85676a9 commit 3dac09b
Show file tree
Hide file tree
Showing 311 changed files with 5,018 additions and 3,447 deletions.
19 changes: 0 additions & 19 deletions .gitmodules

This file was deleted.

159 changes: 121 additions & 38 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,49 +2,132 @@ cmake_minimum_required(VERSION 2.8.1)
set(CMAKE_DISABLE_SOURCE_CHANGES ON)
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
project(derecho CXX)

# Version
set(derecho_VERSION 0.9)
set(derecho_build_VERSION 0.9.1)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1z")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -std=c++1z -O0 -Wall -ggdb -gdwarf-3 -pg")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -std=c++1z -O3 -Wall -DNOLOG")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELEASE} -std=c++1z -O3 -Wall -ggdb -gdwarf-3 -DNOLOG")

add_subdirectory(conf)
add_subdirectory(utils)
add_subdirectory(derecho)
add_subdirectory(rdmc)
add_subdirectory(sst)
add_subdirectory(tcp)
add_subdirectory(persistent)
add_subdirectory(objectstore)
add_subdirectory(applications)

add_custom_target(
mutils_target
COMMAND $(MAKE)
WORKING_DIRECTORY ${derecho_SOURCE_DIR}/third_party/mutils
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -O0 -Wall -ggdb -gdwarf-3 -pg")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -O3 -Wall -DNOLOG")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS} -O3 -Wall -ggdb -gdwarf-3 -DNOLOG")

set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules")

# mutils_FOUND
# mutils_INCLUDE_DIRS
# mutils_LIBRARIES
find_package(mutils)
if (NOT ${mutils_FOUND})
message(FATAL_ERROR "mutils not found. Please install from https://github.com/mpmilano/mutils.git")
endif()

# mutils-tasks_FOUND
# mutils-tasks_INCLUDE_DIRS
# mutils-tasks_LIBRARIES
find_package(mutils-tasks)
if (NOT ${mutils-tasks_FOUND})
message(FATAL_ERROR "mutils not found. Please install from https://github.com/mpmilano/mutils-tasks.git")
endif()

# mutils-containers_FOUND
# mutils-containers_INCLUDE_DIRS
# mutils-containers_LIBRARIES
find_package(mutils-containers)
if (NOT ${mutils-containers_FOUND})
message(FATAL_ERROR "mutils-containers not found. Please install from https://github.com/mpmilano/mutils-containers.git")
endif()

# spdlog_FOUND
find_package(spdlog)
if (NOT ${spdlog_FOUND})
message(FATAL_ERROR "spdlog not found. Please install from https://github.com/gabime/spdlog [commit:10e809cf644d55e5bd7d66d02e2604e2ddd7fb48]")
endif()

# libfabric_FOUND
# libfabric_INCLUDE_DIRS
# libfabric_LIBRARIES
find_package(libfabric)
if (NOT ${libfabric_FOUND})
message(FATAL_ERROR "libfabric not found. Please install from https://github.com/ofiwg/libfabric.git. [commit:fcf0f2ec3c7109e06e09d3650564df8d2dfa12b6]")
endif()

add_subdirectory(src/mutils-serialization)
add_subdirectory(src/conf)
add_subdirectory(src/utils)
add_subdirectory(src/core)
add_subdirectory(src/rdmc)
add_subdirectory(src/sst)
add_subdirectory(src/tcp)
add_subdirectory(src/persistent)

# make libderecho.so
add_library(derecho SHARED
$<TARGET_OBJECTS:mutils-serialization>
$<TARGET_OBJECTS:conf>
$<TARGET_OBJECTS:utils>
$<TARGET_OBJECTS:core>
$<TARGET_OBJECTS:rdmc>
$<TARGET_OBJECTS:sst>
$<TARGET_OBJECTS:tcp>
$<TARGET_OBJECTS:persistent>)
target_link_libraries(derecho
rdmacm ibverbs rt pthread atomic
stdc++fs ${libfabric_LIBRARIES}
${mutils_LIBRARIES}
${mutils-containers_LIBRARIES}
${mutils-tasks_LIBRARIES})
set_target_properties(derecho PROPERTIES
SOVERSION ${derecho_VERSION}
VERSION ${derecho_build_VERSION}
)
add_dependencies(derecho
mutils-serialization conf utils core
rdmc sst tcp persistent)

# make install
install(TARGETS derecho EXPORT derecho
LIBRARY DESTINATION lib)
install(DIRECTORY
include/derecho/conf
include/derecho/core
include/derecho/mutils-serialization
include/derecho/persistent
include/derecho/rdmc
include/derecho/sst
include/derecho/tcp
include/derecho/utils
DESTINATION include/derecho)

include(CMakePackageConfigHelpers)
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/derecho/derechoConfigVersion.cmake"
VERSION ${derecho_VERSION}
COMPATIBILITY AnyNewerVersion
)
include_directories(${derecho_SOURCE_DIR}/third_party/mutils)
link_directories(${derecho_SOURCE_DIR}/third_party/mutils)
add_custom_target(
mutils_serialization_target
COMMAND CPLUS_INCLUDE_PATH=${derecho_SOURCE_DIR}/third_party/mutils $(MAKE)
WORKING_DIRECTORY ${derecho_SOURCE_DIR}/third_party/mutils-serialization

export (EXPORT derecho
FILE "${CMAKE_CURRENT_BINARY_DIR}/derecho/derechoTargets.cmake"
)
include_directories(${derecho_SOURCE_DIR}/third_party/mutils-serialization)
link_directories(${derecho_SOURCE_DIR}/third_party/mutils-serialization)

include_directories(${derecho_SOURCE_DIR}/third_party/mutils-containers)
configure_file (derechoConfig.cmake
"${CMAKE_CURRENT_BINARY_DIR}/derecho/derechoConfig.cmake"
COPYONLY
)

include_directories(${derecho_SOURCE_DIR}/third_party/spdlog/include)
set(ConfigPackageLocation lib/cmake/derecho)
install(EXPORT derecho
FILE derechoTargets.cmake
DESTINATION ${ConfigPackageLocation}
)

add_custom_target(
libfabric_target
# COMMAND { if [ ! -e Makefile ]\; then libtoolize && ./autogen.sh && ./configure CFLAGS='-g' --disable-mlx --enable-debug --prefix=/ \; fi } && make && make DESTDIR=${derecho_SOURCE_DIR}/third_party/libfabric/build install
COMMAND { if [ ! -e src/.libs/libfabric.so ]\; then libtoolize && ./autogen.sh && ./configure CFLAGS='-g' --disable-mlx --enable-debug --prefix=/ \; fi } && make
WORKING_DIRECTORY ${derecho_SOURCE_DIR}/third_party/libfabric
install(FILES
derechoConfig.cmake
"${CMAKE_CURRENT_BINARY_DIR}/derecho/derechoConfigVersion.cmake"
DESTINATION ${ConfigPackageLocation}
)
# include_directories(${derecho_SOURCE_DIR}/third_party/libfabric/build/include)
include_directories(${derecho_SOURCE_DIR}/third_party/libfabric/include)
# link_directories(${derecho_SOURCE_DIR}/third_party/libfabric/build/lib)
link_directories(${derecho_SOURCE_DIR}/third_party/libfabric/src/.libs)

include_directories(${derecho_SOURCE_DIR}/third_party)
# objectstore aka dPods
add_subdirectory(src/objectstore)

# applications
add_subdirectory(src/applications)
46 changes: 33 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,39 +17,59 @@ To obtain such high speeds, Derecho sacrifices some of the interoperability seen
Derecho does not have any specific O/S dependency. We've tested most extensively on the current release of Ubuntu, which is also the default Linux configuration used on Azure IoT Edge and Azure IoT, but there is no reason the system couldn't be used on other platforms.

## Organization
The code for this project is split into modules that interact only through each others' public interfaces. Each module resides in a directory with its own name, which is why the repository's root directory is mostly empty. External dependencies are located in the `third_party` directory, and will be pointers to Git submodules whenever possible to reduce code duplication.
The code for this project is split into modules that interact only through each others' public interfaces. Each module resides in a directory with its own name, which is why the repository's root directory is mostly empty. External dependencies have to be installed beforehand (Yes, we removed the submodules.)

## Installation
Derecho is a library that helps you build replicated, fault-tolerant services in a datacenter with RDMA networking. Here's how to start using it in your projects.

### Prerequisites
* Linux (other operating systems don't currently support the RDMA features we use)
* A C++ compiler supporting C++17: GCC 7.3+ or Clang 7+
* The following system libraries: `rdmacm` (packaged for Ubuntu as `librdmacm-dev`), `ibverbs` (packaged for Ubuntu as `libibverbs-dev`), `autoconf`, and `libtool`. The last two are required in order to build the LibFabrics library, which is bundled with Derecho under the `third_party` directory.
* CMake 2.8.1 or newer, if you want to use the bundled build scripts
* The following system libraries: `rdmacm` (packaged for Ubuntu as `librdmacm-dev`), `ibverbs` (packaged for Ubuntu as `libibverbs-dev`).
* Open Fabric Interface (OFI) library: [`libfabric`](https://github.com/ofiwg/libfabric). To avoid compatibility issue, please use commit `fcf0f2ec3c7109e06e09d3650564df8d2dfa12b6` on `master` branch. ([Installation script](https://github.com/Derecho-Project/derecho/blob/packaging/scripts/prerequisites/install-libfabric.sh))
* Logging library: [`spdlog`](https://github.com/gabime/spdlog). To avoid compatibility issue, please use commit `10e809cf644d55e5bd7d66d02e2604e2ddd7fb48` on `master` branch. ([Installation script](https://github.com/Derecho-Project/derecho/blob/packaging/scripts/prerequisites/install-spdlog.sh))
* Matthew's C++ utilities
- [`mutils`](https://github.com/mpmilano/mutils) ([Installation script](https://github.com/Derecho-Project/derecho/blob/packaging/scripts/prerequisites/install-mutils.sh))
- [`mutils-containers`](https://github.com/mpmilano/mutils-containers) ([Installation script](https://github.com/Derecho-Project/derecho/blob/packaging/scripts/prerequisites/install-mutils-containers.sh))
- [`mutils-tasks`](https://github.com/mpmilano/mutils-tasks) ([Installation script](https://github.com/Derecho-Project/derecho/blob/packaging/scripts/prerequisites/install-mutils-tasks.sh))

### Getting Started
Since this repository uses Git submodules to refer to some bundled dependencies, a simple `git clone` will not actually download all the code. To download a complete copy of the project, run
To download the project, run

git clone --recursive https://github.com/Derecho-Project/derecho.git
git clone https://github.com/Derecho-Project/derecho.git

Once cloning is complete, to compile the code, `cd` into the `derecho` directory and run:
* mkdir Release
* cd Release
Once cloning is complete, to build the code, `cd` into the `derecho` directory and run:
* `mkdir Release`
* `cd Release`
* `cmake -DCMAKE_BUILD_TYPE=Release ..`
* `make`
* ``make -j `lscpu | grep "^CPU(" | awk '{print $2}'` ``

This will place the binaries and libraries in the sub-dierectories of `Release`.
The other build type is Debug. If you need to build the Debug version, replace Release by Debug in the above instructions. We explicitly disable in-source build, so running `cmake .` in `derecho` will not work.

To add your own executable (that uses Derecho) to the build system, simply add an executable target to CMakeLists.txt with `derecho` as a "linked library." You can do this either in the top-level CMakeLists.txt or in the CMakeLists.txt inside the "applications" directory. It will look something like this:
Once the project is built, install it by run:
* `make DESTDIR=<path-to-installation> install`

add_executable(my_project_main my_project_main.cpp)
target_link_libraries(my_project_main derecho)
By default, derecho will be install into `/usr/local/`. Please make sure you have `sudo` priviledge to write to system directories.

Successful installtion will set up the followings in `$DESTDIR`:
* `include/derecho` - the header files
* `lib/libderecho.so` - the main shared library
* `lib/libdpods.so` - the derecho Old-Plain-Data storage library
* `lib/cmake/derecho` and `lib/cmake/dpods` - cmake support for `find_package(derecho)`/`find_package(dpods)`
* `share/derecho` - sample derecho configuration files.

To uninstall, run:
* ``rm -rf `cat install_manifest.txt` ``

To build your own derecho executable, simple run:
* `g++ -std=c++1z -o myapp myapp.cpp -lderecho -pthread`
* or, `g++ -std=c++1z -o myapp myapp.cpp -lderecho -dpods -pthread`, if you use **dPods**

To use Derecho in your code, you simply need to
- include the header `derecho/derecho.h` in your \*.h or \*.cpp files, and
- specify a configuration file, either by setting environment variable `DERECHO_CONF_FILE` or by placing a file named `derecho.cfg` in the working directory. A sample configuration file along with an explanation can be found in `conf/derecho-default.cfg`.
- include the header `derecho/core/derecho.hpp` in your \*.h \*.hpp or \*.cpp files, and
- specify a configuration file, either by setting environment variable `DERECHO_CONF_FILE` or by placing a file named `derecho.cfg` in the working directory. A sample configuration file along with an explanation can be found in `<installation-prefix>/share/derecho/derecho-sample.cfg`.

The configuration file consists of three sections: **DERECHO**, **RDMA**, and **PERS**. The **DERECHO** section includes core configuration options for a Derecho instance, which every application will need to customize. The **RDMA** section includes options for RDMA hardware specifications. The **PERS** section allows you to customize the persistent layer's behavior.

Expand Down
10 changes: 0 additions & 10 deletions applications/CMakeLists.txt

This file was deleted.

33 changes: 0 additions & 33 deletions applications/demos/CMakeLists.txt

This file was deleted.

10 changes: 0 additions & 10 deletions applications/tests/CMakeLists.txt

This file was deleted.

25 changes: 0 additions & 25 deletions applications/tests/performance_tests/CMakeLists.txt

This file was deleted.

18 changes: 0 additions & 18 deletions applications/tests/scalability_tests/CMakeLists.txt

This file was deleted.

34 changes: 0 additions & 34 deletions applications/tests/unit_tests/CMakeLists.txt

This file was deleted.

Loading

0 comments on commit 3dac09b

Please sign in to comment.