Skip to content

Commit

Permalink
Merge pull request #277 from songweijia/2.4.0rc
Browse files Browse the repository at this point in the history
Fix include directives and introduce config.h to control compile-time features.
  • Loading branch information
etremel committed May 9, 2024
2 parents 97e260c + fbf7865 commit 0f637a5
Show file tree
Hide file tree
Showing 105 changed files with 352 additions and 247 deletions.
30 changes: 23 additions & 7 deletions CMakeLists.txt
Expand Up @@ -8,9 +8,6 @@ set(derecho_VERSION 2.4)
set(derecho_build_VERSION 2.4.0)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
if (${USE_VERBS_API})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_VERBS_API")
endif()
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDERECHO_DEBUG -O0 -Wall -ggdb -gdwarf-3")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wall")
set(CMAKE_CXX_FLAGS_BENCHMARK "${CMAKE_CXX_FLAGS_RELEASE} -Wall -DNOLOG -Ofast -march=native")
Expand Down Expand Up @@ -62,6 +59,25 @@ find_package(nlohmann_json 3.9.0 REQUIRED)
# Target: Doxygen
find_package(Doxygen)


# Source code configurations go to config.h
# Shift to verbs API. We use libfabric by default.
if (${USE_VERBS_API})
set(USE_VERBS_API 1)
else()
set(USE_VERBS_API 0)
endif()
# Enable High memory registration (for device memory like GPU memory.)
# Important: this does not work with libfabric provider like tcp and socket because they cannot
# RDMA to device memory.
if (${ENABLE_HMEM})
set(ENABLE_HMEM 1)
else()
set(ENABLE_HMEM 0)
endif()
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/include/derecho/config.h)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include)

add_subdirectory(src/mutils-serialization)
add_subdirectory(src/conf)
add_subdirectory(src/utils)
Expand Down Expand Up @@ -112,14 +128,14 @@ add_dependencies(derecho

# Setup for make install
# Declare that we will install the targets built by "derecho"
install(TARGETS derecho
EXPORT derechoTargets
install(TARGETS derecho EXPORT derechoTargets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
# Declare that we will install the "include/" directory as a standard include directory
install(DIRECTORY
include/
TYPE INCLUDE)
${CMAKE_CURRENT_SOURCE_DIR}/include/derecho
${CMAKE_CURRENT_BINARY_DIR}/include/derecho
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})

# Use CMakePackageConfigHelpers to create a package version file and config file
include(CMakePackageConfigHelpers)
Expand Down
3 changes: 3 additions & 0 deletions config.h.in
@@ -0,0 +1,3 @@
#pragma once
#cmakedefine USE_VERBS_API
#cmakedefine ENABLE_HMEM
2 changes: 2 additions & 0 deletions include/derecho/conf/conf.hpp
@@ -1,6 +1,8 @@
#pragma once
#ifndef CONF_HPP
#define CONF_HPP

#include <derecho/config.h>
#include "getpot/GetPot"
#include <atomic>
#include <getopt.h>
Expand Down
3 changes: 2 additions & 1 deletion include/derecho/core/bytes_object.hpp
@@ -1,6 +1,7 @@
#pragma once

#include "derecho/mutils-serialization/SerializationSupport.hpp"
#include <derecho/config.h>
#include <derecho/mutils-serialization/SerializationSupport.hpp>

#include <cstring>
#include <memory>
Expand Down
1 change: 1 addition & 0 deletions include/derecho/core/derecho.hpp
Expand Up @@ -5,6 +5,7 @@
* @brief This file includes the essential core headers.
*/

#include <derecho/config.h>
#include "derecho_exception.hpp"
#include "detail/derecho_internal.hpp"
#include "derecho_type_definitions.hpp"
Expand Down
3 changes: 2 additions & 1 deletion include/derecho/core/derecho_exception.hpp
Expand Up @@ -5,7 +5,8 @@

#pragma once

#include "derecho/core/git_version.hpp"
#include <derecho/config.h>
#include "git_version.hpp"

#include <exception>
#include <sstream>
Expand Down
1 change: 1 addition & 0 deletions include/derecho/core/derecho_type_definitions.hpp
Expand Up @@ -2,6 +2,7 @@

#include <string>
#include <cstdint>
#include <derecho/config.h>

namespace derecho {

Expand Down
3 changes: 2 additions & 1 deletion include/derecho/core/detail/connection_manager.hpp
@@ -1,7 +1,8 @@
#pragma once

#include <derecho/config.h>
#include "../derecho_type_definitions.hpp"
#include "derecho/tcp/tcp.hpp"
#include <derecho/tcp/tcp.hpp>
#include "locked_reference.hpp"

#include <cassert>
Expand Down
3 changes: 2 additions & 1 deletion include/derecho/core/detail/derecho_sst.hpp
@@ -1,7 +1,8 @@
#pragma once

#include <derecho/config.h>
#include "../derecho_type_definitions.hpp"
#include "derecho/sst/sst.hpp"
#include <derecho/sst/sst.hpp>
#include "derecho_internal.hpp"

#include <atomic>
Expand Down
1 change: 1 addition & 0 deletions include/derecho/core/detail/external_group_impl.hpp
@@ -1,3 +1,4 @@
#include <derecho/config.h>
#include "../external_group.hpp"
#include "version_code.hpp"

Expand Down
8 changes: 4 additions & 4 deletions include/derecho/core/detail/group_impl.hpp
Expand Up @@ -2,11 +2,11 @@
* @file group_impl.hpp
* @date Apr 22, 2016
*/

#include <derecho/config.h>
#include "../group.hpp"
#include "derecho/mutils-serialization/SerializationSupport.hpp"
#include "derecho/utils/container_template_functions.hpp"
#include "derecho/utils/logger.hpp"
#include <derecho/mutils-serialization/SerializationSupport.hpp>
#include <derecho/utils/container_template_functions.hpp>
#include <derecho/utils/logger.hpp>
#include "derecho_internal.hpp"
#include "make_kind_map.hpp"

Expand Down
1 change: 1 addition & 0 deletions include/derecho/core/detail/make_kind_map.hpp
Expand Up @@ -8,6 +8,7 @@

#pragma once

#include <derecho/config.h>
#include "derecho_internal.hpp"
#include <mutils-containers/KindMap.hpp>

Expand Down
11 changes: 6 additions & 5 deletions include/derecho/core/detail/multicast_group.hpp
@@ -1,14 +1,15 @@
#pragma once

#include <derecho/config.h>
#include "../derecho_modes.hpp"
#include "../subgroup_info.hpp"
#include "connection_manager.hpp"
#include "derecho/conf/conf.hpp"
#include "derecho/mutils-serialization/SerializationMacros.hpp"
#include "derecho/mutils-serialization/SerializationSupport.hpp"
#include "derecho/rdmc/rdmc.hpp"
#include "derecho/sst/multicast.hpp"
#include "derecho/sst/sst.hpp"
#include <derecho/mutils-serialization/SerializationMacros.hpp>
#include <derecho/mutils-serialization/SerializationSupport.hpp>
#include <derecho/rdmc/rdmc.hpp>
#include <derecho/sst/multicast.hpp>
#include <derecho/sst/sst.hpp>
#include "derecho_internal.hpp"
#include "derecho_sst.hpp"
#include "persistence_manager.hpp"
Expand Down
5 changes: 3 additions & 2 deletions include/derecho/core/detail/p2p_connection.hpp
@@ -1,9 +1,10 @@
#pragma once

#include <derecho/config.h>
#ifdef USE_VERBS_API
#include "derecho/sst/detail/verbs.hpp"
#include <derecho/sst/detail/verbs.hpp>
#else
#include "derecho/sst/detail/lf.hpp"
#include <derecho/sst/detail/lf.hpp>
#endif

#include <atomic>
Expand Down
7 changes: 4 additions & 3 deletions include/derecho/core/detail/p2p_connection_manager.hpp
@@ -1,12 +1,13 @@
#pragma once

#include <derecho/config.h>
#include "p2p_connection.hpp"
#ifdef USE_VERBS_API
#include "derecho/sst/detail/verbs.hpp"
#include <derecho/sst/detail/verbs.hpp>
#else
#include "derecho/sst/detail/lf.hpp"
#include <derecho/sst/detail/lf.hpp>
#endif
#include "derecho/utils/logger.hpp"
#include <derecho/utils/logger.hpp>

#include <atomic>
#include <functional>
Expand Down
7 changes: 4 additions & 3 deletions include/derecho/core/detail/persistence_manager.hpp
Expand Up @@ -5,9 +5,10 @@
*/
#pragma once

#include "derecho/openssl/signature.hpp"
#include "derecho/persistent/PersistentInterface.hpp"
#include "derecho/utils/logger.hpp"
#include <derecho/config.h>
#include <derecho/openssl/signature.hpp>
#include <derecho/persistent/PersistentInterface.hpp>
#include <derecho/utils/logger.hpp>
#include "derecho_internal.hpp"
#include "replicated_interface.hpp"

Expand Down
3 changes: 2 additions & 1 deletion include/derecho/core/detail/public_key_store.hpp
Expand Up @@ -3,8 +3,9 @@
*/
#pragma once

#include <derecho/config.h>
#include "../derecho_exception.hpp"
#include "derecho/openssl/signature.hpp"
#include <derecho/openssl/signature.hpp>
#include "derecho_internal.hpp"

#include <map>
Expand Down
7 changes: 4 additions & 3 deletions include/derecho/core/detail/remote_invocable.hpp
Expand Up @@ -6,9 +6,10 @@

#pragma once

#include "derecho/conf/conf.hpp"
#include "derecho/mutils-serialization/SerializationSupport.hpp"
#include "derecho/utils/logger.hpp"
#include <derecho/config.h>
#include <derecho/conf/conf.hpp>
#include <derecho/mutils-serialization/SerializationSupport.hpp>
#include <derecho/utils/logger.hpp>
#include "rpc_utils.hpp"

#include <mutils/FunctionalMap.hpp>
Expand Down
3 changes: 2 additions & 1 deletion include/derecho/core/detail/replicated_impl.hpp
@@ -1,9 +1,10 @@
#pragma once

#include <derecho/config.h>
#include "../replicated.hpp"
#include "view_manager.hpp"

#include "derecho/mutils-serialization/SerializationSupport.hpp"
#include <derecho/mutils-serialization/SerializationSupport.hpp>

#include <functional>
#include <mutex>
Expand Down
5 changes: 3 additions & 2 deletions include/derecho/core/detail/replicated_interface.hpp
@@ -1,7 +1,8 @@
#pragma once

#include "derecho/openssl/signature.hpp"
#include "derecho/tcp/tcp.hpp"
#include <derecho/config.h>
#include <derecho/openssl/signature.hpp>
#include <derecho/tcp/tcp.hpp>
#include "derecho_internal.hpp"

#include <optional>
Expand Down
3 changes: 2 additions & 1 deletion include/derecho/core/detail/restart_state.hpp
@@ -1,9 +1,10 @@
#pragma once

#include <derecho/config.h>
#include "../subgroup_info.hpp"
#include "../view.hpp"
#include "derecho_internal.hpp"
#include "derecho/mutils-serialization/SerializationSupport.hpp"
#include <derecho/mutils-serialization/SerializationSupport.hpp>

#include <spdlog/spdlog.h>

Expand Down
7 changes: 4 additions & 3 deletions include/derecho/core/detail/rpc_manager.hpp
Expand Up @@ -6,11 +6,12 @@

#pragma once

#include <derecho/config.h>
#include "../derecho_type_definitions.hpp"
#include "../view.hpp"
#include "derecho/mutils-serialization/SerializationSupport.hpp"
#include "derecho/persistent/Persistent.hpp"
#include "derecho/utils/logger.hpp"
#include <derecho/mutils-serialization/SerializationSupport.hpp>
#include <derecho/persistent/Persistent.hpp>
#include <derecho/utils/logger.hpp>
#include "derecho_internal.hpp"
#include "p2p_connection_manager.hpp"
#include "remote_invocable.hpp"
Expand Down
5 changes: 3 additions & 2 deletions include/derecho/core/detail/rpc_utils.hpp
Expand Up @@ -6,10 +6,11 @@

#pragma once

#include <derecho/config.h>
#include "../derecho_exception.hpp"
#include "../derecho_type_definitions.hpp"
#include "derecho/mutils-serialization/SerializationSupport.hpp"
#include "derecho/utils/logger.hpp"
#include <derecho/mutils-serialization/SerializationSupport.hpp>
#include <derecho/utils/logger.hpp>
#include "derecho_internal.hpp"

#include <mutils/macro_utils.hpp>
Expand Down
5 changes: 3 additions & 2 deletions include/derecho/core/detail/view_manager.hpp
Expand Up @@ -5,10 +5,11 @@
*/
#pragma once

#include <derecho/config.h>
#include "../subgroup_info.hpp"
#include "../view.hpp"
#include "derecho/conf/conf.hpp"
#include "derecho/mutils-serialization/SerializationSupport.hpp"
#include <derecho/conf/conf.hpp>
#include <derecho/mutils-serialization/SerializationSupport.hpp>
#include "derecho_internal.hpp"
#include "locked_reference.hpp"
#include "multicast_group.hpp"
Expand Down
3 changes: 2 additions & 1 deletion include/derecho/core/external_group.hpp
Expand Up @@ -5,7 +5,8 @@
* @brief This file contains the APIs for external clients.
*/

#include "derecho/conf/conf.hpp"
#include <derecho/config.h>
#include <derecho/conf/conf.hpp>
#include "detail/connection_manager.hpp"
#include "detail/p2p_connection_manager.hpp"
#include "group.hpp"
Expand Down
5 changes: 3 additions & 2 deletions include/derecho/core/group.hpp
Expand Up @@ -5,8 +5,9 @@
* @brief Declaration of the `Group<>` class template.
*/

#include "derecho/conf/conf.hpp"
#include "derecho/tcp/tcp.hpp"
#include <derecho/config.h>
#include <derecho/conf/conf.hpp>
#include <derecho/tcp/tcp.hpp>
#include "derecho_exception.hpp"
#include "detail/derecho_internal.hpp"
#include "detail/persistence_manager.hpp"
Expand Down
5 changes: 3 additions & 2 deletions include/derecho/core/notification.hpp
Expand Up @@ -5,8 +5,9 @@
* @brief This file include the declarations of types for the notification API.
*/

#include "derecho/mutils-serialization/SerializationMacros.hpp"
#include "derecho/mutils-serialization/SerializationSupport.hpp"
#include <derecho/config.h>
#include <derecho/mutils-serialization/SerializationMacros.hpp>
#include <derecho/mutils-serialization/SerializationSupport.hpp>
#include "register_rpc_functions.hpp"

#include <functional>
Expand Down
3 changes: 2 additions & 1 deletion include/derecho/core/register_rpc_functions.hpp
@@ -1,5 +1,6 @@
#pragma once
#include "derecho/utils/map_macro.hpp"
#include <derecho/config.h>
#include <derecho/utils/map_macro.hpp>
#include "detail/rpc_utils.hpp"

#define make_p2p_tagger_expr(x) derecho::rpc::tag_p2p<derecho::rpc::hash_cstr(#x)>(&classname::x)
Expand Down
5 changes: 3 additions & 2 deletions include/derecho/core/replicated.hpp
Expand Up @@ -5,8 +5,9 @@

#pragma once

#include "derecho/persistent/Persistent.hpp"
#include "derecho/tcp/tcp.hpp"
#include <derecho/config.h>
#include <derecho/persistent/Persistent.hpp>
#include <derecho/tcp/tcp.hpp>
#include "derecho_exception.hpp"
#include "detail/derecho_internal.hpp"
#include "detail/remote_invocable.hpp"
Expand Down
3 changes: 2 additions & 1 deletion include/derecho/core/subgroup_functions.hpp
Expand Up @@ -4,7 +4,8 @@

#pragma once

#include "derecho/utils/logger.hpp"
#include <derecho/config.h>
#include <derecho/utils/logger.hpp>
#include "derecho_exception.hpp"
#include "derecho_modes.hpp"
#include "detail/derecho_internal.hpp"
Expand Down
1 change: 1 addition & 0 deletions include/derecho/core/subgroup_info.hpp
Expand Up @@ -6,6 +6,7 @@

#pragma once

#include <derecho/config.h>
#include "derecho_exception.hpp"

#include <cstdint>
Expand Down

0 comments on commit 0f637a5

Please sign in to comment.