|
| 1 | +# Server build and tests |
| 2 | +name: Server |
| 3 | + |
| 4 | +on: |
| 5 | + workflow_dispatch: # allows manual triggering |
| 6 | + push: |
| 7 | + branches: |
| 8 | + - master |
| 9 | + - test/server-add-ci-test # FIXME remove |
| 10 | + paths: ['.github/workflows/**', '**/CMakeLists.txt', '**/Makefile', '**/*.h', '**/*.hpp', '**/*.c', '**/*.cpp', '**/*.cu', '**/*.swift', '**/*.m', 'examples/server/**.*'] |
| 11 | + pull_request: |
| 12 | + types: [opened, synchronize, reopened] |
| 13 | + paths: ['**/CMakeLists.txt', '**/Makefile', '**/*.h', '**/*.hpp', '**/*.c', '**/*.cpp', '**/*.cu', '**/*.swift', '**/*.m', 'examples/server/**.*'] |
| 14 | + |
| 15 | +jobs: |
| 16 | + server: |
| 17 | + runs-on: ubuntu-latest |
| 18 | + |
| 19 | + strategy: |
| 20 | + matrix: |
| 21 | + build: [noavx, avx2, avx, avx512, cublas, clblast, openblas, kompute, vulkan] |
| 22 | + sanitizer: [ADDRESS, THREAD, UNDEFINED] |
| 23 | + build_type: [Debug, Release] |
| 24 | + include: |
| 25 | + - build: 'noavx' |
| 26 | + defines: '-DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_AVX=OFF -DLLAMA_AVX2=OFF -DLLAMA_FMA=OFF' |
| 27 | + image: ubuntu:latest |
| 28 | + - build: 'avx2' |
| 29 | + defines: '-DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON' |
| 30 | + image: ubuntu:latest |
| 31 | + - build: 'avx' |
| 32 | + defines: '-DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_AVX2=OFF' |
| 33 | + image: ubuntu:latest |
| 34 | + - build: 'avx512' |
| 35 | + defines: '-DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_AVX512=ON' |
| 36 | + image: ubuntu:latest |
| 37 | + experimental: true |
| 38 | + - build: 'cublas' |
| 39 | + defines: '-DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_CUBLAS=ON' |
| 40 | + image: nvidia/cuda:12.3.1-devel-ubuntu22.04 |
| 41 | + arch_not_available: true # require nvidia docker engine |
| 42 | + - build: 'clblast' |
| 43 | + defines: '-DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_CLBLAST=ON' |
| 44 | + image: ubuntu:latest |
| 45 | + arch_not_available: true |
| 46 | + - build: 'openblas' |
| 47 | + defines: '-DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_BLAS=ON -DLLAMA_BLAS_VENDOR=OpenBLAS' |
| 48 | + image: ubuntu:latest |
| 49 | + - build: 'kompute' |
| 50 | + defines: '-DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_KOMPUTE=ON -DKOMPUTE_OPT_DISABLE_VULKAN_VERSION_CHECK=ON' |
| 51 | + image: ubuntu:latest |
| 52 | + arch_not_available: true |
| 53 | + - build: 'vulkan' |
| 54 | + defines: '-DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_VULKAN=ON' |
| 55 | + image: ubuntu:latest |
| 56 | + arch_not_available: true |
| 57 | + |
| 58 | + container: |
| 59 | + image: ${{ matrix.image }} |
| 60 | + ports: |
| 61 | + - 8888 |
| 62 | + options: --cpus 4 |
| 63 | + |
| 64 | + steps: |
| 65 | + - name: Clone |
| 66 | + id: checkout |
| 67 | + uses: actions/checkout@v3 |
| 68 | + |
| 69 | + - name: Dependencies |
| 70 | + id: depends |
| 71 | + run: | |
| 72 | + apt-get update |
| 73 | + apt-get -y install \ |
| 74 | + build-essential \ |
| 75 | + pkg-config \ |
| 76 | + git \ |
| 77 | + cmake \ |
| 78 | + python3-pip \ |
| 79 | + wget \ |
| 80 | + psmisc |
| 81 | +
|
| 82 | + - name: Download CLBlast |
| 83 | + id: get_clblast |
| 84 | + if: ${{ matrix.build == 'clblast' }} |
| 85 | + run: | |
| 86 | + apt install -y libclblast-dev |
| 87 | +
|
| 88 | + - name: Download OpenBLAS |
| 89 | + id: get_openblas |
| 90 | + if: ${{ matrix.build == 'openblas' }} |
| 91 | + run: | |
| 92 | + apt-get -y install libopenblas-dev |
| 93 | +
|
| 94 | + - name: Install Vulkan SDK |
| 95 | + id: get_vulkan |
| 96 | + if: ${{ matrix.build == 'kompute' || matrix.build == 'vulkan' }} |
| 97 | + run: | |
| 98 | + wget -qO- https://packages.lunarg.com/lunarg-signing-key-pub.asc | tee /etc/apt/trusted.gpg.d/lunarg.asc |
| 99 | + wget -qO /etc/apt/sources.list.d/lunarg-vulkan-jammy.list http://packages.lunarg.com/vulkan/lunarg-vulkan-jammy.list |
| 100 | + apt-get update |
| 101 | + apt-get -y install vulkan-sdk |
| 102 | +
|
| 103 | + - name: Build |
| 104 | + id: cmake_build |
| 105 | + run: | |
| 106 | + mkdir build |
| 107 | + cd build |
| 108 | + cmake .. -DLLAMA_SANITIZE_${{ matrix.sanitizer }}=ON -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ${{ matrix.defines }} |
| 109 | + cmake --build . --config ${{ matrix.build_type }} -j $(nproc) --target server |
| 110 | +
|
| 111 | + - name: Tests dependencies |
| 112 | + id: test_dependencies |
| 113 | + run: | |
| 114 | + pip install -r examples/server/tests/requirements.txt |
| 115 | +
|
| 116 | + - name: Download models |
| 117 | + id: download_models |
| 118 | + run: | |
| 119 | + cd examples/server/tests |
| 120 | + ../../../scripts/hf.sh --repo ggml-org/models --file tinyllamas/stories260K.gguf |
| 121 | +
|
| 122 | + - name: Tests |
| 123 | + id: server_integration_test |
| 124 | + continue-on-error: ${{ matrix.experimental || matrix.arch_not_available }} |
| 125 | + run: | |
| 126 | + cd examples/server/tests |
| 127 | + PORT=8888 ./tests.sh |
0 commit comments