上网的小藤陷入了深思~~
书接上回:https://bbs.huaweicloud.com/blogs/398503
上回说到张小白使用了上面那个网卡,完成了JupyterLab环境上resnet模型样例代码的推理。回到制卡的时候,一个网卡是写死的地址192.168.137.100,一个网卡是自动获取地址:
我们把下面那个网卡跟路由器相连接:
打开路由器管理界面,查看下开发板的IP地址:
这个时候,张小白的电脑IP可以使用ipconfig查到:192.168.199.133
路由器的IP是192.168.199.1
路由器给小藤分配的IP为192.168.199.179
使用MobaXterm配置这个地址,连接上开发板:
可以看到跟使用PC连接上面那个网口,登录的结果一样。但是再想想,其实是不一样的,因为这个时候,小藤连接上了路由器,它是可以上Internet的:
既然这样,我们是不是就可以尝试着小藤玩一下华为的昇思呢?张小白不由得深思起来。
于是打开昇思官网:https://www.mindspore.cn/install
按照上述方法真的可以安装MindSpore吗?
为了避免系统内置的演示环境受到干扰,张小白决定切换到HwHiAiUser用户:
su - HwHiAiUser
新创建一个conda环境:
conda create -n mindspore2.0 python=3.9
激活该conda环境:
conda activate mindspore2.0
将前面mindspore的安装命令复制下来进行安装:
pip install https://ms-release.obs.cn-north-4.myhuaweicloud.com/2.0.0rc1/MindSpore/unified/aarch64/mindspore-2.0.0rc1-cp39-cp39-linux_aarch64.whl --trusted-host ms-release.obs.cn-north-4.myhuaweicloud.com -i https://pypi.tuna.tsinghua.edu.cn/simple
安装完成,但是报了一些需要的依赖包没有。
查看mindspore官网安装步骤中的这段文字:
把pip的包安装一下:
pip install sympy -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install /usr/local/Ascend/ascend-toolkit/latest/lib64/te-*-py3-none-any.whl -i https://pypi.tuna.tsinghua.edu.cn/simple
这里有点俄罗斯套娃了。。。
pip install /usr/local/Ascend/ascend-toolkit/latest/lib64/schedule_search-0.1.0-py3-none-any.whl -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install /usr/local/Ascend/ascend-toolkit/latest/lib64/hccl-*-py3-none-any.whl -i https://pypi.tuna.tsinghua.edu.cn/simple
好像没有这个hccl的包。
先暂时不管这个吧。
根据安装指引,我们编辑一个shell脚本:ms_env.sh
# control log level. 0-DEBUG, 1-INFO, 2-WARNING, 3-ERROR, 4-CRITICAL, default level is WARNING.
export GLOG_v=2
# Conda environmental options
LOCAL_ASCEND=/usr/local/Ascend # the root directory of run package
# lib libraries that the run package depends on
export LD_LIBRARY_PATH=${LOCAL_ASCEND}/ascend-toolkit/latest/lib64:${LOCAL_ASCEND}/driver/lib64:${LOCAL_ASCEND}/ascend-toolkit/latest/opp/built-in/op_impl/ai_core/tbe/op_tiling:${LD_LIBRARY_PATH}
# lib libraries that the mindspore depends on, modify "pip3" according to the actual situation
export LD_LIBRARY_PATH=`pip3 show mindspore | grep Location | awk '{print $2"/mindspore/lib"}' | xargs realpath`:${LD_LIBRARY_PATH}
# Environment variables that must be configured
## TBE operator implementation tool path
export TBE_IMPL_PATH=${LOCAL_ASCEND}/ascend-toolkit/latest/opp/built-in/op_impl/ai_core/tbe
## OPP path
export ASCEND_OPP_PATH=${LOCAL_ASCEND}/ascend-toolkit/latest/opp
## AICPU path
export ASCEND_AICPU_PATH=${ASCEND_OPP_PATH}/..
## TBE operator compilation tool path
export PATH=${LOCAL_ASCEND}/ascend-toolkit/latest/compiler/ccec_compiler/bin/:${PATH}
## Python library that TBE implementation depends on
export PYTHONPATH=${TBE_IMPL_PATH}:${PYTHONPATH}
执行这个脚本:
sh ./ms_env.sh
下载样例工程:
将其传到小藤上:
cd samples
解压
unzip ascend310_single_op_sample.zip
cd /home/HwHiAiUser/samples
cd ascend*
构建工程:
cmake . -DMINDSPORE_PATH=`pip3 show mindspore | grep Location | awk '{print $2"/mindspore"}' | xargs realpath`
make
执行矩阵 [1, 2, 3, 4]与[2, 3, 4, 5]相加的计算:
./tensor_add_sample
好像失败了,是Mindspore还不支持小藤吗?小白陷入了深思。
是环境变量的问题吗?
打印下看看:
好像环境变量不全。
貌似ms_env.sh执行后,有些环境变量并没有生效。
把环境变量和执行sample放在一起看看:
执行结果:
环境变量都打印出来了,但是仍然报:
(mindspore2.0) HwHiAiUser@davinci-mini:~/samples/ascend310_single_op_sample$ sh ./ms_env.sh
/usr/local/Ascend
/home/HwHiAiUser/.conda/envs/mindspore2.0/lib/python3.9/site-packages/mindspore/lib:/usr/local/Ascend/ascend-toolkit/latest/lib64:/usr/local/Ascend/driver/lib64:/usr/local/Ascend/ascend-toolkit/latest/opp/built-in/op_impl/ai_core/tbe/op_tiling:/home/HwHiAiUser/Ascend/acllib/lib64
/usr/local/Ascend/ascend-toolkit/latest/opp/built-in/op_impl/ai_core/tbe
/usr/local/Ascend/ascend-toolkit/latest/opp
/usr/local/Ascend/ascend-toolkit/latest/opp/..
[WARNING] ME(2830,e7ffdb546020,tensor_add_sample):2023-05-10-23:58:45.110.464 [mindspore/ccsrc/cxx_api/factory.cc:68] Create] Unsupported device target Ascend
[ERROR] ME(2830,e7ffdb546020,tensor_add_sample):2023-05-10-23:58:45.110.538 [mindspore/ccsrc/cxx_api/model/model.cc:43] Build] Create session type Ascend failed
Build model failed.
Create session type Ascend failed
Build model failed.
看来只有求助下mindspore团队了。又是跨团队的问题。记得当时张小白使用200DK玩MindSpore的时候也是遇到了一些问题:https://bbs.huaweicloud.com/blogs/348248
当然,当时只是慢一点,现在这个是根本出不来结果。。。
不说了,学问学问,问了再说吧!
(未完待续)
- 点赞
- 收藏
- 关注作者
评论(0)