Skip to content

Commit cc7f8cb

Browse files
authored
Merge pull request #6 from kpouget/fail
remoting: improve the failure when no virtgpu is available
2 parents f5b6bd2 + 1c6414e commit cc7f8cb

File tree

3 files changed

+44
-2
lines changed

3 files changed

+44
-2
lines changed

build.remoting.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# force isatty-->true, so that $0 |& head -50 has colors ...
2+
rm -f READY FAILED
3+
4+
echo "int isatty(int fd) { return 1; }" | gcc -O2 -fpic -shared -ldl -o /tmp/isatty.so -xc -
5+
export LD_PRELOAD=/tmp/isatty.so
6+
7+
TARGETS="ggml-remotingfrontend"
8+
9+
TARGETS="$BUILD_TARGET llama-run"
10+
set -x
11+
if [[ "${BENCH_MODE:-}" == "bench" ]]; then
12+
TARGETS="$TARGETS llama-bench"
13+
elif [[ "${BENCH_MODE:-}" == "server" ]]; then
14+
TARGETS="$TARGETS llama-server"
15+
elif [[ "${BENCH_MODE:-}" == "perf" ]]; then
16+
TARGETS="$TARGETS test-backend-ops"
17+
fi
18+
19+
cmake --build ../build.remoting-frontend$FLAVOR --parallel 8 --target $TARGETS "$@"
20+
21+
if [[ $? == 0 ]]; then
22+
touch READY
23+
else
24+
touch FAILED
25+
fi

ggml/src/ggml-remotingfrontend/virtgpu.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,10 @@ create_virtgpu() {
6262
1024);
6363

6464
virt_gpu_result_t result = virtgpu_open(gpu);
65-
assert(result == APIR_SUCCESS);
65+
if (result != APIR_SUCCESS) {
66+
FATAL("%s: failed to create the open the virtgpu device :/", __func__);
67+
return NULL;
68+
}
6669

6770
result = virtgpu_init_params(gpu);
6871
assert(result == APIR_SUCCESS);
@@ -126,7 +129,7 @@ virtgpu_open(struct virtgpu *gpu)
126129
drmDevicePtr devs[8];
127130
int count = drmGetDevices2(0, devs, ARRAY_SIZE(devs));
128131
if (count < 0) {
129-
ERROR("failed to enumerate DRM devices");
132+
ERROR("%s: failed to enumerate DRM devices", __func__);
130133
return APIR_ERROR_INITIALIZATION_FAILED;
131134
}
132135

run.remoting.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,20 @@ set -x
1818
if [[ "${BENCH_MODE:-}" == "bench" ]]; then
1919
cat <<EOF
2020
###
21+
### Running llama-server
22+
###
23+
24+
EOF
25+
$prefix \
26+
$LLAMA_BUILD_DIR/bin/llama-server \
27+
--host 0.0.0.0 \
28+
--port 8080 \
29+
--model "$MODEL_HOME/$MODEL" \
30+
--n-gpu-layers 99 \
31+
--threads 1
32+
elif [[ "${BENCH_MODE:-}" == "bench" ]]; then
33+
cat <<EOF
34+
###
2135
### Running llama-bench
2236
###
2337

0 commit comments

Comments
 (0)