searchusermenu
  • 发布文章
  • 消息中心
点赞
收藏
评论
分享
原创

Mindspore-r2.3版本编译

2024-06-24 09:35:35
26
0

准备工作

下载官方mindspore的基础镜像

启动容器后,在容器中安装mindspore所需的cmake等编译环境:

 
# 替换源
sed -i 's/ports.ubuntu.com/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list

# 安装执行命令
pip install wheel
pip install -U setuptools

apt-get update
apt-get upgrade -y
apt-get install git tcl patch libnuma-dev flex -y

# git lfs
apt-get install curl -y
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
apt-get install git-lfs -y
git lfs install

# cmake
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | apt-key add -

# lsb-release
apt-get install lsb-release -y

# apt-add
apt-get install software-properties-common -y
apt-add-repository "deb https://apt.kitware.com/ubuntu/ $(lsb_release -cs) main"

# cmake依赖
apt install autoconf libtool -y

apt-get install cmake -y

# 拉代码
git clone -b r2.2.12 https://gitee.com/mindspore/mindspore.git
cd mindspore
# 修改cmake的variables

bash build.sh -e ascend -V 910b -S on -j16

# 在其他镜像中挂载mindspore,然后通过pip install文件夹output下的whl来覆盖安装版本

 

环境变量

与2.2不同,不需要更改cmake中得到CANN环境变量

# CANN packages
set(ASCEND_CANN_RUNTIME_PATH ${ASCEND_PATH}/latest/lib64)
set(ASCEND_CANN_OPP_PATH ${ASCEND_PATH}/latest/opp/built-in/op_impl/ai_core/tbe/op_tiling/lib/linux)
set(ASCEND_CANN_OPP_AARCH64_PATH ${ASCEND_CANN_OPP_PATH}/aarch64)
set(ASCEND_CANN_OPP_X86_64_PATH ${ASCEND_CANN_OPP_PATH}/x86_64)
set(ASCEND_CANN_PLUGIN_PATH ${ASCEND_CANN_RUNTIME_PATH}/plugin/opskernel)
set(ASCEND_CANN_AICPU_KERNEL_PATH ${ASCEND_PATH}/latest/opp/built-in/op_impl/aicpu/aicpu_kernel)

需要注入一个关键的环节变量

# 注入环境变量
export ASCEND_CUSTOM_PATH=/usr/local/Ascend/ascend-toolkit/

由于目前CANN版本和ms2.3不兼容,所以需要更改events的类型

 

编译成功样例

0条评论
作者已关闭评论
朱****程
6文章数
0粉丝数
朱****程
6 文章 | 0 粉丝
朱****程
6文章数
0粉丝数
朱****程
6 文章 | 0 粉丝
原创

Mindspore-r2.3版本编译

2024-06-24 09:35:35
26
0

准备工作

下载官方mindspore的基础镜像

启动容器后,在容器中安装mindspore所需的cmake等编译环境:

 
# 替换源
sed -i 's/ports.ubuntu.com/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list

# 安装执行命令
pip install wheel
pip install -U setuptools

apt-get update
apt-get upgrade -y
apt-get install git tcl patch libnuma-dev flex -y

# git lfs
apt-get install curl -y
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
apt-get install git-lfs -y
git lfs install

# cmake
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | apt-key add -

# lsb-release
apt-get install lsb-release -y

# apt-add
apt-get install software-properties-common -y
apt-add-repository "deb https://apt.kitware.com/ubuntu/ $(lsb_release -cs) main"

# cmake依赖
apt install autoconf libtool -y

apt-get install cmake -y

# 拉代码
git clone -b r2.2.12 https://gitee.com/mindspore/mindspore.git
cd mindspore
# 修改cmake的variables

bash build.sh -e ascend -V 910b -S on -j16

# 在其他镜像中挂载mindspore,然后通过pip install文件夹output下的whl来覆盖安装版本

 

环境变量

与2.2不同,不需要更改cmake中得到CANN环境变量

# CANN packages
set(ASCEND_CANN_RUNTIME_PATH ${ASCEND_PATH}/latest/lib64)
set(ASCEND_CANN_OPP_PATH ${ASCEND_PATH}/latest/opp/built-in/op_impl/ai_core/tbe/op_tiling/lib/linux)
set(ASCEND_CANN_OPP_AARCH64_PATH ${ASCEND_CANN_OPP_PATH}/aarch64)
set(ASCEND_CANN_OPP_X86_64_PATH ${ASCEND_CANN_OPP_PATH}/x86_64)
set(ASCEND_CANN_PLUGIN_PATH ${ASCEND_CANN_RUNTIME_PATH}/plugin/opskernel)
set(ASCEND_CANN_AICPU_KERNEL_PATH ${ASCEND_PATH}/latest/opp/built-in/op_impl/aicpu/aicpu_kernel)

需要注入一个关键的环节变量

# 注入环境变量
export ASCEND_CUSTOM_PATH=/usr/local/Ascend/ascend-toolkit/

由于目前CANN版本和ms2.3不兼容,所以需要更改events的类型

 

编译成功样例

文章来自个人专栏
数据
4 文章 | 1 订阅
0条评论
作者已关闭评论
作者已关闭评论
0
0