Skip to content

Commit

Permalink
support mqb and global
Browse files Browse the repository at this point in the history
  • Loading branch information
MjieYu committed Apr 7, 2024
1 parent 0c92727 commit ca26008
Show file tree
Hide file tree
Showing 15 changed files with 3,050 additions and 259 deletions.
23 changes: 20 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,18 @@ if (GGML_USE_CPU_HBM)
add_definitions(-DGGML_USE_CPU_HBM)
find_library(memkind memkind REQUIRED)
endif()
# 查找libibverbs库
find_library(IBVERBS_LIBRARY NAMES ibverbs PATHS /usr/lib /usr/lib64 /usr/lib/x86_64-linux-gnu)

# 确保找到了库
if(NOT IBVERBS_LIBRARY)
message(FATAL_ERROR "libibverbs not found")
endif()

# 在需要链接libibverbs的目标上使用找到的库路径
find_library(RDMACM_LIBRARY rdmacm HINTS /home/atr/local/lib)

link_libraries(pthread ${IBVERBS_LIBRARY} ${RDMACM_LIBRARY})
add_library(ggml OBJECT
ggml.c
ggml.h
Expand All @@ -664,6 +675,8 @@ add_library(ggml OBJECT
target_include_directories(ggml PUBLIC . ${LLAMA_EXTRA_INCLUDES})
target_compile_features(ggml PUBLIC c_std_11) # don't bump
target_link_libraries(ggml PUBLIC Threads::Threads ${LLAMA_EXTRA_LIBS})
target_link_libraries(ggml PUBLIC ${IBVERBS_LIBRARY})

if (GGML_USE_CPU_HBM)
target_link_libraries(ggml PUBLIC memkind)
endif()
Expand Down Expand Up @@ -697,7 +710,7 @@ target_include_directories(llama PUBLIC .)
target_compile_features(llama PUBLIC cxx_std_11) # don't bump
target_link_libraries(llama PRIVATE
ggml
rdma_common # for rdma_example 将rdma_example的头文件加入到llama中
# rdma_common # for rdma_example 将rdma_example的头文件加入到llama中
${LLAMA_EXTRA_LIBS}
)

Expand All @@ -710,6 +723,10 @@ if (BUILD_SHARED_LIBS)
endif()






#
# install
#
Expand Down Expand Up @@ -802,10 +819,10 @@ endif ()
if (LLAMA_BUILD_EXAMPLES)
add_subdirectory(examples)
add_subdirectory(pocs)
add_subdirectory(rdma-example)
# add_subdirectory(rdma-example)
endif()



target_include_directories(llama PUBLIC ${PROJECT_SOURCE_DIR}/rdma-example/src/)#将rdma_example的头文件加入到llama中
# target_include_directories(llama PUBLIC ${PROJECT_SOURCE_DIR}/rdma-example/src/)#将rdma_example的头文件加入到llama中

8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,16 @@ For the same reason, we suggest keeping the same directory structure as PowerInf

### server
```
./build/bin/main_server -m ./Falcon-40B/falcon-40b-relu.q4.powerinfer.gguf -n 128 -t 8 -p "Once upon a time"
./build/bin/main_server -m ./Falcon-40B/falcon-40b-relu.q4.powerinfer.gguf -n 128 -t 8 -p "Once upon a time" --no-mmap --seed 0 --temp 0
./build/bin/main_server -m ./ReluLLaMA-7B/llama-7b-relu.powerinfer.gguf -n 128 -t 8 -p "Once upon a time" --no-mmap
```

### client
```
./build/bin/main_client -m ./Falcon-40B/falcon-40b-relu.q4.powerinfer.gguf -n 128 -t 8 -p "Once upon a time" --seed 0 --temp 0
./build/bin/main_client -m ./Falcon-40B/falcon-40b-relu.q4.powerinfer.gguf -n 128 -t 8 -p "Once upon a time" --seed 0 --temp 0 --no-mmap
./build/bin/main_client -m ./ReluLLaMA-7B/llama-7b-relu.powerinfer.gguf -n 128 -t 8 -p "Once upon a time" --no-mmap --seed 0 --temp 0
```

For CPU-only and CPU-GPU hybrid inference with all available VRAM, you can use the following instructions to run PowerInfer:
Expand Down
8 changes: 5 additions & 3 deletions examples/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ link_libraries(pthread ${IBVERBS_LIBRARY} ${RDMACM_LIBRARY})
add_executable(${TARGET} main.cpp)
if(LLAMA_BUILD_RDMA_server)
set(TARGET_ main_server)
add_executable(${TARGET_} main_server.cpp ${PROJECT_SOURCE_DIR}/rdma-example/src/rdma_common.h)
add_executable(${TARGET_} main_server.cpp )
# add_executable(${TARGET_} main_server.cpp ${PROJECT_SOURCE_DIR}/rdma-example/src/rdma_common.h)
elseif(LLAMA_BUILD_RDMA_client)
set(TARGET_ main_client)
add_executable(${TARGET_} main_client.cpp ${PROJECT_SOURCE_DIR}/rdma-example/src/rdma_common.h)
add_executable(${TARGET_} main_client.cpp )
# add_executable(${TARGET_} main_client.cpp ${PROJECT_SOURCE_DIR}/rdma-example/src/rdma_common.h)
endif()
target_include_directories(${TARGET_} PRIVATE ${PROJECT_SOURCE_DIR}/rdma-example/src)
# target_include_directories(${TARGET_} PRIVATE ${PROJECT_SOURCE_DIR}/rdma-example/src)

install(TARGETS ${TARGET} RUNTIME)
install(TARGETS ${TARGET_} RUNTIME)
Expand Down
Loading

0 comments on commit ca26008

Please sign in to comment.