-
Notifications
You must be signed in to change notification settings - Fork 9
Tcp End #99
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
Open
SHshenhao
wants to merge
10
commits into
main
Choose a base branch
from
tcp-v4
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Tcp End #99
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
13bafc0
add TcpEndpoint v3: asio-based TCP transport with async primitives
4211aca
clean up TcpEndpoint API: remove dead void* stream and unused timeout_ms
3fea51d
refine TcpEndpoint: ip constructor, remove offset, cleanup pool
2f3e1f0
simplify ServerSession and enforce MR name constraint
f4b384a
add ClientSession and refactor endpoint I/O to session-driven model
5a68128
remove_mrpool_in_sendrecv_and_update_connext
1dd6b35
add CUDA staging, remove is_initiator, decouple send/recv from MR
1dce4ab
update
a4f3d3f
async_read_async_write_support_vectorN
ab6e815
updatetest_addcudasupport_addbatchreadwritesuport
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,3 +34,7 @@ endif() | |
| if (BUILD_RDMA) | ||
| add_subdirectory(rdma) | ||
| endif() | ||
|
|
||
| if (BUILD_TCP) | ||
| add_subdirectory(tcp) | ||
| endif() | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| # asio is header-only. Try find_package, fall back to manual detection. | ||
| find_package(asio QUIET) | ||
| if(NOT asio_FOUND) | ||
| if(EXISTS /usr/include/asio.hpp) | ||
| add_library(asio::asio INTERFACE IMPORTED) | ||
| target_include_directories(asio::asio INTERFACE /usr/include) | ||
| elseif(EXISTS /usr/include/boost/asio.hpp) | ||
| add_library(asio::asio INTERFACE IMPORTED) | ||
| target_include_directories(asio::asio INTERFACE /usr/include/boost) | ||
| target_compile_definitions(asio::asio INTERFACE ASIO_STANDALONE) | ||
| else() | ||
| message(FATAL_ERROR "asio not found. Install libasio-dev or boost.") | ||
| endif() | ||
| endif() | ||
|
|
||
| add_library(_slime_tcp SHARED | ||
| tcp_memory_pool.cpp | ||
| tcp_connection_pool.cpp | ||
| tcp_context.cpp | ||
| tcp_session.cpp | ||
| tcp_endpoint.cpp | ||
| ) | ||
|
|
||
| target_compile_definitions(_slime_tcp PRIVATE ASIO_STANDALONE) | ||
|
|
||
| if (USE_CUDA) | ||
| find_package(CUDAToolkit REQUIRED) | ||
| target_compile_definitions(_slime_tcp PRIVATE USE_CUDA) | ||
| target_include_directories(_slime_tcp PRIVATE ${CUDAToolkit_INCLUDE_DIRS}) | ||
| target_link_libraries(_slime_tcp PUBLIC CUDA::cudart) | ||
| endif() | ||
|
|
||
| target_link_libraries(_slime_tcp PUBLIC | ||
| asio::asio | ||
| _slime_device | ||
| _slime_engine | ||
| ) | ||
|
|
||
| set_target_properties(_slime_tcp PROPERTIES | ||
| BUILD_WITH_INSTALL_RPATH TRUE | ||
| INSTALL_RPATH "${ORIGIN}" | ||
| ) | ||
|
|
||
| install(TARGETS _slime_tcp | ||
| EXPORT dlslimeTargets | ||
| LIBRARY DESTINATION ${DLSLIME_INSTALL_PATH} | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" | ||
| REPO_ROOT="$(cd "$SCRIPT_DIR/../../../.." && pwd)" | ||
| BUILD_DIR="$REPO_ROOT/build_tcp" | ||
| MODE="${1:-all}" | ||
|
|
||
| # Optional: USE_CUDA=ON ./build_and_test.sh all | ||
| USE_CUDA="${USE_CUDA:-OFF}" | ||
|
|
||
| header() { echo; echo -e "\033[1;36m==>\033[m \033[1m$*\033[m"; } | ||
| ok() { echo -e " \033[1;32mOK\033[m $*"; } | ||
|
|
||
| do_build() { | ||
| rm -rf ${BUILD_DIR} | ||
| local cuda_label="" | ||
| [[ "$USE_CUDA" == "ON" ]] && cuda_label=" + USE_CUDA=ON" | ||
|
|
||
| header "Configuring (BUILD_TCP=ON, BUILD_RDMA=OFF${cuda_label})" | ||
| cmake -S "$REPO_ROOT" -B "$BUILD_DIR" -G Ninja \ | ||
| -DCMAKE_BUILD_TYPE=Release \ | ||
| -DDLSLIME_INSTALL_PATH=dlslime \ | ||
| -DBUILD_PYTHON=ON \ | ||
| -DBUILD_RDMA=OFF \ | ||
| -DBUILD_TCP=ON \ | ||
| -DBUILD_NVLINK=OFF \ | ||
| -DBUILD_ASCEND_DIRECT=OFF \ | ||
| -DUSE_CUDA="$USE_CUDA" \ | ||
| -DSKBUILD_PROJECT_NAME=dlslime 2>&1 | tail -3 | ||
| ok "CMake configure" | ||
|
|
||
| header "Building _slime_c" | ||
| cmake --build "$BUILD_DIR" --target _slime_c -j"$(nproc)" 2>&1 | tail -8 | ||
| ok "Build complete" | ||
|
|
||
| cp "$BUILD_DIR/lib/"*.so "$REPO_ROOT/dlslime/" | ||
| ok "Copied .so files to dlslime/" | ||
| } | ||
|
|
||
| do_test() { | ||
| header "Running TcpEndpoint tests" | ||
| export SLIME_LOG_LEVEL=1 | ||
| export LD_LIBRARY_PATH="$REPO_ROOT/dlslime" | ||
| export PYTHONPATH="$REPO_ROOT" | ||
| python3 "$SCRIPT_DIR/test_tcp_endpoint.py" 2>&1 | while IFS= read -r line; do | ||
| if [[ "$line" == *"PASSED"* ]]; then echo -e " \033[1;32m✓\033[m $line" | ||
| elif [[ "$line" == *"SKIP"* ]]; then echo -e " \033[1;33m⊘\033[m $line" | ||
| elif [[ "$line" == *"FAIL"* ]]; then echo -e " \033[1;91m✗\033[m $line" | ||
| else echo " $line" | ||
| fi | ||
| done | ||
| echo " tests done " | ||
| } | ||
|
|
||
| case "$MODE" in | ||
| all) do_build; do_test ;; | ||
| build) do_build ;; | ||
| test) do_test ;; | ||
| clean) rm -rf "$BUILD_DIR" "$REPO_ROOT/dlslime/_slime_c"*.so "$REPO_ROOT/dlslime/lib_slime_"*.so | ||
| ok "Cleaned" ;; | ||
| *) echo "Usage: $0 {all|build|test|clean}" >&2 | ||
| echo " USE_CUDA=ON $0 all # build + test with CUDA" >&2 | ||
| exit 1 ;; | ||
| esac |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can use cmake or pip directly.