char-fork/llama.cpp

git clone https://git.t4t.associates/char-fork/llama.cpp

Neo Zhangsycl : fix reorder function; add fp32/fp16 in build script (#24578)72be44f1d

char/aliceai-t5-moe
1.3 KiB53 linesraw
1#!/usr/bin/env bash
2#  MIT license
3#  Copyright (C) 2024 Intel Corporation
4#  SPDX-License-Identifier: MIT
5
6print_usage() {
7    echo "Usage: ./build.sh [fp32|fp16] [--help]"
8    echo ""
9    echo "Options:"
10    echo "  fp32    Build with FP32 precision (default)"
11    echo "  fp16    Build with FP16 precision (faster for long-prompt inference)"
12    echo "  --help  Print this help message"
13}
14
15PRECISION=fp32
16
17for arg in "$@"; do
18    case "$arg" in
19        --help)
20            print_usage
21            exit 0
22            ;;
23        fp32|fp16)
24            PRECISION="$arg"
25            ;;
26        *)
27            echo "Error: unknown option '$arg'"
28            print_usage
29            exit 1
30            ;;
31    esac
32done
33
34mkdir -p build
35cd build
36source /opt/intel/oneapi/setvars.sh
37
38if [ "$PRECISION" = "fp16" ]; then
39    #for FP16
40    cmake .. -DGGML_SYCL=ON -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx -DGGML_SYCL_F16=ON -DLLAMA_OPENSSL=OFF # faster for long-prompt inference
41else
42    #for FP32
43    cmake .. -DGGML_SYCL=ON -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx -DLLAMA_OPENSSL=OFF
44fi
45
46#build example/main
47#cmake --build . --config Release --target main
48
49#build example/llama-bench
50#cmake --build . --config Release --target llama-bench
51
52#build all binary
53cmake --build . --config Release -j$((($(nproc)+1)/2)) -v