当前位置: 首页 > news >正文

CANN/runtime:资源限制内核执行示例

1_launch_kernel_with_reslimit

【免费下载链接】runtime本项目提供CANN运行时组件和维测功能组件。项目地址: https://gitcode.com/cann/runtime

Description

This sample demonstrates basic flow of executing Kernel after setting Device resource limits in current process. The sample sets Cube Core resource limit, queries current limit value, and dispatches print Kernel. After running, you can see Kernel outputHello Worldlog and script verification result.

Product Support

This sample supports the following products:

ProductSupported
Ascend 950PR/Ascend 950DTYes
Atlas A3 training series products/Atlas A3 inference series productsYes
Atlas A2 training series products/Atlas A2 inference series productsYes

Build and Run

  1. Download sample code to environment with CANN software installed, switch to sample directory.
cd ${git_clone_path}/example/2_advanced_features/kernel/1_launch_kernel_with_reslimit
  1. Set environment variables.
# Replace ${install_root} with CANN installation root directory, default installation at /usr/local/Ascend source ${install_root}/cann/set_env.sh export ASCEND_INSTALL_PATH=${install_root}/cann # Replace ${ascend_name} with Ascend AI processor model, obtained by checking Name field using npu-smi info and removing spaces export SOC_VERSION=${ascend_name} # Replace ${cmake_path} with ascendc.cmake directory, for example ${install_root}/cann/aarch64-linux/tikcpp/ascendc_kernel_cmake export ASCENDC_CMAKE_DIR=${cmake_path}

If environment variables are not set beforehand,run.shautomatically attempts to detectASCEND_INSTALL_PATH,ASCEND_HOME_PATH,$HOME/Ascend/cann,/usr/local/Ascend/cann,/opt/Ascend/cann,SOC_VERSION, andASCENDC_CMAKE_DIR; if automatic detection fails, set manually using the above commands.

  1. Run the following command to execute the sample.
bash run.sh

CANN RUNTIME API

Key features and interfaces in this sample:

  • Initialization
    • CallaclInitinterface to initialize configuration.
    • CallaclFinalizeinterface to deinitialize.
  • Device Management
    • CallaclrtSetDeviceinterface to specify Device for computation.
    • CallaclrtResetDeviceForceinterface to forcibly reset current computation Device and reclaim Device resources.
  • Stream Management
    • CallaclrtCreateStreaminterface to create Stream.
    • CallaclrtSynchronizeStreaminterface to block waiting for Stream task execution completion.
    • CallaclrtDestroyStreamForceinterface to forcibly destroy Stream.
  • Runtime Configuration
    • CallaclrtSetDeviceResLimitinterface to set current process Device resource limit.
    • CallaclrtGetDeviceResLimitinterface to get current process Device resource limit.

Sample Output

[INFO]: Current compile soc version is ... Configuring CMake... Building... [INFO] ACL initialized. [INFO] Device 0 selected. [INFO] Stream created. [INFO] Device resource limit type 0 set to 8. [INFO] Current device resource limit type 0 is 8. Hello World Hello World Hello World Hello World Hello World Hello World Hello World Hello World [INFO] Run the launch_kernel_with_reslimit sample successfully. [SUCCESS]: Launch kernels under resource limits successfully.

【免费下载链接】runtime本项目提供CANN运行时组件和维测功能组件。项目地址: https://gitcode.com/cann/runtime

创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考

http://www.gsyq.cn/news/1583054.html

相关文章:

  • laravel-money宏与混入功能:如何优雅扩展货币处理能力?
  • Awesome Claude Skills:构建AI工作流的终极指南与完整实践
  • GroupViT模型训练全指南:从环境配置到COCO数据集评估,新手也能轻松掌握
  • iMonitor脚本编程教程:TypeScript/JavaScript扩展系统监控功能
  • Binwalk v3.1.0:固件分析架构跃迁,性能重构实现10倍加速
  • TornadoVM异构计算实战:3大架构突破与5层性能优化深度解析
  • 如何用BRAT插件轻松管理Obsidian测试版插件:完整指南与实战技巧
  • ComfyUI-LTXVideo完全指南:如何在5分钟内开启AI视频创作新时代
  • HiApp网络请求优化:Axios在移动应用中的最佳配置与实践
  • 如何用AI+BI平台在3分钟内让数据开口说话?
  • 从零到一:我是如何让wewe-rss成为我的私人信息助理的
  • WubiLex五笔助手终极指南:让Windows五笔输入法焕然新生的简单教程
  • MrRSS:终极AI RSS阅读器完整指南 - 3大核心功能让你快速掌握智能阅读
  • 深度解析:UniToon物理卡通着色器的架构设计与实现原理
  • 3个实用技巧解决luci-app-ddns-go日志时间显示问题
  • 当AI音乐创作不再需要订阅费:探索本地化AI音乐生成的新可能
  • Mamba分布式训练架构深度解析:突破性状态空间模型的高性能可扩展方案
  • ToastFish:5分钟学会用Windows通知栏高效背单词的摸鱼神器
  • 终极图像管理方案:Geeqie - 免费开源的强大图片查看器
  • WezTerm:GPU加速终端如何重塑现代开发者的工作流体验
  • Typhon H2cFilter实战指南:如何轻松启用HTTP/2明文通信以提升服务性能
  • Joplin终极指南:打造你的私有化跨平台笔记系统
  • 深度解析:C++11线程池与SafeQueue的高效实现实战指南
  • Hindsight智能体记忆系统:3种部署方案让AI真正学会思考与成长
  • ToastFish:如何用Windows通知栏在碎片时间高效背单词
  • Kokoro多语言语音合成架构深度解析:82M参数轻量级TTS模型技术实现方案
  • 从0到1理解Typhon Router:构建高性能API路由的完整指南
  • 终极指南:如何将SmartSystemMenu打造成你的Windows效率神器
  • Stata数据分析工具箱:世界银行专家教你如何3步完成专业级统计报告
  • Sapiens2-5B-Pose:Meta推出的革命性308关键点人体姿态估计模型完全指南