本文主要是介绍华为Atlas 300I 推理卡显卡安装,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
华为Atlas 300I 推理卡显卡安装
参考链接:
https://support.huawei.com/enterprise/zh/doc/EDOC1100115618/c5bac9d1
- 确认操作系统
查询服务器当前运行环境的操作系统架构及版本
uname -m && cat /etc/*release
- 获取软件包
下载对应版本的包
A800-3000-NPU-CentOS7.6-ARM-V1.4.3.run
NPU 1.X.X 软件包版本类型
创建运行用户
root用户下执行
groupadd HwHiAiUser
useradd -g HwHiAiUser -d /home/HwHiAiUser -m HwHiAiUser -s /bin/bash确认安装方式
uname -r
gcc -v
lsmod|grep drv_pcie_host
lspci | grep d100
- 安装驱动(适用于.run格式)
安装NPU 1.X.X系列版本驱动包
切换至root用户
su root
进入软件包所在路径
cd /data/soft/
增加软件包的可执行权限
chmod +x A800-3000-NPU-CentOS7.6-ARM-V1.4.3.run
校验run安装包的一致性和完整性
./A800-3000-NPU-CentOS7.6-ARM-V1.4.3.run --check
打印如下:
Verifying archive integrity... 100% MD5 checksums are OK. All good.
未指定安装路径:默认安装
如果用户不需要指定安装路径,安装包会安装到默认路径“/usr/local/HiAI”下
安装命令:
./A800-3000-NPU-CentOS7.6-ARM-V1.4.3.run --full
如果提示安装成功,需要重启时: reboot,没有提示要重启,就不需要重启
查看驱动加载是否成功
npu-smi info
- 安装固件(适用于.run格式)
使用NPU 1.X.X系列版本软件包安装时,固件包集成在驱动包内,安装或升级驱动过程中会自动安装和升级固件。
npu-smi -v
npu-smi info
npu-smi info -l
npu-smi info watch -i 0 -c 2 -d 5 -s ptaicmb
NPU 1.X.X 软件包版本 不支持docker容器内安装,卸载完,安装 NPU 20.2.X
- 卸载驱动(适用于.run格式)
卸载NPU 1.X.X系列版本驱动
su root
cd /data/soft
./A800-3000-NPU-CentOS7.6-ARM-V1.4.3.run --uninstall
卸载固件(适用于.run格式)
卸载NPU 1.X.X系列版本软件包时,固件包集成在驱动包内,卸载驱动会自动卸载固件。
- 安装NPU 20.X.X
A300-3000-3010-npu-driver_20.2.2_centos7.6-aarch64.run
创建运行用户
root用户下执行
groupadd HwHiAiUser
useradd -g HwHiAiUser -d /home/HwHiAiUser -m HwHiAiUser -s /bin/bash
- 安装NPU 20.X.X及以上系列版本驱动包
切换至root用户
su root
进入软件包所在路径
cd /data/soft/
增加软件包的可执行权限
chmod +x A300-3000-3010-npu-driver_20.2.2_centos7.6-aarch64.run
校验run安装包的一致性和完整性
./A300-3000-3010-npu-driver_20.2.2_centos7.6-aarch64.run --check
打印如下:
Verifying archive integrity... 100% SHA256 checksums are OK. All good.
未指定安装路径:默认安装
如果用户不需要指定安装路径,软件包默认安装路径:/usr/local/Ascend
安装详细日志路径:/var/log/ascend_seclog/ascend_install.log。
安装命令:
./A300-3000-3010-npu-driver_20.2.2_centos7.6-aarch64.run --full安装提示: 驱动包安装成功! 安装/升级需要重启才能生效!
Driver package install success! Reboot needed for installation/upgrade to take effect! 重启
reboot查看驱动加载是否成功
npu-smi info
显示如下:npu-smi 20.2.2 Version: 20.2.2 查看芯片固件版本号请执行
/usr/local/Ascend/driver/tools/upgrade-tool --device_index -1 --component -1 --version
- 安装固件(适用于.run格式)
切换至root用户
su root
进入软件包所在路径
cd /data/soft/
增加软件包的可执行权限
chmod +x A300-3000-3010-npu-firmware_1.76.22.10.220.run
校验run安装包的一致性和完整性./A300-3000-3010-npu-firmware_1.76.22.10.220.run --check
打印如下:
Verifying archive integrity... 100% SHA256 checksums are OK. All good.安装命令
./A300-3000-3010-npu-firmware_1.76.22.10.220.run --full
提示: 固件包安装成功! 安装/升级需要重启才能生效!
Firmware package install success! Reboot needed for installation/upgrade to take effect! 重启
reboot执行如下命令查看芯片固件版本号。若与目标版本一致,则说明安装成功。
/usr/local/Ascend/driver/tools/upgrade-tool --device_index -1 --component -1 --version
- Docker 容器安装
宿主机目录挂载容器
前提条件
宿主机已经安装过Driver软件包。
需用户在宿主机自行安装docker(使用NPU 20.0.X和NPU 20.1.X系列版本软件包安装时,版本要求大于等于18.03)。
docker pull ubuntu:18.04
docker imagesid HwHiAiUser
gid=1001(HwHiAiUser)在宿主机创建并启动docker容器
使用NPU 20.2.X及以上系列版本软件包安装时,请执行如下命令:
docker run -it --net=host --cap-add LINUX_IMMUTABLE --device=/dev/davinci0 --device=/dev/davinci_manager --device=/dev/devmm_svm --device=/dev/hisi_hdc -v /usr/local/bin/npu-smi:/usr/local/bin/npu-smi -v /usr/local/Ascend/driver/lib64/:/usr/local/Ascend/driver/lib64/ ubuntu:18.04 /bin/bashls /dev/ | grep davinci*groupadd -g 1001 HwHiAiUser && useradd -g HwHiAiUser -d /home/HwHiAiUser -m HwHiAiUser && echo ok使用NPU 20.2.X及以上系列版本软件包安装时,执行如下命令:
export LD_LIBRARY_PATH=/usr/local/Ascend/driver/lib64:$LD_LIBRARY_PATH查看驱动加载是否成功
npu-smi info
显示如下成功:npu-smi 20.2.2 Version: 20.2.2
宿主机目录不挂载容器
前提条件
宿主机已经安装过Driver软件包。
需用户在宿主机自行安装docker(使用NPU 20.0.X和NPU 20.1.X系列版本软件包安装时,版本要求大于等于18.03)。
docker run -it --net=host --pid=host --cap-add LINUX_IMMUTABLE --device=/dev/davinci0 --device=/dev/davinci_manager --device=/dev/devmm_svm --device=/dev/hisi_hdc -v /usr/local/bin/npu-smi:/usr/local/bin/npu-smi -v /data:/data ubuntu:18.04 /bin/bashgroupadd -g 1001 HwHiAiUser && useradd -g HwHiAiUser -d /home/HwHiAiUser -m HwHiAiUser && echo okdocker ps -a
docker cp /xxx/*.run container_id:/home/HwHiAiUser/software
docker cp /data/soft/A300-3000-3010-npu-driver_20.2.2_centos7.6-aarch64.run f621f77c310c:/home/HwHiAiUser/driverdocker start f621f77c310c
docker attach f621f77c310ccd /home/HwHiAiUser/
安装命令./driver --docker使用NPU 20.2.X及以上系列版本软件包安装时,执行如下命令:
export LD_LIBRARY_PATH=/usr/local/Ascend/driver/lib64:$LD_LIBRARY_PATH查看驱动加载是否成功
npu-smi info
显示如下成功:npu-smi 20.2.2 Version: 20.2.2docker run -it \
--device=/dev/davinci0 \
--device=/dev/davinci_manager \
--device=/dev/devmm_svm \
--device=/dev/hisi_hdc \
-v /usr/local/bin/npu-smi:/usr/local/bin/npu-smi \
-v /usr/local/Ascend/driver:/usr/local/Ascend/driver \
-v /data:/data \
ascendhub.huawei.com/public-ascendhub/ascend-infer-arm:20.2.0 \
/bin/bashdocker run -it \
--device=/dev/davinci0 \
--device=/dev/davinci_manager \
--device=/dev/devmm_svm \
--device=/dev/hisi_hdc \
-v /usr/local/Ascend/driver:/usr/local/Ascend/driver \
-v /usr/local/bin/npu-smi:/usr/local/bin/npu-smi \
-v /data:/data ascendhub.huawei.com/public-ascendhub/ascend-infer:5.0.1-ubuntu18.04 \
/bin/bash
ai开源项目地址
https://gitee.com/ascend/samples
亮哥安装
cat /etc/redhat-release
CentOS Linux release 7.6.1810 (AltArch) uname -a
Linux localhost.localdomain 4.14.0-115.el7a.0.1.aarch64 #1 SMP Sun Nov 25 20:54:21 UTC 2018 aarch64 aarch64 aarch64 GNU/Linuxcat /etc/sysconfig/network-scripts/ifcfg-enp125s0f0
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=enp125s0f0
UUID=c7f2acd8-f7d5-4ed7-a047-157326b16284
DEVICE=enp125s0f0
ONBOOT=yes
IPADDR=192.168.141.77
PREFIX=24
GATEWAY=192.168.141.254
DNS1=192.168.141.155
IPV6_PRIVACY=no
ZONE=publicsystemctl restart networkuname -m && cat /etc/*release./A300-3000-3010-npu-driver_21.0.1_linux-aarch64.run --install-username=root --install-usergroup=root --install-for-all --fullreboot./A300-3000-3010-npu-firmware_1.77.22.6.220.run --full/usr/local/Ascend/driver/tools/upgrade-tool --device_index -1 --component -1 --version./Ascend-cann-toolkit_3.3.0_linux-aarch64.run --install-for-all./Ascend-cann-toolkit_3.3.0_linux-aarch64.run --install./Ascend-cann-toolkit_3.3.0_linux-aarch64.run --install --install-for-alluseradd -d /home/HwHiAiUser -m HwHiAiUser
passwd HwHiAiUser
chmod u+w /etc/sudoers
vim /etc/sudoers
root ALL=(ALL) ALLchmod u-w /etc/sudoers
gcc -Vyum install -y gcc g++ make cmake zlib1g zlib1g libsqlite3 openssl libssl-dev libffi unzip pciutils net-tools libblas gfortran libblas3 libopenblas
gcc -V
gcc --version./Ascend-cann-toolkit_3.3.0_linux-aarch64.run --installtar -zxvf Python-3.7.5.tgz
cd Python-3.7.5./configure --prefix=/usr/local/python3.7.5 --enable-loadable-sqlite-extensions --enable-shared
make -j8make install
yum -y install zlib*
make installpython3.7.5
sudo ln -s /usr/local/python3.7.5/bin/python3 /usr/local/python3.7.5/bin/python3.7.5
sudo ln -s /usr/local/python3.7.5/bin/pip3 /usr/local/python3.7.5/bin/pip3.7.5
vim /etc/profile
#用于设置python3.7.5库文件路径
export LD_LIBRARY_PATH=/usr/local/python3.7.5/lib:$LD_LIBRARY_PATH
#如果用户环境存在多个python3版本,则指定使用python3.7.5版本
export PATH=/usr/local/python3.7.5/bin:$PATHsource /etc/profilepip3.7.5 install attrspip3.7.5 install psutil
pip3.7.5 install decorator
pip3.7.5 install numpy
pip3.7.5 install protobuf==3.11.3
pip3.7.5 list
pip3.7.5 install attrs -i https://pypi.tuna.tsinghua.edu.cn/simple
yum -y install openssl openssl-devel
make -j8
make --installmake install
pip3.7.5 install attrs -i https://pypi.tuna.tsinghua.edu.cn/simple./configure --prefix=/usr/local/python3.7.5 --enable-loadable-sqlite-extensions --enable-shared
make -j8
make install
pip3.7.5 install attrs -i https://pypi.tuna.tsinghua.edu.cn/simple
pip3.7.5 install psutil -i https://pypi.tuna.tsinghua.edu.cn/simple
pip3.7.5 install psutil
yum install libffi-devel
pip3.7.5 install psutil
./configure --prefix=/usr/local/python3.7.5 --enable-loadable-sqlite-extensions --enable-shared
make -j8make install
pip3.7.5 install psutilpip3.7.5 install decorator numpy protobuf==3.11.3 scipy sympy cffi grpcio grpcio-tools requests -i https://pypi.tuna.tsinghua.edu.cn/simple
pip3.7.5 install decorator numpy==1.21.0 protobuf==3.11.3 scipy sympy cffi grpcio grpcio-tools requests -i https://pypi.tuna.tsinghua.edu.cn/simple
yum install gfortran libopenblas-dev liblapack-dev libatlas-base-dev libblas-dev
pip3 install Cython
pip3.7.5 install decorator numpy==1.21.0 protobuf==3.11.3 scipy sympy cffi grpcio grpcio-tools requests -i https://pypi.tuna.tsinghua.edu.cn/simple
pip3 install numpy./Ascend-cann-toolkit_3.3.0_linux-aarch64.run --install
vim /var/log/ascend_seclog/ascend_toolkit_install.log
groupadd usergroup
useradd -g usergroup -d /home/HwHiAiUser -m HwHiAiUser -s /bin/bash
usermod -g root HwHiAiUser
vim /etc/passwd
HwHiAiUser:x:1000:1002::/home/HwHiAiUser:/bin/bashcd anaconda-ks.cfg ./Ascend-cann-toolkit_3.3.0_linux-aarch64.run install
./Ascend-cann-toolkit_3.3.0_linux-aarch64.run --install-for-all
./Ascend-cann-toolkit_3.3.0_linux-aarch64.run --installmkdir Ascend
./Ascend-cann-toolkit_3.3.0_linux-aarch64.run --install --install-path=/root/Ascend/./Ascend-cann-toolkit_3.3.0_linux-aarch64.run --install --install-path=/root/Ascend/groupadd -g 1001 HwHiAiUser && useradd -g HwHiAiUser -d /home/HwHiAiUser -m HwHiAiUser && echo ok
./Ascend-cann-toolkit_3.3.0_linux-aarch64.run --install
userdel -r HwHiAiUser
groupadd -g 1001 HwHiAiUser
userdel -r HwHiAiUser
kill -9 1
userdel -r HwHiAiUser
usermod -g 1001 HwHiAiUser
userdel -r HwHiAiUser
chmod u+w /etc/sudoersvim /etc/sudoers
chmod u-w /etc/sudoers
usermod -g 1001 HwHiAiUseruserdel -r HwHiAiUser
groupadd -g HwHiAiUser HwHiAiUser
groups root
groups 1001
groups HwHiAiUser
vim /etc/group
HwHiAiUser:x:1002:groups HwHiAiUser
gpasswd -d HwHiAiUser root
groups HwHiAiUser
userdel -r HwHiAiUser
reboot
npu-smi infoyum install g++
yum install gcc
yum install cmake
yum install -y cmake3
yum install -y gcc gcc-c++ make automake
strings /usr/lib64/libstdc++.so.6 | grep GLIBC
yum install gcc
curl -Lks http://www.hop5.in/yum/el6/hop5.repo > /etc/yum.repos.d/hop5.repo
yum install gcc gcc-g++ -ywget https://cmake.org/files/v3.10/cmake-3.10.0-rc3.tar.gz
yum install -y wget
tar -zxvf cmake-3.10.0-rc3.tar.gz
cd cmake-3.10.0-rc3/
./bootstrap
gmake
gmake install./Ascend-cann-toolkit_3.3.0_linux-aarch64.run --install
docker ps
docker exec -it f1aaffa8be63 bashcd /root/cann
ls
A300-3000-3010-npu-driver_21.0.1_linux-aarch64.run A300-3010-mcu_20.1.1.zip Ascend-cann-device-sdk_3.3.0_linux-aarch64.zip Ascend-cann-toolkit_3.3.0_linux-aarch64.run
A300-3000-3010-npu-firmware_1.77.22.6.220.run A300-3010-npu-driver-repack-tools_21.0.1.tar.gz Ascend-cann-nnrt_3.3.0_linux-aarch64.run lapack-3.9.0.tar.gz
A300-3010-mcu_20.1.1.bin Ascend-cann-benchmark_3.3.0-Linux-aarch64.zip Ascend-cann-toolbox_3.3.0_linux-aarch64.run驱动和固件相关软件保存到了百度网盘
链接: https://pan.baidu.com/s/13mam2d-lEIeYWWZO_j-j_Q 密码: r9gnvim ~/.bashrc export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/Ascend/driver/lib64:/usr/local/Ascend/driver/lib64/common:/usr/local/Ascend/driver/lib64/driver:/usr/lib64
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/Ascend/ascend-toolkit/latest/fwkacllib/lib64:/usr/local/Ascend/ascend-toolkit/latest/atc/lib64
export PYTHONPATH=$PYTHONPATH:/usr/local/Ascend/ascend-toolkit/latest/fwkacllib/python/site-packages:/usr/local/Ascend/ascend-toolkit/latest/toolkit/python/site-packages:/usr/local/Ascend/ascend-toolkit/latest/atc/python/site-packages:/usr/local/Ascend/ascend-toolkit/latest/pyACL/python/site-packages/acl
export PATH=$PATH:/usr/local/Ascend/ascend-toolkit/latest/fwkacllib/ccec_compiler/bin:/usr/local/Ascend/ascend-toolkit/latest/fwkacllib/bin:/usr/local/Ascend/ascend-toolkit/latest/atc/bin
export ASCEND_AICPU_PATH=/usr/local/Ascend/ascend-toolkit/latest
export ASCEND_OPP_PATH=/usr/local/Ascend/ascend-toolkit/latest/opp
export TOOLCHAIN_HOME=/usr/local/Ascend/ascend-toolkit/latest/toolkitexport install_path=/usr/local/Ascend/ascend-toolkit/latest
export ASCEND_TENSOR_COMPLIER_INCLUDE=${install_path}/atc/include/
#/home/twai/Ascend202/ascend-toolkit/20.2/
export DDK_PATH=${install_path}/arm64-linux
export NPU_HOST_LIB=${install_path}/acllib/lib64/docker pull ubuntu:18.04
采用目录挂载方式
进入容器里
docker exec -it f1aaffa8be63 bash
cat ~/.bashrc
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/Ascend/driver/lib64:/usr/local/Ascend/driver/lib64/common:/usr/local/Ascend/driver/lib64/driver
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/Ascend/ascend-toolkit/latest/fwkacllib/lib64:/usr/local/Ascend/ascend-toolkit/latest/atc/lib64
export PYTHONPATH=$PYTHONPATH:/usr/local/Ascend/ascend-toolkit/latest/fwkacllib/python/site-packages:/usr/local/Ascend/ascend-toolkit/latest/toolkit/python/site-packages:/usr/local/Ascend/ascend-toolkit/latest/atc/python/site-packages:/usr/local/Ascend/ascend-toolkit/latest/pyACL/python/site-packages/acl
export PATH=$PATH:/usr/local/Ascend/ascend-toolkit/latest/fwkacllib/ccec_compiler/bin:/usr/local/Ascend/ascend-toolkit/latest/fwkacllib/bin:/usr/local/Ascend/ascend-toolkit/latest/atc/bin
export ASCEND_AICPU_PATH=/usr/local/Ascend/ascend-toolkit/latest
export ASCEND_OPP_PATH=/usr/local/Ascend/ascend-toolkit/latest/opp
export TOOLCHAIN_HOME=/usr/local/Ascend/ascend-toolkit/latest/toolkitexport install_path=/usr/local/Ascend/ascend-toolkit/latest
export ASCEND_TENSOR_COMPLIER_INCLUDE=${install_path}/atc/include/
#/home/twai/Ascend202/ascend-toolkit/20.2/
export DDK_PATH=${install_path}/arm64-linux
export NPU_HOST_LIB=${install_path}/acllib/lib64/cd ~/samples/python/contrib/portrait_picture/model/
原始模型网络下载地址 :
wget https://modelzoo-train-atc.obs.cn-north-4.myhuaweicloud.com/003_Atc_Models/AE/ATC%20Model/PortraitNet%20/portrait.pb
对应的cfg文件下载地址:
wget https://modelzoo-train-atc.obs.cn-north-4.myhuaweicloud.com/003_Atc_Models/AE/ATC%20Model/PortraitNet%20/insert_op.cfg执行命令报错,没有生成.om文件
atc --model=./portrait.pb --insert_op_conf=./insert_op.cfg --output="./portrait" --output_type=FP32 --input_shape="Inputs/x_input:1,224,224,3" --framework=3 --soc_version=Ascend310直接获取om模型
wget https://modelzoo-train-atc.obs.cn-north-4.myhuaweicloud.com/003_Atc_Models/AE/ATC%20Model/PortraitNet%20/portrait.om获取样例需要的测试图片
cd ../data/
wget https://c7xcode.obs.cn-north-4.myhuaweicloud.com/models/Portrait/background.jpg
wget https://c7xcode.obs.cn-north-4.myhuaweicloud.com/models/Portrait/ori.jpgcd /root/samples/python/contrib/portrait_picture
python3 src/main.py
报错: No module named 'cv2'python3.6 -m pip install opencv-python
报错: ModuleNotFoundError: No module named 'skbuild'python3.6 -m pip install scikit-build
安装成功后
python3.6 -m pip install opencv-python 在次执行: python3 src/main.py
init resource stage:
Init resource success
Init model resource start...
[Model] create model output dataset:
malloc output 0, size 401408
Create model output dataset success
Init model resource success
====ori.jpg====
in pre_process, use time:0.0037016868591308594
in inference, use time:0.006189584732055664
in post_process, use time:0.0028433799743652344
in background_replace, use time:0.09329771995544434
acl resource release all resource
dvpp resource release success
Model release source success
acl resource release stream
acl resource release context
Reset acl device 0
Release acl resource success
查看结果
ls outputs/result/ docker cp f1aaffa8be63:/root/samples/python/contrib/portrait_picture/outputs/result/ori.jpg ./
查看图片,图片的背景已经成功替换, 成功了
测试ai项目地址
https://gitee.com/ascend/samples/tree/master/python/contrib/portrait_picture
https://gitee.com/ascend/modelzoo/tree/master/contrib/TensorFlow/Research/cv/portraitnet/ATC_PortraitNet_tf_AE
这篇关于华为Atlas 300I 推理卡显卡安装的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!