使用华为云服务器
cpu: 16vCPUs Kunpeng 920
内存:16GiB
gpu:'4* HUAWEI Ascend 310
cann: 20.1.rc1
操作系统:Ubuntu aarch64
目的
使用该服务器进行docker镜像编译,测试模型。
已知生产环境:mindx版本为3.0.rc3,npu为310P,cpu为 Kunpeng 920
宿主机cann升级
cann下载地址:https://www.hiascend.com/developer/download/community/result?module=dl+pt+cann&dl=3.0.0.alpha&pt=6.0.1.alpha001&cann=6.0.1.alpha001
npu驱动下载地址:
https://www.hiascend.com/hardware/firmware-drivers/community?product=2&model=2&cann=6.3.RC1.alpha001&driver=1.0.18.alpha
升级cann和驱动
chmod +x Ascend-cann-toolkit_6.0.1_linux-aarch64.run
./Ascend-cann-toolkit_6.0.1_linux-aarch64.run --install --install-for-all
rebootchmod +x A300-3000-npu-driver_6.0.0_linux-aarch64.run
./A300-3000-npu-driver_6.0.0_linux-aarch64.run --full --install-for-all
reboot查看是否升级成功
npu-smi info
华为云安装docker
docker插件下载地址:https://gitee.com/ascend/ascend-docker-runtime
vi /etc/apt/sources.list
deb https://mirrors.huaweicloud.com/docker-ce/linux/ubuntu/ bionic stable
curl -fsSL https://repo.huaweicloud.com/docker-ce/linux/debian/gpg | sudo apt-key add -
apt-get update
apt-get install -y docker-ce
systemctl start docker
docker version
chmod +x Ascend-docker-runtime_5.0.RC3.1_linux-aarch64.run
./Ascend-docker-runtime_5.0.RC3.1_linux-aarch64.run --install
systemctl restart docker
systemctl enable docker
寻找huawei docker基础镜像
ascendhub.huawei.com
比如 https://ascendhub.huawei.com/#/detail/infer-modelzoo
注意:拉取镜像权限密钥24小时过期,需重新申请。
后续
在基础镜像上,尝试程序编译,调试。
成功后,对应编辑Dockerfile文件,重新打镜像。
比如:
FROM ascendhub.huawei.com/public-ascendhub/infer-modelzoo:22.0.0
EXPOSE 80
USER root
COPY ./ /home/cloud/
WORKDIR /home/cloud/
RUN apt update \&& apt install python3.8 python3.8-dev python3.8-distutils python3.8-venv -y \&& python3.8 /home/cloud/get-pip.py \&& python3.8 -m pip install -r /home/cloud/requirements.txt -i https://mirror.baidu.com/pypi/simple
ENV LD_PRELOAD /usr/local/lib/python3.8/dist-packages/torch/lib/libgomp-d22c30c5.so.1
CMD ["/usr/bin/python3.8","/home/cloud/xxxx.py"]