CoolFace
Modelpublic

Felipe97/llama-cpp-compiled

sourceHugging Faceupdated 5d agoView on Hugging Face
0likes1.1kdownloads
start-svr.sh131 linesDownload Raw Back to sycl
1#!/bin/bash2 3#  MIT license4#  Copyright (C) 2024 Intel Corporation5#  SPDX-License-Identifier: MIT6 7Help() {8  cat << EOF9Usage: $(basename "$0") [OPTIONS]10 11This script processes files with specified options.12 13Options:14  -h, --help    Display this help message and exit.15  -d, --device  <value>    Set SYCL devices (default: SYCL0).16  -c, --context <value>    Set context length. Bigger need more memory.17  -p, --promote <value>    Prompt to start generation with.18  -m, --model   <value>    Full model file path.19  -mg,--main-gpu <value>   Set main GPU ID (0 - n) for single GPU mode.20  -sm,--split-mode <value> How to split the model across multiple GPUs, one of:21                            - none: use one GPU only22                            - layer (default): split layers and KV across GPUs23                            - row: split rows across GPUs24  -ngl,--n-gpu-layers <value>  Max. number of layers to store in VRAM (default: -1)25  -lv,--log-verbosity <value>  Set the verbosity threshold. Messages with a higher verbosity will be26                               ignored. Values:27                                - 0: generic output28                                - 1: error29                                - 2: warning30                                - 3: info31                                - 4: debug32 33 34EOF35}36 37BIN_FILE=./build/bin/llama-server38SEED=039GPUS_SETTING=""40 41MODEL_FILE=../models/Qwen3.5-4B-Q4_0.gguf42NGL=9943CONTEXT=409644GGML_SYCL_DEVICE=-145SYCL_DEVICES="SYCL0"46SPLIT_MODE=layer47LOG_VERBOSE=348while [[ $# -gt 0 ]]; do49    case "$1" in50        -d|--device)51            SYCL_DEVICES="$2"52            shift53            shift54            ;;55        -c|--context)56            CONTEXT=$257            # Shift twice to consume both the option flag and its value58            shift59            shift60            ;;61        -m|--model)62            MODEL_FILE="$2"63            # Shift twice to consume both the option flag and its value64            shift65            shift66            ;;67        -mg|--main-gpu)68            GGML_SYCL_DEVICE=$269            SPLIT_MODE=none70            # Shift twice to consume both the option flag and its value71            shift72            shift73            ;;74        -sm|--split-mode)75            SPLIT_MODE=$276            # Shift twice to consume both the option flag and its value77            shift78            shift79            ;;80        -ngl|--n-gpu-layers)81            NGL=$282            # Shift twice to consume both the option flag and its value83            shift84            shift85            ;;86        -lv|--log-verbosity)87            LOG_VERBOSE=$288            # Shift twice to consume both the option flag and its value89            shift90            shift91            ;;92        -h|--help)93            Help94            exit 095            ;;96        *)97            # Handle unknown options or stop processing options98            echo "Invalid option: $1"99            # Optional: exit script or shift to treat remaining as positional args100            exit 1101            ;;102    esac103done104 105source /opt/intel/oneapi/setvars.sh106 107#export GGML_SYCL_DEBUG=1108 109#ZES_ENABLE_SYSMAN=1, Support to get free memory of GPU by sycl::aspect::ext_intel_free_memory. Recommended to use when --split-mode = layer.110 111#support malloc device memory more than 4GB.112export UR_L0_ENABLE_RELAXED_ALLOCATION_LIMITS=1113echo "UR_L0_ENABLE_RELAXED_ALLOCATION_LIMITS=${UR_L0_ENABLE_RELAXED_ALLOCATION_LIMITS}"114 115echo "ONEAPI_DEVICE_SELECTOR=${ONEAPI_DEVICE_SELECTOR}"116 117 118if [ $GGML_SYCL_DEVICE -ne -1 ]; then119    echo "Use $GGML_SYCL_DEVICE as main GPU"120    #use signle GPU only121    GPUS_SETTING="-mg $GGML_SYCL_DEVICE -sm ${SPLIT_MODE}"122else123    echo "Use Intel GPUs: ${SYCL_DEVICES}"124    GPUS_SETTING="-sm ${SPLIT_MODE}"125fi126 127echo "run cmd: ZES_ENABLE_SYSMAN=1 ${BIN_FILE} -m ${MODEL_FILE} -ngl ${NGL} -s ${SEED} -c ${CONTEXT} ${GPUS_SETTING} -lv ${LOG_VERBOSE} --device ${SYCL_DEVICES} --load-mode auto --host 0.0.0.0 --port 8000"128ZES_ENABLE_SYSMAN=1 ${BIN_FILE} -m ${MODEL_FILE} -ngl ${NGL} -s ${SEED} -c ${CONTEXT} ${GPUS_SETTING} -lv ${LOG_VERBOSE} --device ${SYCL_DEVICES} --load-mode auto --host 0.0.0.0 --port 8000129 130 131