interplane.Get Omega
Read in your language

ggml

[Ported from github.com/ggml-org/ggml] docs : sync ggml_type enum in gguf.md (#1685)

Brought by drakestapleton

branch master Branches Tags History

ggml / src / ggml-rpc / CMakeLists.txt

52 lines · 1855 bytes Raw Blame History
1message(STATUS "Using RPC backend")
2
3ggml_add_backend_library(ggml-rpc
4 ggml-rpc.cpp
5 log.cpp
6 transport.cpp
7 )
8
9if (WIN32)
10 target_link_libraries(ggml-rpc PRIVATE ws2_32)
11endif()
12
13# RDMA auto-detection: Linux RoCE/IB via libibverbs, Apple RDMA-over-Thunderbolt via librdma
14if (APPLE)
15 set(RDMA_LIB_NAME rdma)
16 set(RDMA_DESC "Apple RDMA-over-Thunderbolt, UC")
17elseif (NOT WIN32)
18 set(RDMA_LIB_NAME ibverbs)
19 set(RDMA_DESC "auto-detected")
20endif()
21
22if (RDMA_LIB_NAME)
23 find_library(RDMA_LIB ${RDMA_LIB_NAME})
24 if (RDMA_LIB)
25 option(GGML_RPC_RDMA "ggml: enable RDMA transport for RPC" ON)
26 else()
27 option(GGML_RPC_RDMA "ggml: enable RDMA transport for RPC" OFF)
28 endif()
29else()
30 set(GGML_RPC_RDMA OFF CACHE BOOL "RDMA not available on this platform" FORCE)
31endif()
32
33if (GGML_RPC_RDMA)
34 if (NOT RDMA_LIB)
35 find_library(RDMA_LIB ${RDMA_LIB_NAME} REQUIRED)
36 endif()
37 target_compile_definitions(ggml-rpc PRIVATE GGML_RPC_RDMA)
38 if (APPLE)
39 # librdma.dylib only exists on macOS 26.2 and later. Link it weakly so a build made
40 # where it exists still loads where it does not; checked at runtime before use
41 # but with BUILD_SHARED_LIBS=OFF ggml-rpc is a static archive and never links
42 # so the librdma symbols used by transport-apple.cpp stay undefined.
43 target_link_options(ggml-rpc PUBLIC "LINKER:-weak_library,${RDMA_LIB}")
44 target_compile_definitions(ggml-rpc PRIVATE GGML_RPC_RDMA_APPLE)
45 target_sources(ggml-rpc PRIVATE transport-apple.cpp)
46 else()
47 target_link_libraries(ggml-rpc PRIVATE ${RDMA_LIB})
48 endif()
49 message(STATUS " RDMA transport enabled (${RDMA_DESC})")
50else()
51 message(STATUS " RDMA transport disabled")
52endif()