【CANN训练营】使用华为云开发者空间体验Sample仓实例体验

环境选择

前不久上了一次华为云开发者空间,发现华为云开发者空间里面有AI Notebook每天可以免费体验2小时910 B3的算力,这个对于需要学习掌握AscendC以及其他昇腾技能的小伙伴来说是个不错的福利,于是立马上手体验一下运行编译Sample仓算力是否正常。结果体验下来其实还是蛮好用的。原环境带的CANN版本是8.0的,这边体验选用了CANN8.3RC2的CANN版本,CANN包可以自己根据需要渠道http://www.hiascend.com 上根据需要下载新版本或者指定版本的CANN,这个还是比较方便的。

华为云开发者空间地址:https://developer.huaweicloud.com/space/home

安装CANN

bash 复制代码
wget 'https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/CANN/CANN%208.3.RC1/Ascend-cann-toolkit_8.3.RC1_linux-aarch64.run?response-content-type=application/octet-stream' -O Ascend-cann-toolkit_8.3.RC1_linux-aarch64.run

安装CANN

bash 复制代码
bash Ascend-cann-toolkit_8.3.RC1_linux-aarch64.run --full

激活环境

bash 复制代码
source /home/service/Ascend/ascend-toolkit/set_env.sh

开始体验

克隆Sample仓

bash 复制代码
git clone https://gitee.com/ascend/samples

编译算子工程(FrameworkLaunch方式)

进入AddCustom目录

bash 复制代码
cd samples/operator/ascendc/tutorials/AddCustomSample/FrameworkLaunch/AddCustom

修改CMakePresets.json文件

json 复制代码
"ASCEND_CANN_PACKAGE_PATH": {
                    "type": "PATH",
                    "value": "/home/service/Ascend/ascend-toolkit/latest" #此处修改为实际CANN路径
                },

进行算子工程编译

bash 复制代码
bash bulid.sh

部署算子

bash 复制代码
cd build_out
./custom_opp_openEuler_aarch64.run

运行样例算子

bash 复制代码
cd /mnt/workspace/samples/operator/ascendc/tutorials/AddCustomSample/FrameworkLaunch/AclNNInvocation
bash run.sh

输出结果

plaintext 复制代码
INFO: generate input data success!
-- The C compiler identification is GNU 10.3.1
-- The CXX compiler identification is GNU 10.3.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- env INC_PATH: /home/service/Ascend/ascend-toolkit/latest
-- env LIB_PATH: /home/service/Ascend/ascend-toolkit/latest/aarch64-linux/lib64
-- Configuring done
-- Generating done
-- Build files have been written to: /mnt/workspace/samples/operator/ascendc/tutorials/AddCustomSample/FrameworkLaunch/AclNNInvocation/build
INFO: cmake success!
[ 20%] Building CXX object CMakeFiles/execute_add_op.dir/operator_desc.cpp.o
[ 40%] Building CXX object CMakeFiles/execute_add_op.dir/op_runner.cpp.o
[ 60%] Building CXX object CMakeFiles/execute_add_op.dir/main.cpp.o
[ 80%] Building CXX object CMakeFiles/execute_add_op.dir/common.cpp.o
[100%] Linking CXX executable /mnt/workspace/samples/operator/ascendc/tutorials/AddCustomSample/FrameworkLaunch/AclNNInvocation/output/execute_add_op
[100%] Built target execute_add_op
INFO: make success!
INFO: execute op!
[INFO]  Set device[0] success
[INFO]  Get RunMode[1] success
[INFO]  Init resource success
[INFO]  Set input success
[INFO]  Copy input[0] success
[INFO]  Copy input[1] success
[INFO]  Create stream success
[INFO]  Execute aclnnAddCustomGetWorkspaceSize success, workspace size 0
[INFO]  Execute aclnnAddCustom success
[INFO]  Synchronize stream success
[INFO]  Copy output[0] success
[INFO]  Write output success
[INFO]  Run op success
[INFO]  Reset Device success
[INFO]  Destroy resource success
INFO: acl executable run success!
error ratio: 0.0000, tolerance: 0.0010
test pass
相关推荐
亦复何言??4 分钟前
BeyondMimic 论文解析
人工智能·算法·机器人
Lee川6 分钟前
🛠️ LangChain Tools 实战指南:让 AI 拥有“动手能力”
人工智能
gorgeous(๑>؂<๑)8 分钟前
【CVPR26-索尼】EW-DETR:通过增量低秩检测Transformer实现动态世界目标检测
人工智能·深度学习·目标检测·计算机视觉·transformer
xianluohuanxiang11 分钟前
新能源功率预测的“生死局”:从“能报曲线”到“能做收益”,中间差的不是一点算法
人工智能
码农垦荒笔记29 分钟前
Claude Code 2026 年 3 月全面进化:Auto 模式、Computer Use 与云端持续执行重塑 AI 编程工作流
人工智能·ai 编程·claude code·agentic coding·computer use
threerocks35 分钟前
【Claude Code 系列课程】01 | Claude Code 架构全览
人工智能·ai编程·claude
熊猫代跑得快36 分钟前
Agent 通用架构入门学习
人工智能·agent·智能体
格林威37 分钟前
Baumer相机锂电池极片裁切毛刺检测:防止内部短路的 5 个核心方法,附 OpenCV+Halcon 实战代码!
开发语言·人工智能·数码相机·opencv·计算机视觉·c#·视觉检测
codeの诱惑40 分钟前
推荐算法(三):余弦定理和余弦相似度的关系及公式推导
人工智能·机器学习·推荐算法
三枪一个麻辣烫1 小时前
gemini Adobe Illustrator visio draw.io画图
图像处理·人工智能·甘特图