当前位置: 首页 > 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.jsqmd.com/news/1071101/

相关文章:

  • Dify.AI语音交互系统深度解析与架构设计
  • Reflex框架终极实战指南:5分钟解决Python Web应用开发难题
  • FlagGems性能调优秘籍:10个实用技巧助你针对特定硬件后端最大化加速比
  • Elastic Integrations故障排查指南:从日志分析到问题解决的实用技巧
  • laravel-money宏与混入功能:如何优雅扩展货币处理能力?
  • Awesome Claude Skills:构建AI工作流的终极指南与完整实践
  • 7-Zip DLL选择指南:bit7z兼容的7z.dll/7za.dll功能对比
  • 终极iOS越狱指南:使用palera1n轻松解锁iPhone系统权限
  • Javinizer元数据抓取原理深度解析:如何从8大网站获取最全信息
  • 学术PDF翻译的终极解决方案:BabelDOC如何完美保留格式与公式
  • 深度解析开源microG项目:如何为无GMS设备提供完整Google服务替代方案
  • wasm-git高级教程:使用Web Worker实现浏览器中的Git仓库克隆与提交
  • GroupViT模型训练全指南:从环境配置到COCO数据集评估,新手也能轻松掌握
  • 中国象棋AlphaZero实现:从理论到实践的技术探索
  • Meta-Transfer Learning终极指南:从元学习到参数缩放与平移的完整解析
  • 10分钟自主搭建零成本内网穿透:bore轻量级隧道实战指南
  • 5分钟快速上手:Unity物理卡通着色器UniToon完全指南 [特殊字符]
  • PhoneVR项目路线图:未来功能和发展方向展望
  • Binwalk v3.1.0:固件分析架构跃迁,性能重构实现10倍加速
  • 如何用BRAT插件轻松管理Obsidian测试版插件:完整指南与实战技巧
  • OpenInference故障诊断:常见问题排查与调试技巧大全
  • DJITelloPy:Python无人机编程实战指南 - 从基础飞行到多机编队
  • 如何搭建自动化域名监控系统:Domain Admin终极指南
  • TornadoVM异构计算实战:3大架构突破与5层性能优化深度解析
  • Midscene.js性能优化实战:7大策略解决AI自动化卡顿问题
  • iMonitor脚本编程教程:TypeScript/JavaScript扩展系统监控功能
  • 如何用AI+BI平台在3分钟内让数据开口说话?
  • ComfyUI-LTXVideo完全指南:如何在5分钟内开启AI视频创作新时代
  • MrRSS:终极AI RSS阅读器完整指南 - 3大核心功能让你快速掌握智能阅读
  • HiApp网络请求优化:Axios在移动应用中的最佳配置与实践