From e3230a6ff5e748358d5ad83ae444d89b599d1390 Mon Sep 17 00:00:00 2001 From: Duyi-Wang Date: Thu, 21 Aug 2025 15:38:26 +0800 Subject: [PATCH 1/3] Move msgpack from submodule to cmake. --- .gitmodules | 4 ---- CMakeLists.txt | 10 +++++++++ cmake/msgpack-c.cmake | 50 +++++++++++++++++++++++++++++++++++++++++++ src/io/CMakeLists.txt | 13 ++++++----- 4 files changed, 68 insertions(+), 9 deletions(-) delete mode 100644 .gitmodules create mode 100644 cmake/msgpack-c.cmake diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 0ddd1bb3..00000000 --- a/.gitmodules +++ /dev/null @@ -1,4 +0,0 @@ -[submodule "3rdparty/msgpack-c"] - path = 3rdparty/msgpack-c - url = https://github.com/msgpack/msgpack-c.git - branch = cpp_master diff --git a/CMakeLists.txt b/CMakeLists.txt index c47691cd..c6816e7d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,6 +22,16 @@ endif() message(STATUS "WARP_ACCUM_UNROLL is set to: ${WARP_ACCUM_UNROLL}") add_definitions(-DWARP_ACCUM_UNROLL=${WARP_ACCUM_UNROLL}) +include("cmake/msgpack-c.cmake") + +# Create an interface library to represent msgpack-c dependency +add_library(msgpack-c-interface INTERFACE) +target_include_directories( + msgpack-c-interface INTERFACE ${CMAKE_SOURCE_DIR}/3rdparty/msgpack-c/include) +target_compile_definitions(msgpack-c-interface INTERFACE MSGPACK_NO_BOOST) +# Make sure msgpack-c is downloaded before using the interface +add_dependencies(msgpack-c-interface msgpack-c) + if(USE_ROCM) list(APPEND CMAKE_PREFIX_PATH "/opt/rocm") project(mori LANGUAGES HIP CXX C) diff --git a/cmake/msgpack-c.cmake b/cmake/msgpack-c.cmake new file mode 100644 index 00000000..2d684f89 --- /dev/null +++ b/cmake/msgpack-c.cmake @@ -0,0 +1,50 @@ +# Copyright © Advanced Micro Devices, Inc. All rights reserved. + +# MIT License + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +cmake_minimum_required(VERSION 3.18) + +# Avoid warning about DOWNLOAD_EXTRACT_TIMESTAMP in CMake 3.24: +if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.24.0") + cmake_policy(SET CMP0135 NEW) +endif() + +project(dependency NONE) + +include(ExternalProject) + +set(MSGPACK_C_DIR "${CMAKE_SOURCE_DIR}/3rdparty/msgpack-c") + +# set(MSGPACK_C_TAG "origin/cpp_master") +set(MSGPACK_C_TAG "a0b2ec09da4bd823e40fa591221713951d4ec995") + +# cmake-format: off +ExternalProject_Add(msgpack-c + GIT_REPOSITORY https://github.com/msgpack/msgpack-c.git + GIT_TAG ${MSGPACK_C_TAG} + SOURCE_DIR ${MSGPACK_C_DIR} + BINARY_DIR "" + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" + TEST_COMMAND "" +) +# cmake-format: on diff --git a/src/io/CMakeLists.txt b/src/io/CMakeLists.txt index b549e70f..4ccbeccd 100644 --- a/src/io/CMakeLists.txt +++ b/src/io/CMakeLists.txt @@ -3,8 +3,11 @@ add_library(mori_io SHARED engine.cpp rdma/protocol.cpp target_include_directories(mori_io PUBLIC ${CMAKE_SOURCE_DIR}/include) target_include_directories(mori_io PUBLIC ${CMAKE_SOURCE_DIR}) -target_include_directories( - mori_io PUBLIC ${CMAKE_SOURCE_DIR}/3rdparty/msgpack-c/include) -target_link_libraries(mori_io mori_application ibverbs mlx5 hip::host - hip::device) -target_compile_definitions(mori_io PUBLIC MSGPACK_NO_BOOST) +target_link_libraries( + mori_io + mori_application + ibverbs + mlx5 + hip::host + hip::device + msgpack-c-interface) From 4b249ebe2d046ec06902bdf6796face5555a4574 Mon Sep 17 00:00:00 2001 From: Duyi-Wang Date: Thu, 21 Aug 2025 15:41:04 +0800 Subject: [PATCH 2/3] rm submodule --- 3rdparty/msgpack-c | 1 - 1 file changed, 1 deletion(-) delete mode 160000 3rdparty/msgpack-c diff --git a/3rdparty/msgpack-c b/3rdparty/msgpack-c deleted file mode 160000 index 9b801f08..00000000 --- a/3rdparty/msgpack-c +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 9b801f087ab7434f2ab1ab3c0f48a966c19d3b70 From 8fb792e0928693a92510b445c8c57039805e15dd Mon Sep 17 00:00:00 2001 From: Duyi-Wang Date: Thu, 21 Aug 2025 15:48:36 +0800 Subject: [PATCH 3/3] update readme --- .gitignore | 2 ++ README.md | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index f1f42d46..be8943fb 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,5 @@ lib* __pycache__ .vscode + +3rdparty/msgpack-c/ diff --git a/README.md b/README.md index 2029e5ae..b17739ba 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,9 @@ cd mori && docker build -t rocm/mori:dev -f docker/Dockerfile.dev . ### Install with Python ``` -cd mori && pip install -r requirements-build.txt && git submodule update --init --recursive && pip3 install . +cd mori \ +&& pip install -r requirements-build.txt \ +&& pip3 install . ``` ### Test dispatch / combine