Skip to content

Commit 6861f65

Browse files
authored
CANN: update docker images to 8.5.0 and improve CANN.md (ggml-org#20801)
* cann: update docker images to 8.5.0 - bump CANN base image from 8.3.rc2 to 8.5.0 - bump ASCEND_VERSION from 8.1.RC1.alpha001 to 8.5.0 Move to newer stable releases. * cann: update CANN.md * Update CANN.md to include BF16 support Added BF16 support information to the CANN documentation and corrected formatting for the installation instructions. * Fix formatting issues in CANN.md Fix 234: Trailing whitespace
1 parent 1743d98 commit 6861f65

5 files changed

Lines changed: 82 additions & 58 deletions

File tree

.devops/cann.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
# Define the CANN base image for easier version updates later
66
ARG CHIP_TYPE=910b
7-
ARG CANN_BASE_IMAGE=quay.io/ascend/cann:8.3.rc2-${CHIP_TYPE}-openeuler24.03-py3.11
7+
ARG CANN_BASE_IMAGE=quay.io/ascend/cann:8.5.0-${CHIP_TYPE}-openeuler24.03-py3.11
88

99
# ==============================================================================
1010
# BUILD STAGE

.devops/llama-cli-cann.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG ASCEND_VERSION=8.1.RC1.alpha001-910b-openeuler22.03-py3.10
1+
ARG ASCEND_VERSION=8.5.0-910b-openeuler22.03-py3.10
22

33
FROM ascendai/cann:$ASCEND_VERSION AS build
44

.github/workflows/build-cann.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
- name: Set container image
6464
id: cann-image
6565
run: |
66-
image="ascendai/cann:${{ matrix.chip_type == '910b' && '8.3.rc2-910b-openeuler24.03-py3.11' || '8.3.rc2-310p-openeuler24.03-py3.11' }}"
66+
image="ascendai/cann:${{ matrix.chip_type == '910b' && '8.5.0-910b-openeuler24.03-py3.11' || '8.5.0-310p-openeuler24.03-py3.11' }}"
6767
echo "image=${image}" >> "${GITHUB_OUTPUT}"
6868
6969
- name: Pull container image

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -907,7 +907,7 @@ jobs:
907907
- name: Set container image
908908
id: cann-image
909909
run: |
910-
image="ascendai/cann:${{ matrix.chip_type == '910b' && '8.3.rc2-910b-openeuler24.03-py3.11' || '8.3.rc2-310p-openeuler24.03-py3.11' }}"
910+
image="ascendai/cann:${{ matrix.chip_type == '910b' && '8.5.0-910b-openeuler24.03-py3.11' || '8.5.0-310p-openeuler24.03-py3.11' }}"
911911
echo "image=${image}" >> "${GITHUB_OUTPUT}"
912912
913913
- name: Pull container image

docs/backend/CANN.md

Lines changed: 78 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,22 @@ The llama.cpp CANN backend is designed to support Ascend NPU. It utilize the abi
4242

4343
### Ascend NPU
4444

45-
**Verified devices**
45+
You can retrieve your Ascend device IDs using the following command:
4646

47-
| Ascend NPU | Status |
48-
|:-----------------------------:|:-------:|
49-
| Atlas 300T A2 | Support |
50-
| Atlas 300I Duo | Support |
47+
```sh
48+
lspci -n | grep -Eo '19e5:d[0-9a-f]{3}' | cut -d: -f2
49+
```
50+
51+
**Devices**
52+
53+
| Device Id | Product Series | Product Models | Chip Model | Verified Status |
54+
|:---------:|----------------|----------------|:----------:|:---------------:|
55+
| d803 | Atlas A3 Train | | 910C | |
56+
| d803 | Atlas A3 Infer | | 910C | |
57+
| d802 | Atlas A2 Train | | 910B | |
58+
| d802 | Atlas A2 Infer | Atlas 300I A2 | 910B | Support |
59+
| d801 | Atlas Train | | 910 | |
60+
| d500 | Atlas Infer | Atlas 300I Duo | 310P | Support |
5161

5262
*Notes:*
5363

@@ -57,6 +67,9 @@ The llama.cpp CANN backend is designed to support Ascend NPU. It utilize the abi
5767

5868
## Model Supports
5969

70+
<details>
71+
<summary>Text-only</summary>
72+
6073
| Model Name | FP16 | Q4_0 | Q8_0 |
6174
|:----------------------------|:-----:|:----:|:----:|
6275
| Llama-2 ||||
@@ -118,8 +131,11 @@ The llama.cpp CANN backend is designed to support Ascend NPU. It utilize the abi
118131
| Trillion-7B-preview ||||
119132
| Ling models ||||
120133

134+
</details>
135+
136+
<details>
137+
<summary>Multimodal</summary>
121138

122-
**Multimodal**
123139
| Model Name | FP16 | Q4_0 | Q8_0 |
124140
|:----------------------------|:-----:|:----:|:----:|
125141
| LLaVA 1.5 models, LLaVA 1.6 models | x | x | x |
@@ -134,15 +150,22 @@ The llama.cpp CANN backend is designed to support Ascend NPU. It utilize the abi
134150
| GLM-EDGE ||||
135151
| Qwen2-VL ||||
136152

153+
</details>
154+
137155

138156

139157
## DataType Supports
140158

141-
| DataType | Status |
142-
|:----------------------:|:-------:|
143-
| FP16 | Support |
144-
| Q8_0 | Support |
145-
| Q4_0 | Support |
159+
| DataType | 910B | 310P |
160+
|:----------------------:|:-------:|:-------:|
161+
| FP16 | Support | Support |
162+
| Q8_0 | Support | Partial |
163+
| Q4_0 | Support | Partial |
164+
| BF16 | Support | |
165+
166+
> **310P note**
167+
> - `Q8_0`: data transform / buffer path is implemented, and `GET_ROWS` is supported, but quantized `MUL_MAT` / `MUL_MAT_ID` are not supported.
168+
> - `Q4_0`: data transform / buffer path is implemented, but quantized `MUL_MAT` / `MUL_MAT_ID` are not supported.
146169
147170
## Docker
148171

@@ -160,7 +183,20 @@ npu-smi info
160183

161184
# Select the cards that you want to use, make sure these cards are not used by someone.
162185
# Following using cards of device0.
163-
docker run --name llamacpp --device /dev/davinci0 --device /dev/davinci_manager --device /dev/devmm_svm --device /dev/hisi_hdc -v /usr/local/dcmi:/usr/local/dcmi -v /usr/local/bin/npu-smi:/usr/local/bin/npu-smi -v /usr/local/Ascend/driver/lib64/:/usr/local/Ascend/driver/lib64/ -v /usr/local/Ascend/driver/version.info:/usr/local/Ascend/driver/version.info -v /PATH_TO_YOUR_MODELS/:/app/models -it llama-cpp-cann -m /app/models/MODEL_PATH -ngl 32 -p "Building a website can be done in 10 simple steps:"
186+
docker run --name llamacpp \
187+
--device /dev/davinci0 \
188+
--device /dev/davinci_manager \
189+
--device /dev/devmm_svm \
190+
--device /dev/hisi_hdc \
191+
-v /usr/local/dcmi:/usr/local/dcmi \
192+
-v /usr/local/bin/npu-smi:/usr/local/bin/npu-smi \
193+
-v /usr/local/Ascend/driver/lib64/:/usr/local/Ascend/driver/lib64/ \
194+
-v /usr/local/Ascend/driver/version.info:/usr/local/Ascend/driver/version.info \
195+
-v /PATH_TO_YOUR_MODELS/:/app/models \
196+
-it llama-cpp-cann \
197+
-m /app/models/MODEL_PATH \
198+
-ngl 32 \
199+
-p "Building a website can be done in 10 simple steps:"
164200
```
165201

166202
*Notes:*
@@ -171,69 +207,57 @@ docker run --name llamacpp --device /dev/davinci0 --device /dev/davinci_manager
171207

172208
### I. Setup Environment
173209

174-
1. **Install Ascend Driver and firmware**
210+
1. **Configure Ascend user and group**
175211

176212
```sh
177-
# create driver running user.
178-
sudo groupadd -g HwHiAiUser
213+
sudo groupadd HwHiAiUser
179214
sudo useradd -g HwHiAiUser -d /home/HwHiAiUser -m HwHiAiUser -s /bin/bash
180215
sudo usermod -aG HwHiAiUser $USER
181-
182-
# download driver from https://www.hiascend.com/hardware/firmware-drivers/community according to your system
183-
# and install driver.
184-
sudo sh Ascend-hdk-910b-npu-driver_x.x.x_linux-{arch}.run --full --install-for-all
185216
```
186217

187-
Once installed, run `npu-smi info` to check whether driver is installed successfully.
188-
```sh
189-
+-------------------------------------------------------------------------------------------+
190-
| npu-smi 24.1.rc2 Version: 24.1.rc2 |
191-
+----------------------+---------------+----------------------------------------------------+
192-
| NPU Name | Health | Power(W) Temp(C) Hugepages-Usage(page)|
193-
| Chip | Bus-Id | AICore(%) Memory-Usage(MB) HBM-Usage(MB) |
194-
+======================+===============+====================================================+
195-
| 2 xxx | OK | 64.4 51 15 / 15 |
196-
| 0 | 0000:01:00.0 | 0 1873 / 15077 0 / 32768 |
197-
+======================+===============+====================================================+
198-
| 5 xxx | OK | 64.0 52 15 / 15 |
199-
| 0 | 0000:81:00.0 | 0 1874 / 15077 0 / 32768 |
200-
+======================+===============+====================================================+
201-
| No running processes found in NPU 2 |
202-
+======================+===============+====================================================+
203-
| No running processes found in NPU 5 |
204-
+======================+===============+====================================================+
205-
```
218+
2. **Install dependencies**
206219

207-
2. **Install Ascend Firmware**
220+
**Ubuntu/Debian:**
208221
```sh
209-
# download driver from https://www.hiascend.com/hardware/firmware-drivers/community according to your system
210-
# and install driver.
211-
sudo sh Ascend-hdk-910b-npu-firmware_x.x.x.x.X.run --full
222+
sudo apt-get update
223+
sudo apt-get install -y gcc python3 python3-pip linux-headers-$(uname -r)
212224
```
213-
If the following message appears, firmware is installed successfully.
225+
226+
**RHEL/CentOS:**
214227
```sh
215-
Firmware package installed successfully!
228+
sudo yum makecache
229+
sudo yum install -y gcc python3 python3-pip kernel-headers-$(uname -r) kernel-devel-$(uname -r)
216230
```
217231

232+
3. **Install CANN (driver + toolkit)**
218233

219-
3. **Install CANN toolkit and kernels**
234+
> The `Ascend-cann` package includes both the driver and toolkit.
235+
> `$ARCH` can be `x86_64` or `aarch64`, `$CHIP` can be `910b` or `310p`.
220236

221-
CANN toolkit and kernels can be obtained from the official [CANN Toolkit](https://www.hiascend.com/zh/developer/download/community/result?module=cann) page.
237+
```sh
238+
wget https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/CANN/CANN%208.5.T63/Ascend-cann_8.5.0_linux-$ARCH.run
239+
sudo bash ./Ascend-cann_8.5.0_linux-$ARCH.run --install
240+
241+
wget https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/CANN/CANN%208.5.T63/Ascend-cann-$CHIP-ops_8.5.0_linux-$ARCH.run
242+
sudo bash ./Ascend-cann-$CHIP-ops_8.5.0_linux-$ARCH.run --install
243+
```
244+
245+
4. **Verify installation**
222246

223-
Please download the corresponding version that satified your system. The minimum version required is 8.0.RC2.alpha002 and here is the install command.
224247
```sh
225-
pip3 install attrs numpy decorator sympy cffi pyyaml pathlib2 psutil protobuf scipy requests absl-py wheel typing_extensions
226-
sh Ascend-cann-toolkit_8.0.RC2.alpha002_linux-aarch64.run --install
227-
sh Ascend-cann-kernels-910b_8.0.RC2.alpha002_linux.run --install
248+
npu-smi info
228249
```
229250

230-
Set Ascend Variables:
251+
If device information is displayed correctly, the driver is functioning properly.
252+
231253
```sh
232-
echo "source ~/Ascend/ascend-toolkit/set_env.sh" >> ~/.bashrc
233-
source ~/.bashrc
254+
# Set environment variables (adjust path if needed)
255+
source /usr/local/Ascend/cann/set_env.sh
256+
257+
python3 -c "import acl; print(acl.get_soc_name())"
234258
```
235259

236-
Upon a successful installation, CANN is enabled for the available ascend devices.
260+
If the command outputs the chip model, the installation was successful.
237261

238262
### II. Build llama.cpp
239263

0 commit comments

Comments
 (0)