91fef95362
* rpc : refactor the RPC transport Move all transport related code into a separate file and use the socket_t interface to hide all transport implementation details. * fix win32 * better socket_t construction
34 lines
1009 B
CMake
34 lines
1009 B
CMake
message(STATUS "Using RPC backend")
|
|
|
|
ggml_add_backend_library(ggml-rpc
|
|
ggml-rpc.cpp
|
|
transport.cpp
|
|
)
|
|
|
|
if (WIN32)
|
|
target_link_libraries(ggml-rpc PRIVATE ws2_32)
|
|
endif()
|
|
|
|
# RDMA auto-detection (Linux only, requires libibverbs)
|
|
if (NOT WIN32 AND NOT APPLE)
|
|
find_library(IBVERBS_LIB ibverbs)
|
|
if (IBVERBS_LIB)
|
|
option(GGML_RPC_RDMA "ggml: enable RDMA transport for RPC" ON)
|
|
else()
|
|
option(GGML_RPC_RDMA "ggml: enable RDMA transport for RPC" OFF)
|
|
endif()
|
|
else()
|
|
set(GGML_RPC_RDMA OFF CACHE BOOL "RDMA not available on this platform" FORCE)
|
|
endif()
|
|
|
|
if (GGML_RPC_RDMA)
|
|
if (NOT IBVERBS_LIB)
|
|
find_library(IBVERBS_LIB ibverbs REQUIRED)
|
|
endif()
|
|
target_compile_definitions(ggml-rpc PRIVATE GGML_RPC_RDMA)
|
|
target_link_libraries(ggml-rpc PRIVATE ${IBVERBS_LIB})
|
|
message(STATUS " RDMA transport enabled (auto-detected)")
|
|
else()
|
|
message(STATUS " RDMA transport disabled")
|
|
endif()
|