Skip to content

Commit fda2ed2

Browse files
authored
Te seperated compilation (#1041)
* Add TE Separation Switch * Fix store compile and link error, add TE installation headers * Install libmooncake_store.so and libmooncake_common.so when BUILD_SHARED_LIBS=ON
1 parent b336a68 commit fda2ed2

6 files changed

Lines changed: 40 additions & 13 deletions

File tree

CMakeLists.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ if (BUILD_UNIT_TESTS)
1212
enable_testing()
1313
endif()
1414

15+
option(WITH_TE "build mooncake transfer engine and sample code" ON)
1516
option(WITH_STORE "build mooncake store library and sample code" ON)
1617
option(WITH_P2P_STORE "build p2p store library and sample code" OFF)
1718
option(WITH_RUST_EXAMPLE "build the Rust interface and sample code for the transfer engine" OFF)
@@ -45,8 +46,10 @@ add_subdirectory(mooncake-common)
4546
include_directories(mooncake-common/etcd)
4647
include_directories(mooncake-common/include)
4748

48-
add_subdirectory(mooncake-transfer-engine)
49-
include_directories(mooncake-transfer-engine/include)
49+
if (WITH_TE)
50+
add_subdirectory(mooncake-transfer-engine)
51+
include_directories(mooncake-transfer-engine/include)
52+
endif()
5053

5154
if (WITH_STORE)
5255
message(STATUS "Mooncake Store will be built")

mooncake-common/src/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,8 @@ add_library(mooncake_common
1010
target_link_libraries(mooncake_common PUBLIC
1111
yaml-cpp
1212
jsoncpp
13-
)
13+
)
14+
15+
if (BUILD_SHARED_LIBS)
16+
install(TARGETS mooncake_common DESTINATION lib)
17+
endif()

mooncake-integration/CMakeLists.txt

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,17 @@ message("${PYTHON_SYS_PATH}")
2929

3030
set(PYTHON_PACKAGE_NAME "mooncake")
3131

32-
pybind11_add_module(engine ${SOURCES} ${CACHE_ALLOCATOR_SOURCES}
33-
transfer_engine/transfer_engine_py.cpp
34-
)
32+
if (WITH_TE)
33+
pybind11_add_module(engine ${SOURCES} ${CACHE_ALLOCATOR_SOURCES}
34+
transfer_engine/transfer_engine_py.cpp
35+
)
3536

36-
target_link_libraries(engine PUBLIC
37-
transfer_engine
38-
glog::glog
39-
gflags::gflags
40-
)
37+
target_link_libraries(engine PUBLIC
38+
transfer_engine
39+
glog::glog
40+
gflags::gflags
41+
)
42+
endif()
4143

4244
set(ALLOCATOR_SO_PATH "${CMAKE_BINARY_DIR}/mooncake-transfer-engine/nvlink-allocator/nvlink_allocator.so")
4345
if(USE_MNNVL)
@@ -113,4 +115,6 @@ if (WITH_STORE)
113115
install(TARGETS store DESTINATION ${PYTHON_SYS_PATH}/${PYTHON_PACKAGE_NAME})
114116
endif()
115117

116-
install(TARGETS engine DESTINATION ${PYTHON_SYS_PATH}/${PYTHON_PACKAGE_NAME})
118+
if (WITH_TE)
119+
install(TARGETS engine DESTINATION ${PYTHON_SYS_PATH}/${PYTHON_PACKAGE_NAME})
120+
endif()

mooncake-store/src/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ if (STORE_USE_ETCD)
4848
add_dependencies(mooncake_store build_etcd_wrapper)
4949
endif()
5050

51+
if (BUILD_SHARED_LIBS)
52+
install(TARGETS mooncake_store DESTINATION lib)
53+
endif()
54+
5155
# Master binary
5256
add_executable(mooncake_master master.cpp)
5357

@@ -66,6 +70,7 @@ target_link_libraries(mooncake_master PRIVATE
6670
mooncake_store
6771
cachelib_memory_allocator
6872
pthread
73+
ibverbs
6974
mooncake_common
7075
${ETCD_WRAPPER_LIB}
7176
${MASTER_EXTRA_LIBS}
@@ -75,4 +80,4 @@ if (STORE_USE_ETCD)
7580
add_dependencies(mooncake_master build_etcd_wrapper)
7681
endif()
7782

78-
install(TARGETS mooncake_master DESTINATION bin)
83+
install(TARGETS mooncake_master DESTINATION bin)

mooncake-store/tests/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ function(add_store_test name)
55
cachelib_memory_allocator
66
${ETCD_WRAPPER_LIB}
77
glog
8+
ibverbs
89
gtest
910
gtest_main
1011
pthread
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,11 @@
11
install(FILES transfer_engine_c.h DESTINATION include)
2+
install(FILES common.h DESTINATION include)
3+
install(FILES config.h DESTINATION include)
4+
install(FILES error.h DESTINATION include)
5+
install(FILES memory_location.h DESTINATION include)
6+
install(FILES multi_transport.h DESTINATION include)
7+
install(FILES topology.h DESTINATION include)
8+
install(FILES transfer_engine.h DESTINATION include)
9+
install(FILES transfer_metadata.h DESTINATION include)
10+
install(FILES common/base/status.h DESTINATION include/common/base)
11+
install(FILES transport/transport.h DESTINATION include/transport)

0 commit comments

Comments
 (0)