当前位置:网站首页>Overview of cann interface calling process

Overview of cann interface calling process

2022-06-10 15:02:00 Hua Weiyun

CANN What we are looking at in the library is c++ Code for , stay WEB What is popular in the times is JAVA, instead of c perhaps c++, One of the reasons is JAVA There is no need to pay attention to memory allocation and release , And these are just c or c++ Programming is very important , As a result, a lot of code fragments are generated , When looking at the code , It will slightly affect the focus on the code of normal process .
Again , After the interface call , For the robustness and fault tolerance of the program , It is often necessary to check the returned result of the call and handle the error , When you look at the code in this way, you will feel a little cumbersome .
So put these aside for the time being , Let's mainly focus on the interface calling main process , When looking at the code in this way, we can get to the point , It is not easy to be submerged in code details .
Let's first introduce CANN The concept of , It is a technical architecture , The official definition is :

  • CANN(Compute Architecture for Neural Networks) Huawei aims at AI The heterogeneous computing architecture introduced in the scenario , By providing a multi-level programming interface , Support users to quickly build a platform based on shengteng AI Application and business .

Then in the code, we often look at the name with acl The interface at the beginning , that ACL Is a computing language , The concept is defined as follows :

  • AscendCL(Ascend Computing Language) It is a set of tools for developing deep neural network reasoning applications on the shengteng platform C Language API library , Provide operation resource management 、 memory management 、 Model loading and execution 、 Operator loading and execution 、 Media data processing, etc API, Can achieve Utilize the hardware computing resources of shengteng It's rising CANN On the platform Conduct deep learning reasoning calculation 、 Graphics and image preprocessing 、 The ability of single operator to accelerate calculation . Simply speaking , It's unified API frame , Realize the call to all resources .

image.png
In the picture above Computing resource layer It's shengteng AI The hardware computing power foundation of the processor , It mainly completes matrix correlation calculation of neural network 、 Complete the control operator / Scalar / Vector and other general calculation and execution control functions 、 Complete image and video data preprocessing , It provides execution guarantee for deep neural network calculation .
It can also be seen from the figure that ,ACL Include and CANN In , And in CANN The top layer of the structural hierarchy .

therefore , Development of application layer , The interface used directly is ACL Interface . Of course , There can be third-party frameworks /lib Library to call ACL Form more advanced interface services to provide to applications .

ACL The advantages here must be listed :

  1. Highly abstract : Operator compilation 、 load 、 Executive API Come back , Compared to one for each operator API,AscendCL A sharp decrease API Number , Reduce complexity .
  2. Backward compatibility :AscendCL Backward compatibility , Ensure that after the software upgrade , Programs compiled based on the old version can still run on the new version .
  3. Zero sense chip : A set of AscendCL The interface can realize the unification of application code , Multiple shengteng AI No processor differences .

Take a look at ACL The overall invocation process of

image.png

In fact, this process covers Rise CANN Experience officer phase IV Contents of Li , One is model reasoning , One is data preprocessing ( video 、 Zoom in and out of the picture 、 Switching, etc ).
Okay , Master the overall calling process , Learn about us CANN samples The example code in is helpful .

原网站

版权声明
本文为[Hua Weiyun]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/161/202206101445119299.html