Skip to content

Commit ffa277a

Browse files
authored
CANN: Add openEuler-cann in build and release (#17192)
Update openEuler version Remove variable ASCEND_SOC_TYPE Modify the chip type Fix case in zip filename Change "device" to "chip_type" Modify the value of chip_type
1 parent da95bf2 commit ffa277a

File tree

3 files changed

+56
-10
lines changed

3 files changed

+56
-10
lines changed

.devops/cann.Dockerfile

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,15 @@
33
# ==============================================================================
44

55
# Define the CANN base image for easier version updates later
6-
ARG CANN_BASE_IMAGE=quay.io/ascend/cann:8.1.rc1-910b-openeuler22.03-py3.10
6+
ARG CHIP_TYPE=910b
7+
ARG CANN_BASE_IMAGE=quay.io/ascend/cann:8.3.rc1.alpha001-${CHIP_TYPE}-openeuler22.03-py3.11
78

89
# ==============================================================================
910
# BUILD STAGE
1011
# Compile all binary files and libraries
1112
# ==============================================================================
1213
FROM ${CANN_BASE_IMAGE} AS build
1314

14-
# Define the Ascend chip model for compilation. Default is Ascend910B3
15-
ARG ASCEND_SOC_TYPE=Ascend910B3
16-
1715
# -- Install build dependencies --
1816
RUN yum install -y gcc g++ cmake make git libcurl-devel python3 python3-pip && \
1917
yum clean all && \
@@ -36,13 +34,14 @@ ENV LD_LIBRARY_PATH=${ASCEND_TOOLKIT_HOME}/runtime/lib64/stub:$LD_LIBRARY_PATH
3634
# For brevity, only core variables are listed here. You can paste the original ENV list here.
3735

3836
# -- Build llama.cpp --
39-
# Use the passed ASCEND_SOC_TYPE argument and add general build options
37+
# Use the passed CHIP_TYPE argument and add general build options
38+
ARG CHIP_TYPE
4039
RUN source /usr/local/Ascend/ascend-toolkit/set_env.sh --force \
4140
&& \
4241
cmake -B build \
4342
-DGGML_CANN=ON \
4443
-DCMAKE_BUILD_TYPE=Release \
45-
-DSOC_TYPE=${ASCEND_SOC_TYPE} \
44+
-DSOC_TYPE=ascend${CHIP_TYPE} \
4645
. && \
4746
cmake --build build --config Release -j$(nproc)
4847

.github/workflows/build.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1391,9 +1391,9 @@ jobs:
13911391
matrix:
13921392
arch: [x86, aarch64]
13931393
cann:
1394-
- '8.1.RC1.alpha001-910b-openeuler22.03-py3.10'
1395-
device:
1396-
- 'ascend910b3'
1394+
- '8.3.rc1.alpha001-910b-openeuler22.03-py3.11'
1395+
chip_type:
1396+
- '910b'
13971397
build:
13981398
- 'Release'
13991399
runs-on: ${{ matrix.arch == 'aarch64' && 'ubuntu-24.04-arm' || 'ubuntu-24.04' }}
@@ -1414,7 +1414,7 @@ jobs:
14141414
cmake -S . -B build \
14151415
-DCMAKE_BUILD_TYPE=${{ matrix.build }} \
14161416
-DGGML_CANN=on \
1417-
-DSOC_TYPE=${{ matrix.device }}
1417+
-DSOC_TYPE=ascend${{ matrix.chip_type }}
14181418
cmake --build build -j $(nproc)
14191419
14201420
# TODO: simplify the following workflows using a matrix

.github/workflows/release.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -693,6 +693,52 @@ jobs:
693693
path: llama-${{ steps.tag.outputs.name }}-xcframework.zip
694694
name: llama-${{ steps.tag.outputs.name }}-xcframework
695695

696+
openEuler-cann:
697+
strategy:
698+
matrix:
699+
arch: [x86, aarch64]
700+
chip_type: ['910b', '310p']
701+
build:
702+
- 'Release'
703+
runs-on: ${{ matrix.arch == 'aarch64' && 'ubuntu-24.04-arm' || 'ubuntu-24.04' }}
704+
container: ascendai/cann:${{ matrix.chip_type == '910b' && '8.3.rc1.alpha001-910b-openeuler22.03-py3.11' || '8.3.rc1.alpha001-310p-openeuler22.03-py3.11' }}
705+
steps:
706+
- name: Checkout
707+
uses: actions/checkout@v4
708+
with:
709+
fetch-depth: 0
710+
711+
- name: Dependencies
712+
run: |
713+
yum update -y
714+
yum install -y git gcc gcc-c++ make cmake libcurl-devel
715+
git config --global --add safe.directory "$GITHUB_WORKSPACE"
716+
717+
- name: Build
718+
run: |
719+
export LD_LIBRARY_PATH=${ASCEND_TOOLKIT_HOME}/lib64:${ASCEND_TOOLKIT_HOME}/$(uname -m)-linux/devlib/:${LD_LIBRARY_PATH}
720+
721+
cmake -S . -B build \
722+
-DCMAKE_BUILD_TYPE=${{ matrix.build }} \
723+
-DGGML_CANN=on \
724+
-DSOC_TYPE=ascend${{ matrix.chip_type }}
725+
cmake --build build -j $(nproc)
726+
727+
- name: Determine tag name
728+
id: tag
729+
uses: ./.github/actions/get-tag-name
730+
731+
- name: Pack artifacts
732+
run: |
733+
cp LICENSE ./build/bin/
734+
zip -r llama-${{ steps.tag.outputs.name }}-bin-${{ matrix.chip_type }}-openEuler-${{ matrix.arch }}.zip ./build/bin/*
735+
736+
- name: Upload artifacts
737+
uses: actions/upload-artifact@v4
738+
with:
739+
path: llama-${{ steps.tag.outputs.name }}-bin-${{ matrix.chip_type }}-openEuler-${{ matrix.arch }}.zip
740+
name: llama-${{ steps.tag.outputs.name }}-bin-${{ matrix.chip_type }}-openEuler-${{ matrix.arch }}
741+
696742
release:
697743
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
698744

@@ -714,6 +760,7 @@ jobs:
714760
- macOS-arm64
715761
- macOS-x64
716762
- ios-xcode-build
763+
- openEuler-cann
717764

718765
steps:
719766
- name: Clone

0 commit comments

Comments
 (0)