Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature] add dep version variables #934

Merged
merged 1 commit into from
May 16, 2024
Merged
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
7 changes: 5 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ if(PPLNN_USE_LLM_CUDA)
if(NOT CMAKE_CUDA_STANDARD)
set(CMAKE_CUDA_STANDARD 17)
endif()
if(NOT PPLNN_PROTOBUF_VERSION)
set(PPLNN_PROTOBUF_VERSION "v23.4")
if(NOT PPLNN_DEP_PROTOBUF_VERSION)
set(PPLNN_DEP_PROTOBUF_VERSION "v23.4")
endif()
set(PPLCOMMON_USE_CUDA ON)
endif()
Expand All @@ -59,6 +59,9 @@ endif()
if(PPLNN_ENABLE_SANITIZE_OPTIONS)
message(FATAL_ERROR "`PPLNN_ENABLE_SANITIZE_OPTIONS` is deprecated. use `HPCC_ENABLE_SANITIZE_OPTIONS` instead.")
endif()
if(PPLNN_PROTOBUF_VERSION)
message(FATAL_ERROR "`PPLNN_PROTOBUF_VERSION` is deprecated. use `PPLNN_DEP_PROTOBUF_VERSION` instead.")
endif()

# --------------------------------------------------------------------------- #

Expand Down
50 changes: 25 additions & 25 deletions cmake/deps.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ if(NOT Git_FOUND)
message(FATAL_ERROR "git is required.")
endif()

set(__HPCC_COMMIT__ master)
if(NOT PPLNN_DEP_HPCC_VERSION)
set(PPLNN_DEP_HPCC_VERSION master)
endif()

if(PPLNN_DEP_HPCC_PKG)
FetchContent_Declare(hpcc
Expand All @@ -65,15 +67,12 @@ else()
endif()
FetchContent_Declare(hpcc
GIT_REPOSITORY ${PPLNN_DEP_HPCC_GIT}
GIT_TAG ${__HPCC_COMMIT__}
GIT_SHALLOW TRUE
GIT_TAG ${PPLNN_DEP_HPCC_VERSION}
SOURCE_DIR ${HPCC_DEPS_DIR}/hpcc
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/hpcc-build
SUBBUILD_DIR ${HPCC_DEPS_DIR}/hpcc-subbuild)
endif()

unset(__HPCC_COMMIT__)

FetchContent_GetProperties(hpcc)
if(NOT hpcc_POPULATED)
FetchContent_Populate(hpcc)
Expand Down Expand Up @@ -105,7 +104,9 @@ if(PPLNN_CUDA_ENABLE_NCCL)
set(PPLCOMMON_ENABLE_NCCL ON)
endif()

set(__PPLCOMMON_COMMIT__ master)
if(NOT PPLNN_DEP_PPLCOMMON_VERSION)
set(PPLNN_DEP_PPLCOMMON_VERSION master)
endif()

if(PPLNN_DEP_PPLCOMMON_PKG)
hpcc_declare_pkg_dep(pplcommon
Expand All @@ -116,11 +117,9 @@ else()
endif()
hpcc_declare_git_dep(pplcommon
${PPLNN_DEP_PPLCOMMON_GIT}
${__PPLCOMMON_COMMIT__})
${PPLNN_DEP_PPLCOMMON_VERSION})
endif()

unset(__PPLCOMMON_COMMIT__)

# --------------------------------------------------------------------------- #

set(FLATBUFFERS_BUILD_TESTS OFF CACHE BOOL "disable tests")
Expand Down Expand Up @@ -158,10 +157,8 @@ if(MSVC)
endif()
endif()

if(PPLNN_PROTOBUF_VERSION)
set(__PROTOBUF_TAG__ ${PPLNN_PROTOBUF_VERSION})
else()
set(__PROTOBUF_TAG__ v3.1.0)
if(NOT PPLNN_DEP_PROTOBUF_VERSION)
set(PPLNN_DEP_PROTOBUF_VERSION v3.1.0)
endif()

if(PPLNN_DEP_PROTOBUF_PKG)
Expand All @@ -171,16 +168,11 @@ else()
if(NOT PPLNN_DEP_PROTOBUF_GIT)
set(PPLNN_DEP_PROTOBUF_GIT "https://github.com/protocolbuffers/protobuf.git")
endif()
if(PPLNN_PROTOBUF_VERSION)
set(__PROTOBUF_TAG__ ${PPLNN_PROTOBUF_VERSION})
endif()
hpcc_declare_git_dep_depth1(protobuf
${PPLNN_DEP_PROTOBUF_GIT}
${__PROTOBUF_TAG__})
${PPLNN_DEP_PROTOBUF_VERSION})
endif()

unset(__PROTOBUF_TAG__)

# --------------------------------------------------------------------------- #

set(RAPIDJSON_BUILD_TESTS OFF CACHE BOOL "disable rapidjson tests")
Expand Down Expand Up @@ -252,6 +244,10 @@ unset(__GOOGLETEST_TAG__)
# --------------------------------------------------------------------------- #

if(PPLNN_USE_X86_64 OR PPLNN_USE_AARCH64 OR PPLNN_USE_ARMV7 OR PPLNN_USE_RISCV64)
if(NOT PPLNN_DEP_PPLCPUKERNEL_VERSION)
set(PPLNN_DEP_PPLCPUKERNEL_VERSION master)
endif()

if(PPLNN_DEP_PPLCPUKERNEL_PKG)
hpcc_declare_pkg_dep(ppl.kernel.cpu
${PPLNN_DEP_PPLCPUKERNEL_PKG})
Expand All @@ -261,13 +257,17 @@ if(PPLNN_USE_X86_64 OR PPLNN_USE_AARCH64 OR PPLNN_USE_ARMV7 OR PPLNN_USE_RISCV64
endif()
hpcc_declare_git_dep_depth1(ppl.kernel.cpu
${PPLNN_DEP_PPLCPUKERNEL_GIT}
master)
${PPLNN_DEP_PPLCPUKERNEL_VERSION})
endif()
endif()

# --------------------------------------------------------------------------- #

if(PPLNN_USE_CUDA)
if(NOT PPLNN_DEP_PPLCUDAKERNEL_VERSION)
set(PPLNN_DEP_PPLCUDAKERNEL_VERSION master)
endif()

if(PPLNN_DEP_PPLCUDAKERNEL_PKG)
hpcc_declare_pkg_dep(ppl.kernel.cuda
${PPLNN_DEP_PPLCUDAKERNEL_PKG})
Expand All @@ -277,13 +277,15 @@ if(PPLNN_USE_CUDA)
endif()
hpcc_declare_git_dep_depth1(ppl.kernel.cuda
${PPLNN_DEP_PPLCUDAKERNEL_GIT}
master)
${PPLNN_DEP_PPLCUDAKERNEL_VERSION})
endif()
endif()

# --------------------------------------------------------------------------- #

set(__LLM_KERNEL_CUDA_COMMIT__ master)
if(NOT PPLNN_DEP_PPL_LLM_KERNEL_CUDA_VERSION)
set(PPLNN_DEP_PPL_LLM_KERNEL_CUDA_VERSION master)
endif()

if(PPLNN_DEP_PPL_LLM_KERNEL_CUDA_PKG)
hpcc_declare_pkg_dep(ppl.llm.kernel.cuda
Expand All @@ -294,7 +296,5 @@ else()
endif()
hpcc_declare_git_dep_depth1(ppl.llm.kernel.cuda
${PPLNN_DEP_PPL_LLM_KERNEL_CUDA_GIT}
${__LLM_KERNEL_CUDA_COMMIT__})
${PPLNN_DEP_PPL_LLM_KERNEL_CUDA_VERSION})
endif()

unset(__LLM_KERNEL_CUDA_COMMIT__)
4 changes: 2 additions & 2 deletions cmake/onnx_model.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ if(NOT TARGET libprotobuf)
endif()

if(NOT PPLNN_ONNX_GENERATED_LIBS)
if(PPLNN_PROTOBUF_VERSION)
if(PPLNN_DEP_PROTOBUF_VERSION)
if(CMAKE_CROSSCOMPILING)
message(FATAL_ERROR "`PPLNN_PROTOBUF_VERSION` is set to be [${PPLNN_PROTOBUF_VERSION}], but `PPLNN_ONNX_GENERATED_LIBS` is not set.")
message(FATAL_ERROR "`PPLNN_DEP_PROTOBUF_VERSION` is set to be [${PPLNN_DEP_PROTOBUF_VERSION}], but `PPLNN_ONNX_GENERATED_LIBS` is not set.")
else() # use protoc to generate *.pb.*
if(NOT PPLNN_PROTOC_EXECUTABLE)
set(PPLNN_PROTOC_EXECUTABLE ${protobuf_BINARY_DIR}/protoc)
Expand Down
Loading