LLM inference in C/C++
C++ ggml
binaries : Improve rpc-server and export-graph-ops names. (#25045)
Christian Kastnerc299a92c38b6
diff --git a/SECURITY.md b/SECURITY.mdindex a98b8e70bd..0e704e3280 100644--- a/SECURITY.md+++ b/SECURITY.md@@ -80,7 +80,7 @@ To protect sensitive data from potential leaks or unauthorized access, it is cru### Untrusted environments or networksIf you can't run your models in a secure and isolated environment or if it must be exposed to an untrusted network, make sure to take the following security precautions:-* Do not use the RPC backend, [rpc-server](https://github.com/ggml-org/llama.cpp/tree/master/tools/rpc) and [llama-server](https://github.com/ggml-org/llama.cpp/tree/master/tools/server) functionality (see https://github.com/ggml-org/llama.cpp/pull/13061).+* Do not use the RPC backend, [ggml-rpc-server](https://github.com/ggml-org/llama.cpp/tree/master/tools/rpc) and [llama-server](https://github.com/ggml-org/llama.cpp/tree/master/tools/server) functionality (see https://github.com/ggml-org/llama.cpp/pull/13061).* Confirm the hash of any downloaded artifact (e.g. pre-trained model weights) matches a known-good value.* Encrypt your data if sending it over the network.diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txtindex 0dd1d7b162..24592a2792 100644--- a/tests/CMakeLists.txt+++ b/tests/CMakeLists.txt@@ -302,9 +302,9 @@ target_link_libraries(${TEST_TARGET} PRIVATE llama)llama_build_and_test(test-alloc.cpp)target_include_directories(test-alloc PRIVATE ${PROJECT_SOURCE_DIR}/ggml/src)-llama_build(export-graph-ops.cpp)-target_include_directories(export-graph-ops PRIVATE ${PROJECT_SOURCE_DIR}/ggml/src)+llama_build(test-export-graph-ops.cpp)+target_include_directories(test-export-graph-ops PRIVATE ${PROJECT_SOURCE_DIR}/ggml/src)if (TARGET gguf-model-data)- target_link_libraries(export-graph-ops PRIVATE gguf-model-data)- target_compile_definitions(export-graph-ops PRIVATE LLAMA_HF_FETCH)+ target_link_libraries(test-export-graph-ops PRIVATE gguf-model-data)+ target_compile_definitions(test-export-graph-ops PRIVATE LLAMA_HF_FETCH)endif()diff --git a/tests/test-backend-ops.cpp b/tests/test-backend-ops.cppindex 0830dbf570..09ac62a756 100644--- a/tests/test-backend-ops.cpp+++ b/tests/test-backend-ops.cpp@@ -9943,7 +9943,7 @@ static void usage(char ** argv) {printf(" --output specifies output format (default: console, options: console, sql, csv)\n");printf(" --list-ops lists all available GGML operations\n");printf(" --show-coverage shows test coverage\n");- printf(" --test-file reads test operators from a test file generated by llama-export-graph-ops\n");+ printf(" --test-file reads test operators from a test file generated by test-export-graph-ops\n");printf(" -j <n> runs tests using <n> parallel worker threads (default: 1, test mode only)\n");}diff --git a/tests/export-graph-ops.cpp b/tests/test-export-graph-ops.cppsimilarity index 98%rename from tests/export-graph-ops.cpprename to tests/test-export-graph-ops.cppindex 64cf6dcea3..7d8118dcd6 100644--- a/tests/export-graph-ops.cpp+++ b/tests/test-export-graph-ops.cpp@@ -185,7 +185,7 @@ int main(int argc, char ** argv) {return 1;}#else- LOG_ERR("export-graph-ops compiled without HF fetch support\n");+ LOG_ERR("test-export-graph-ops compiled without HF fetch support\n");return 1;#endif}diff --git a/tools/rpc/CMakeLists.txt b/tools/rpc/CMakeLists.txtindex 20f114ad9b..0eee9a922e 100644--- a/tools/rpc/CMakeLists.txt+++ b/tools/rpc/CMakeLists.txt@@ -1,4 +1,4 @@-set(TARGET rpc-server)+set(TARGET ggml-rpc-server)add_executable(${TARGET} rpc-server.cpp)target_link_libraries(${TARGET} PRIVATE ggml)target_compile_features(${TARGET} PRIVATE cxx_std_17)diff --git a/tools/rpc/README.md b/tools/rpc/README.mdindex 05b7292c03..655b65347e 100644--- a/tools/rpc/README.md+++ b/tools/rpc/README.md@@ -4,8 +4,8 @@> This example and the RPC backend are currently in a proof-of-concept development stage. As such, the functionality is fragile and> insecure. **Never run the RPC server on an open network or in a sensitive environment!**-The `rpc-server` allows exposing `ggml` devices on a remote host.-The RPC backend communicates with one or several instances of `rpc-server` and offloads computations to them.+The `ggml-rpc-server` allows exposing `ggml` devices on a remote host.+The RPC backend communicates with one or several instances of `ggml-rpc-server` and offloads computations to them.This can be used for distributed LLM inference with `llama.cpp` in the following way:```mermaid@@ -14,15 +14,15 @@ flowchart TDrpcb<-->|TCP|srvbrpcb<-.->|TCP|srvnsubgraph hostn[Host N]- srvn[rpc-server]<-.->dev4["CUDA0"]- srvn[rpc-server]<-.->dev5["CPU"]+ srvn[ggml-rpc-server]<-.->dev4["CUDA0"]+ srvn[ggml-rpc-server]<-.->dev5["CPU"]endsubgraph hostb[Host B]- srvb[rpc-server]<-->dev3["Metal"]+ srvb[ggml-rpc-server]<-->dev3["Metal"]endsubgraph hosta[Host A]- srva[rpc-server]<-->dev["CUDA0"]- srva[rpc-server]<-->dev2["CUDA1"]+ srva[ggml-rpc-server]<-->dev["CUDA0"]+ srva[ggml-rpc-server]<-->dev2["CUDA1"]endsubgraph host[Main Host]local["Local devices"]<-->ggml[llama-cli]@@ -33,7 +33,7 @@ flowchart TDclass local,dev,dev2,dev3,dev4,dev5 devcls```-By default, `rpc-server` exposes all available accelerator devices on the host.+By default, `ggml-rpc-server` exposes all available accelerator devices on the host.If there are no accelerators, it exposes a single `CPU` device.## Usage@@ -41,7 +41,7 @@ If there are no accelerators, it exposes a single `CPU` device.### Remote hostsOn each remote host, build the backends for each accelerator by adding `-DGGML_RPC=ON` to the build options.-For example, to build the `rpc-server` with support for CUDA accelerators:+For example, to build the `ggml-rpc-server` with support for CUDA accelerators:```bashmkdir build-rpc-cuda@@ -50,10 +50,10 @@ cmake .. -DGGML_CUDA=ON -DGGML_RPC=ONcmake --build . --config Release```-When started, the `rpc-server` will detect and expose all available `CUDA` devices:+When started, the `ggml-rpc-server` will detect and expose all available `CUDA` devices:```bash-$ bin/rpc-server+$ bin/ggml-rpc-serverggml_cuda_init: GGML_CUDA_FORCE_MMQ: noggml_cuda_init: GGML_CUDA_FORCE_CUBLAS: noggml_cuda_init: found 1 CUDA devices:@@ -67,14 +67,14 @@ Devices:You can control the set of exposed CUDA devices with the `CUDA_VISIBLE_DEVICES` environment variable or the `--device` command line option. The following two commands have the same effect:```bash-$ CUDA_VISIBLE_DEVICES=0 bin/rpc-server -p 50052-$ bin/rpc-server --device CUDA0 -p 50052+$ CUDA_VISIBLE_DEVICES=0 bin/ggml-rpc-server -p 50052+$ bin/ggml-rpc-server --device CUDA0 -p 50052```### Main hostOn the main host build `llama.cpp` with the backends for the local devices and add `-DGGML_RPC=ON` to the build options.-Finally, when running `llama-cli` or `llama-server`, use the `--rpc` option to specify the host and port of each `rpc-server`:+Finally, when running `llama-cli` or `llama-server`, use the `--rpc` option to specify the host and port of each `ggml-rpc-server`:```bash$ llama-cli -hf ggml-org/gemma-3-1b-it-GGUF -ngl 99 --rpc 192.168.88.10:50052,192.168.88.11:50052@@ -90,7 +90,7 @@ This can speed up model loading significantly, especially when using large modelTo enable the cache, use the `-c` option:```bash-$ bin/rpc-server -c+$ bin/ggml-rpc-server -c```By default, the cache is stored in the `$HOME/.cache/llama.cpp/rpc` directory and can be controlled via the `LLAMA_CACHE` environment variable.@@ -103,8 +103,8 @@ RDMA is enabled by default when `libibverbs` is found at build time.### Troubleshooting-Use the `GGML_RPC_DEBUG` environment variable to enable debug messages from `rpc-server`:+Use the `GGML_RPC_DEBUG` environment variable to enable debug messages from `ggml-rpc-server`:```bash-$ GGML_RPC_DEBUG=1 bin/rpc-server+$ GGML_RPC_DEBUG=1 bin/ggml-rpc-server```