Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 36 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,18 @@ project(vineyard LANGUAGES C CXX VERSION ${VINEYARD_VERSION})

option(BUILD_SHARED_LIBS "Build shared libraries" ON)
option(USE_STATIC_BOOST_LIBS "Build with static-linked boost libraries" OFF)
option(LINK_STATIC_LIBC "Link with static libstdc++ if the BUILD_SHARED_LIBS is OFF and the compiler is gcc" ON)
option(USE_EXTERNAL_ETCD_LIBS "Build with external etcd-cpp-apiv3 library rather than the submodule one" OFF)
option(USE_EXTERNAL_REDIS_LIBS "Build with external redis-plus-plus library rather than the submodule one" ON)
option(USE_EXTERNAL_HIREDIS_LIBS "Build with external hiredis library rather than the submodule one" ON)
option(USE_EXTERNAL_METASERVICE_LIBS "Use external MetaService libraries" OFF)
option(VINEYARD_USE_ASAN "Using address sanitizer to check memory accessing" OFF)
option(VINEYARD_USE_LTO "Using IPO/LTO support for link-time optimization" OFF)
option(USE_LIBUNWIND "Using libunwind to retrieve the stack backtrace when exception occurs" ON)
option(USE_INCLUDE_WHAT_YOU_USE "Simply the intra-module dependencies with iwyu" OFF)
option(USE_JSON_DIAGNOSTICS "Using json diagnostics to check the validity of metadata" OFF)
option(USE_CUDA "Enabling GPU (CUDA) support" OFF)
option(ENABLE_VINEYARD_MONITOR "Enable vineyard monitor" OFF)

option(BUILD_VINEYARD_SERVER "Build vineyard's server" ON)
option(BUILD_VINEYARD_SERVER_REDIS "Enable redis as the metadata backend" OFF)
Expand Down Expand Up @@ -70,6 +73,9 @@ option(BUILD_VINEYARD_BENCHMARKS "Generate make targets for vineyard benchmarks"
option(BUILD_VINEYARD_BENCHMARKS_ALL "Include make targets for vineyard benchmarks to ALL" OFF)
option(BUILD_VINEYARD_COVERAGE "Build vineyard with coverage information, requires build with Debug" OFF)
option(BUILD_VINEYARD_PROFILING "Build vineyard with profiling information" OFF)
option(BUILD_ENV_RUNC "Build vineyard in runc env" OFF)
option(BUILD_FABRIC_RDMA "Build vineyard fabric with RDMA support" OFF)
option(BUILD_VLLM_CACHE "Build vineyard with vllm cache support" OFF)

include(CheckCXXCompilerFlag)
include(CheckLibraryExists)
Expand Down Expand Up @@ -493,6 +499,7 @@ endmacro()
macro(find_cuda)
# find cuda runtime library
set(CUDA_USE_STATIC_CUDA_RUNTIME ON)
enable_language(CUDA)
find_package(CUDA REQUIRED)
endmacro(find_cuda)

Expand Down Expand Up @@ -675,7 +682,7 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
endif()
set(FABRIC_MAKEFILE "${CMAKE_SOURCE_DIR}/thirdparty/libfabric/Makefile")

if(IBVERBS_LIB AND RDMACM_LIB)
if(BUILD_FABRIC_RDMA AND IBVERBS_LIB AND RDMACM_LIB)
set(RDMA_LIBS ${RDMACM_LIB} ${IBVERBS_LIB} ${RT_LIB})

add_custom_command(
Expand All @@ -696,6 +703,8 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
--disable-perf
--disable-efa
--disable-mrail
--disable-uffd-monitor
--with-cuda=no
--enable-verbs > /dev/null
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/thirdparty/libfabric
)
Expand All @@ -719,6 +728,8 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
--disable-perf
--disable-efa
--disable-mrail
--with-cuda=no
--disable-uffd-monitor
--disable-verbs > /dev/null
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/thirdparty/libfabric
)
Expand Down Expand Up @@ -751,11 +762,23 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/libfabric.a)
endif()

if (BUILD_VINEYARD_TESTS)
include("cmake/FindGTest.cmake")
endif()

# boost is only required by some components
if(BUILD_VINEYARD_SERVER OR BUILD_VINEYARD_IO OR BUILD_VINEYARD_GRAPH)
find_boost()
endif()

if(BUILD_VINEYARD_LLM_CACHE)
find_gflags()
endif()

if (ENABLE_VINEYARD_MONITOR)
add_definitions(-DENABLE_VINEYARD_MONITOR)
endif()

# build vineyardd
if(BUILD_VINEYARD_SERVER)
find_gflags()
Expand Down Expand Up @@ -844,8 +867,13 @@ if(BUILD_VINEYARD_SERVER)
install_vineyard_target(vineyardd)
if(NOT BUILD_SHARED_LIBS)
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND NOT CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
target_compile_options(vineyardd PRIVATE -static-libgcc -static-libstdc++ -Os)
target_add_link_options(vineyardd PRIVATE OPTIONS -static-libgcc -static-libstdc++ -Os)
if (LINK_STATIC_LIBC)
target_compile_options(vineyardd PRIVATE -static-libgcc -static-libstdc++ -Os)
target_add_link_options(vineyardd PRIVATE OPTIONS -static-libgcc -static-libstdc++ -Os)
else()
target_compile_options(vineyardd PRIVATE -Os)
target_add_link_options(vineyardd PRIVATE OPTIONS -Os)
endif()
endif()
target_link_libraries(vineyardd PRIVATE ${GRPC_GRPC++_LIBRARY} ${GRPC_LIBRARY} ${GPR_LIBRARY})
endif()
Expand Down Expand Up @@ -1072,6 +1100,11 @@ if(BUILD_VINEYARD_LLM_CACHE)
list(APPEND VINEYARD_INSTALL_LIBS vineyard_llm_cache)
endif()

if(BUILD_VLLM_CACHE)
include("cmake/FindAIO.cmake")
add_subdirectory(modules/vllm-kv-cache)
endif()

if(BUILD_VINEYARD_TESTS)
add_subdirectory(test)
endif()
Expand Down
34 changes: 34 additions & 0 deletions cmake/FindAIO.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# FindAIO.cmake

# Try to find the AIO library
# Define the following cached variables:
# AIO_FOUND - Was AIO found?
# AIO_INCLUDE_DIRS - Where to find the AIO includes
# AIO_LIBRARIES - The libraries needed to use AIO

set(AIO_HOME $ENV{AIO_HOME})

find_path (AIO_INCLUDE_DIRS
NAMES libaio.h
PATHS ${AIO_HOME}/include /usr/local/include /usr/include
)

find_library (AIO_LIBRARIES
NAMES aio
PATHS ${AIO_HOME}/lib /usr/local/lib /usr/lib/x86_64-linux-gnu
)

include (FindPackageHandleStandardArgs)
find_package_handle_standard_args(AIO DEFAULT_MSG
AIO_INCLUDE_DIRS AIO_LIBRARIES)

if (AIO_FOUND)
add_library(AIO::aio SHARED IMPORTED)
set_target_properties(AIO::aio PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${AIO_INCLUDE_DIRS}"
IMPORTED_LOCATION "${AIO_LIBRARIES}"
INTERFACE_COMPILE_DEFINITIONS "CMAKE_INCLUDE"
)
endif()

mark_as_advanced(AIO_INCLUDE_DIRS AIO_LIBRARIES)
8 changes: 5 additions & 3 deletions cmake/FindGFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@

include(FindPackageHandleStandardArgs)

set(GFLAGS_ROOT_DIR "" CACHE PATH "Folder contains Gflags")
set(GFLAGS_ROOT_DIR $ENV{GFLAGS_ROOT_DIR} CACHE PATH "Folder contains Gflags")

# We are testing only a couple of files in the include directories
if(WIN32)
find_path(GFLAGS_INCLUDE_DIR gflags/gflags.h
PATHS ${GFLAGS_ROOT_DIR}/src/windows)
else()
find_path(GFLAGS_INCLUDE_DIR gflags/gflags.h
PATHS ${GFLAGS_ROOT_DIR})
HINTS ${GFLAGS_ROOT_DIR}/include)
endif()

if(MSVC)
Expand All @@ -42,7 +42,9 @@ if(MSVC)

set(GFLAGS_LIBRARY optimized ${GFLAGS_LIBRARY_RELEASE} debug ${GFLAGS_LIBRARY_DEBUG})
else()
find_library(GFLAGS_LIBRARY gflags)
find_library(GFLAGS_LIBRARY gflags
HINTS ${GFLAGS_ROOT_DIR}
PATH_SUFFIXES lib)
endif()

find_package_handle_standard_args(GFlags DEFAULT_MSG GFLAGS_INCLUDE_DIR GFLAGS_LIBRARY)
Expand Down
40 changes: 40 additions & 0 deletions cmake/FindGTest.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# FindGTest.cmake

# Try to find the GTest library
# Define the following cached variables:
# GTest_FOUND - Was GTest found?
# GTest_INCLUDE_DIRS - Where to find the GTest includes
# GTest_LIBRARIES - The libraries needed to use GTest

set(GTEST_HOME $ENV{GTEST_HOME})

find_path (GTEST_INCLUDE_DIRS
NAMES gtest/gtest.h
PATHS ${GTEST_HOME}/include /usr/local/include /usr/include
)

find_library (GTEST_LIBRARIES
NAMES gtest gtest_main
PATHS ${GTEST_HOME}/lib /usr/local/lib /usr/lib
)

include (FindPackageHandleStandardArgs)
find_package_handle_standard_args(GTEST DEFAULT_MSG
GTEST_INCLUDE_DIRS GTEST_LIBRARIES)

message("GTest include dirs: ${GTEST_INCLUDE_DIRS} GTest libraries: ${GTEST_LIBRARIES}")

if (GTEST_FOUND)
add_library(GTEST::gtest SHARED IMPORTED)
set_target_properties(GTEST::gtest PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${GTEST_INCLUDE_DIRS}"
IMPORTED_LOCATION "${GTEST_LIBRARIES}"
INTERFACE_COMPILE_DEFINITIONS "CMAKE_INCLUDE"
)
else()
message(WARNING "GTest not found.")
set(GTEST_INCLUDE_DIRS "")
set(GTEST_LIBRARIES "")
endif()

mark_as_advanced(GTEST_INCLUDE_DIRS GTEST_LIBRARIES)
8 changes: 5 additions & 3 deletions cmake/FindGlog.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@

include(FindPackageHandleStandardArgs)

set(GLOG_ROOT_DIR "" CACHE PATH "Folder contains Google glog")
set(GLOG_ROOT_DIR $ENV{GLOG_ROOT_DIR} CACHE PATH "Folder contains Google glog")

if(WIN32)
find_path(GLOG_INCLUDE_DIR glog/logging.h
PATHS ${GLOG_ROOT_DIR}/src/windows)
else()
find_path(GLOG_INCLUDE_DIR glog/logging.h
PATHS ${GLOG_ROOT_DIR})
HINTS ${GLOG_ROOT_DIR}/include)
endif()

if(MSVC)
Expand All @@ -40,10 +40,12 @@ if(MSVC)
set(GLOG_LIBRARY optimized ${GLOG_LIBRARY_RELEASE} debug ${GLOG_LIBRARY_DEBUG})
else()
find_library(GLOG_LIBRARY glog
PATHS ${GLOG_ROOT_DIR}
HINTS ${GLOG_ROOT_DIR}
PATH_SUFFIXES lib lib64)
endif()

message("GLOG_ROOT_DIR: ${GLOG_ROOT_DIR}, GLOG_INCLUDE_DIR: ${GLOG_INCLUDE_DIR}, GLOG_LIBRARY: ${GLOG_LIBRARY}")

find_package_handle_standard_args(Glog DEFAULT_MSG GLOG_INCLUDE_DIR GLOG_LIBRARY)

if(GLOG_FOUND)
Expand Down
68 changes: 49 additions & 19 deletions cmake/FindLibUnwind.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,32 @@
# LIBUNWIND_LIBRARIES - The libraries needed to use libunwind
# LIBUNWIND_INCLUDE_DIR - Location of unwind.h and libunwind.h

FIND_PATH(LIBUNWIND_INCLUDE_DIR libunwind.h)
if(NOT LIBUNWIND_INCLUDE_DIR)
message(STATUS "failed to find libunwind.h")
elseif(NOT EXISTS "${LIBUNWIND_INCLUDE_DIR}/unwind.h")
message(STATUS "libunwind.h was found, but unwind.h was not found in that directory.")
SET(LIBUNWIND_INCLUDE_DIR "")
endif()
set(UNWIND_HOME $ENV{UNWIND_HOME})

if (UNWIND_HOME)
find_path (LIBUNWIND_INCLUDE_DIR
NAMES libunwind.h
PATHS ${UNWIND_HOME}/include
)
find_library (LIBUNWIND_LIBRARIES
NAMES unwind
PATHS ${UNWIND_HOME}/lib
)
else()
FIND_PATH(LIBUNWIND_INCLUDE_DIR libunwind.h)
if(NOT LIBUNWIND_INCLUDE_DIR)
message(STATUS "failed to find libunwind.h")
elseif(NOT EXISTS "${LIBUNWIND_INCLUDE_DIR}/unwind.h")
message(STATUS "libunwind.h was found, but unwind.h was not found in that directory.")
SET(LIBUNWIND_INCLUDE_DIR "")
endif()

FIND_LIBRARY(LIBUNWIND_GENERIC_LIBRARY "unwind")
if(NOT LIBUNWIND_GENERIC_LIBRARY)
MESSAGE(STATUS "failed to find unwind generic library")
FIND_LIBRARY(LIBUNWIND_GENERIC_LIBRARY "unwind")
if(NOT LIBUNWIND_GENERIC_LIBRARY)
MESSAGE(STATUS "failed to find unwind generic library")
endif()
SET(LIBUNWIND_LIBRARIES ${LIBUNWIND_GENERIC_LIBRARY})
endif()
SET(LIBUNWIND_LIBRARIES ${LIBUNWIND_GENERIC_LIBRARY})

# For some reason, we have to link to two libunwind shared object files:
# one arch-specific and one not.
Expand All @@ -41,15 +54,32 @@ elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "^i.86$")
endif()

if(LIBUNWIND_ARCH)
FIND_LIBRARY(LIBUNWIND_SPECIFIC_LIBRARY "unwind-${LIBUNWIND_ARCH}")
if(NOT LIBUNWIND_SPECIFIC_LIBRARY)
MESSAGE(STATUS "failed to find unwind-${LIBUNWIND_ARCH}")
endif()
if(LIBUNWIND_SPECIFIC_LIBRARY)
SET(LIBUNWIND_LIBRARIES ${LIBUNWIND_LIBRARIES} ${LIBUNWIND_SPECIFIC_LIBRARY})
if (UNWIND_HOME)
find_library (LIBUNWIND_SPECIFIC_LIBRARY
NAMES unwind-${LIBUNWIND_ARCH}
PATHS ${UNWIND_HOME}/lib
)
if (NOT LIBUNWIND_SPECIFIC_LIBRARY)
message(STATUS "failed to find unwind-${LIBUNWIND_ARCH}")
endif()
if (LIBUNWIND_SPECIFIC_LIBRARY)
SET(LIBUNWIND_LIBRARIES ${LIBUNWIND_LIBRARIES} ${LIBUNWIND_SPECIFIC_LIBRARY})
else()
if(APPLE)
SET(LIBUNWIND_LIBRARIES ${LIBUNWIND_LIBRARIES})
endif()
endif()
else()
if(APPLE)
SET(LIBUNWIND_LIBRARIES ${LIBUNWIND_LIBRARIES})
FIND_LIBRARY(LIBUNWIND_SPECIFIC_LIBRARY "unwind-${LIBUNWIND_ARCH}")
if(NOT LIBUNWIND_SPECIFIC_LIBRARY)
MESSAGE(STATUS "failed to find unwind-${LIBUNWIND_ARCH}")
endif()
if(LIBUNWIND_SPECIFIC_LIBRARY)
SET(LIBUNWIND_LIBRARIES ${LIBUNWIND_LIBRARIES} ${LIBUNWIND_SPECIFIC_LIBRARY})
else()
if(APPLE)
SET(LIBUNWIND_LIBRARIES ${LIBUNWIND_LIBRARIES})
endif()
endif()
endif()
endif(LIBUNWIND_ARCH)
Expand Down
Loading
Loading