mirror of
https://github.com/ggml-org/llama.cpp.git
synced 2026-06-27 23:50:20 -05:00
binaries : Improve rpc-server and export-graph-ops names. (#25045)
Tests are generally prefixed with -test, so rename export-graph-ops accordingly. rpc-server is probably too generic a name for /usr/bin. Because it should work with any ggml application, it is renamed to ggml-rpc-server.
This commit is contained in:
parent
0275c0f800
commit
c299a92c38
@ -80,7 +80,7 @@ To protect sensitive data from potential leaks or unauthorized access, it is cru
|
|||||||
### Untrusted environments or networks
|
### Untrusted environments or networks
|
||||||
|
|
||||||
If 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:
|
If 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.
|
* 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.
|
* Encrypt your data if sending it over the network.
|
||||||
|
|
||||||
|
|||||||
@ -302,9 +302,9 @@ target_link_libraries(${TEST_TARGET} PRIVATE llama)
|
|||||||
llama_build_and_test(test-alloc.cpp)
|
llama_build_and_test(test-alloc.cpp)
|
||||||
target_include_directories(test-alloc PRIVATE ${PROJECT_SOURCE_DIR}/ggml/src)
|
target_include_directories(test-alloc PRIVATE ${PROJECT_SOURCE_DIR}/ggml/src)
|
||||||
|
|
||||||
llama_build(export-graph-ops.cpp)
|
llama_build(test-export-graph-ops.cpp)
|
||||||
target_include_directories(export-graph-ops PRIVATE ${PROJECT_SOURCE_DIR}/ggml/src)
|
target_include_directories(test-export-graph-ops PRIVATE ${PROJECT_SOURCE_DIR}/ggml/src)
|
||||||
if (TARGET gguf-model-data)
|
if (TARGET gguf-model-data)
|
||||||
target_link_libraries(export-graph-ops PRIVATE gguf-model-data)
|
target_link_libraries(test-export-graph-ops PRIVATE gguf-model-data)
|
||||||
target_compile_definitions(export-graph-ops PRIVATE LLAMA_HF_FETCH)
|
target_compile_definitions(test-export-graph-ops PRIVATE LLAMA_HF_FETCH)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@ -9943,7 +9943,7 @@ static void usage(char ** argv) {
|
|||||||
printf(" --output specifies output format (default: console, options: console, sql, csv)\n");
|
printf(" --output specifies output format (default: console, options: console, sql, csv)\n");
|
||||||
printf(" --list-ops lists all available GGML operations\n");
|
printf(" --list-ops lists all available GGML operations\n");
|
||||||
printf(" --show-coverage shows test coverage\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");
|
printf(" -j <n> runs tests using <n> parallel worker threads (default: 1, test mode only)\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -185,7 +185,7 @@ int main(int argc, char ** argv) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#else
|
#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;
|
return 1;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
set(TARGET rpc-server)
|
set(TARGET ggml-rpc-server)
|
||||||
add_executable(${TARGET} rpc-server.cpp)
|
add_executable(${TARGET} rpc-server.cpp)
|
||||||
target_link_libraries(${TARGET} PRIVATE ggml)
|
target_link_libraries(${TARGET} PRIVATE ggml)
|
||||||
target_compile_features(${TARGET} PRIVATE cxx_std_17)
|
target_compile_features(${TARGET} PRIVATE cxx_std_17)
|
||||||
|
|||||||
@ -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
|
> 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!**
|
> 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 `ggml-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 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:
|
This can be used for distributed LLM inference with `llama.cpp` in the following way:
|
||||||
|
|
||||||
```mermaid
|
```mermaid
|
||||||
@ -14,15 +14,15 @@ flowchart TD
|
|||||||
rpcb<-->|TCP|srvb
|
rpcb<-->|TCP|srvb
|
||||||
rpcb<-.->|TCP|srvn
|
rpcb<-.->|TCP|srvn
|
||||||
subgraph hostn[Host N]
|
subgraph hostn[Host N]
|
||||||
srvn[rpc-server]<-.->dev4["CUDA0"]
|
srvn[ggml-rpc-server]<-.->dev4["CUDA0"]
|
||||||
srvn[rpc-server]<-.->dev5["CPU"]
|
srvn[ggml-rpc-server]<-.->dev5["CPU"]
|
||||||
end
|
end
|
||||||
subgraph hostb[Host B]
|
subgraph hostb[Host B]
|
||||||
srvb[rpc-server]<-->dev3["Metal"]
|
srvb[ggml-rpc-server]<-->dev3["Metal"]
|
||||||
end
|
end
|
||||||
subgraph hosta[Host A]
|
subgraph hosta[Host A]
|
||||||
srva[rpc-server]<-->dev["CUDA0"]
|
srva[ggml-rpc-server]<-->dev["CUDA0"]
|
||||||
srva[rpc-server]<-->dev2["CUDA1"]
|
srva[ggml-rpc-server]<-->dev2["CUDA1"]
|
||||||
end
|
end
|
||||||
subgraph host[Main Host]
|
subgraph host[Main Host]
|
||||||
local["Local devices"]<-->ggml[llama-cli]
|
local["Local devices"]<-->ggml[llama-cli]
|
||||||
@ -33,7 +33,7 @@ flowchart TD
|
|||||||
class local,dev,dev2,dev3,dev4,dev5 devcls
|
class 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.
|
If there are no accelerators, it exposes a single `CPU` device.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
@ -41,7 +41,7 @@ If there are no accelerators, it exposes a single `CPU` device.
|
|||||||
### Remote hosts
|
### Remote hosts
|
||||||
|
|
||||||
On each remote host, build the backends for each accelerator by adding `-DGGML_RPC=ON` to the build options.
|
On 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:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
mkdir build-rpc-cuda
|
mkdir build-rpc-cuda
|
||||||
@ -50,10 +50,10 @@ cmake .. -DGGML_CUDA=ON -DGGML_RPC=ON
|
|||||||
cmake --build . --config Release
|
cmake --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
|
```bash
|
||||||
$ bin/rpc-server
|
$ bin/ggml-rpc-server
|
||||||
ggml_cuda_init: GGML_CUDA_FORCE_MMQ: no
|
ggml_cuda_init: GGML_CUDA_FORCE_MMQ: no
|
||||||
ggml_cuda_init: GGML_CUDA_FORCE_CUBLAS: no
|
ggml_cuda_init: GGML_CUDA_FORCE_CUBLAS: no
|
||||||
ggml_cuda_init: found 1 CUDA devices:
|
ggml_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:
|
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
|
```bash
|
||||||
$ CUDA_VISIBLE_DEVICES=0 bin/rpc-server -p 50052
|
$ CUDA_VISIBLE_DEVICES=0 bin/ggml-rpc-server -p 50052
|
||||||
$ bin/rpc-server --device CUDA0 -p 50052
|
$ bin/ggml-rpc-server --device CUDA0 -p 50052
|
||||||
```
|
```
|
||||||
|
|
||||||
### Main host
|
### Main host
|
||||||
|
|
||||||
On the main host build `llama.cpp` with the backends for the local devices and add `-DGGML_RPC=ON` to the build options.
|
On 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
|
```bash
|
||||||
$ llama-cli -hf ggml-org/gemma-3-1b-it-GGUF -ngl 99 --rpc 192.168.88.10:50052,192.168.88.11:50052
|
$ 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 model
|
|||||||
To enable the cache, use the `-c` option:
|
To enable the cache, use the `-c` option:
|
||||||
|
|
||||||
```bash
|
```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.
|
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
|
### 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
|
```bash
|
||||||
$ GGML_RPC_DEBUG=1 bin/rpc-server
|
$ GGML_RPC_DEBUG=1 bin/ggml-rpc-server
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user