chip_type: ['910b', '310p']
build: ['Release']
runs-on: ${{ matrix.arch == 'aarch64' && 'ubuntu-24.04-arm' || 'ubuntu-24.04' }}
- container: ascendai/cann:${{ matrix.chip_type == '910b' && '8.3.rc1.alpha001-910b-openeuler22.03-py3.11' || '8.2.rc1-310p-openeuler22.03-py3.11' }}
steps:
- name: Checkout
uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
- - name: Dependencies
- run: |
- yum update -y
- yum install -y git gcc gcc-c++ make cmake libcurl-devel
+ - name: Free up disk space
+ uses: ggml-org/free-disk-space@v1.3.1
+ with:
+ tool-cache: true
- - name: Build
+ - name: Set container image
+ id: cann-image
run: |
- export LD_LIBRARY_PATH=${ASCEND_TOOLKIT_HOME}/lib64:${ASCEND_TOOLKIT_HOME}/$(uname -m)-linux/devlib/:${LD_LIBRARY_PATH}
+ image="ascendai/cann:${{ matrix.chip_type == '910b' && '8.3.rc2-910b-openeuler24.03-py3.11' || '8.3.rc2-310p-openeuler24.03-py3.11' }}"
+ echo "image=${image}" >> "${GITHUB_OUTPUT}"
- cmake -S . -B build \
- -DCMAKE_BUILD_TYPE=${{ matrix.build }} \
- -DGGML_CANN=on \
- -DSOC_TYPE=ascend${{ matrix.chip_type }}
- cmake --build build -j $(nproc)
+ - name: Pull container image
+ run: docker pull "${{ steps.cann-image.outputs.image }}"
+
+ - name: Build
+ env:
+ BUILD_TYPE: ${{ matrix.build }}
+ SOC_TYPE: ascend${{ matrix.chip_type }}
+ run: |
+ HOST_UID=$(id -u)
+ HOST_GID=$(id -g)
+
+ docker run --rm \
+ -v "${PWD}:/workspace" \
+ -w /workspace \
+ -e SOC_TYPE=${SOC_TYPE} \
+ -e BUILD_TYPE=${BUILD_TYPE} \
+ "${{ steps.cann-image.outputs.image }}" \
+ bash -lc '
+ set -e
+ yum install -y --setopt=install_weak_deps=False --setopt=tsflags=nodocs git gcc gcc-c++ make cmake libcurl-devel
+ yum clean all && rm -rf /var/cache/yum
+ git config --global --add safe.directory "/workspace"
+ export LD_LIBRARY_PATH=${ASCEND_TOOLKIT_HOME}/lib64:${ASCEND_TOOLKIT_HOME}/$(uname -m)-linux/devlib/:${LD_LIBRARY_PATH}
+ cmake -S . -B build \
+ -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
+ -DGGML_CANN=on \
+ -DSOC_TYPE=${SOC_TYPE}
+ cmake --build build -j $(nproc)
+
+ chown -R '"${HOST_UID}"':'"${HOST_GID}"' /workspace/build
+ '
# TODO: simplify the following workflows using a matrix
# TODO: run lighter CI on PRs and the full CI only on master (if needed)
path: llama-${{ steps.tag.outputs.name }}-xcframework.tar.gz
name: llama-${{ steps.tag.outputs.name }}-xcframework.tar.gz
+
+ openEuler-cann:
+ strategy:
+ matrix:
+ arch: [x86, aarch64]
+ chip_type: ['910b', '310p']
+ build: ['Release']
+ runs-on: ${{ matrix.arch == 'aarch64' && 'ubuntu-24.04-arm' || 'ubuntu-24.04' }}
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+
+ - name: Free up disk space
+ uses: ggml-org/free-disk-space@v1.3.1
+ with:
+ tool-cache: true
+
+ - name: Set container image
+ id: cann-image
+ run: |
+ image="ascendai/cann:${{ matrix.chip_type == '910b' && '8.3.rc2-910b-openeuler24.03-py3.11' || '8.3.rc2-310p-openeuler24.03-py3.11' }}"
+ echo "image=${image}" >> "${GITHUB_OUTPUT}"
+
+ - name: Pull container image
+ run: docker pull "${{ steps.cann-image.outputs.image }}"
+
+ - name: Build
+ env:
+ BUILD_TYPE: ${{ matrix.build }}
+ SOC_TYPE: ascend${{ matrix.chip_type }}
+ run: |
+ HOST_UID=$(id -u)
+ HOST_GID=$(id -g)
+
+ docker run --rm \
+ -v "${PWD}:/workspace" \
+ -w /workspace \
+ -e SOC_TYPE=${SOC_TYPE} \
+ -e BUILD_TYPE=${BUILD_TYPE} \
+ "${{ steps.cann-image.outputs.image }}" \
+ bash -lc '
+ set -e
+ yum install -y --setopt=install_weak_deps=False --setopt=tsflags=nodocs git gcc gcc-c++ make cmake libcurl-devel
+ yum clean all && rm -rf /var/cache/yum
+ git config --global --add safe.directory "/workspace"
+ export LD_LIBRARY_PATH=${ASCEND_TOOLKIT_HOME}/lib64:${ASCEND_TOOLKIT_HOME}/$(uname -m)-linux/devlib/:${LD_LIBRARY_PATH}
+ cmake -S . -B build \
+ -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
+ -DGGML_CANN=on \
+ -DSOC_TYPE=${SOC_TYPE}
+ cmake --build build -j $(nproc)
+
+ chown -R '"${HOST_UID}"':'"${HOST_GID}"' /workspace/build
+ '
+
+ - name: Determine tag name
+ id: tag
+ uses: ./.github/actions/get-tag-name
+
+ - name: Pack artifacts
+ run: |
+ cp LICENSE ./build/bin/
+ tar -czvf llama-${{ steps.tag.outputs.name }}-bin-${{ matrix.chip_type }}-openEuler-${{ matrix.arch }}.tar.gz --transform "s,./,llama-${{ steps.tag.outputs.name }}/," -C ./build/bin .
+
+ - name: Upload artifacts (tar)
+ uses: actions/upload-artifact@v4
+ with:
+ path: llama-${{ steps.tag.outputs.name }}-bin-${{ matrix.chip_type }}-openEuler-${{ matrix.arch }}.tar.gz
+ name: llama-bin-${{ matrix.chip_type }}-openEuler-${{ matrix.arch }}.tar.gz
+
release:
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
- macOS-arm64
- macOS-x64
- ios-xcode-build
+ - openEuler-cann
steps:
- name: Clone
- [Windows x64 (SYCL)](https://github.com/ggml-org/llama.cpp/releases/download/${{ steps.tag.outputs.name }}/llama-${{ steps.tag.outputs.name }}-bin-win-sycl-x64.zip)
- [Windows x64 (HIP)](https://github.com/ggml-org/llama.cpp/releases/download/${{ steps.tag.outputs.name }}/llama-${{ steps.tag.outputs.name }}-bin-win-hip-radeon-x64.zip)
+ **openEuler:**
+ - [openEuler x86 (310p)](https://github.com/ggml-org/llama.cpp/releases/download/${{ steps.tag.outputs.name }}/llama-${{ steps.tag.outputs.name }}-bin-310p-openEuler-x86.tar.gz)
+ - [openEuler x86 (910b)](https://github.com/ggml-org/llama.cpp/releases/download/${{ steps.tag.outputs.name }}/llama-${{ steps.tag.outputs.name }}-bin-910b-openEuler-x86.tar.gz)
+ - [openEuler aarch64 (310p)](https://github.com/ggml-org/llama.cpp/releases/download/${{ steps.tag.outputs.name }}/llama-${{ steps.tag.outputs.name }}-bin-310p-openEuler-aarch64.tar.gz)
+ - [openEuler aarch64 (910b)](https://github.com/ggml-org/llama.cpp/releases/download/${{ steps.tag.outputs.name }}/llama-${{ steps.tag.outputs.name }}-bin-910b-openEuler-aarch64.tar.gz)
+
- name: Upload release
id: upload_release
uses: actions/github-script@v3