当前位置:网站首页>Kunpeng compilation and debugging and basic knowledge of native development tools

Kunpeng compilation and debugging and basic knowledge of native development tools

2022-08-11 00:21:00 InfoQ

Kunpeng compiler debugging and basic knowledge of native development tools are divided into two plates and explain.The first version of the patch is the content of the plug-in development framework is introduced.The second plate is development framework features with cases present.

null
Before introducing the Kunpeng development framework plugin,Let us first understand what is native development.Because kunpeng development framework of the plugin provides function is to help users quickly get started.What is the definition of native development??让我们来看一下.The developer based on arbitrary environment to rapidly develop new software application,Can be run efficiently under kunpeng server or kunpeng architecture.Good development experience、粘性强,This process is called Kunpeng native development.它主要具备以下四个特点,首先,开发体验好.Good development experience mainly reflects in the ease of use and use two aspects.易用,That is, without changing the original development habits of developers,降低开发者的学习成本.

null
Better is that application developers to kunpeng can agile development,提升开发效率,Enable developers to innovate efficiently.Kunpeng native development of the second characteristic is architecture since the affinity,The shielding hardware complexity kunpeng architecture development process since the affinity.The third feature of Kunpeng's native development,Apply high performance,In the user application development advantage of kunpeng architecture,Unleash the computing power of Kunpeng,Build for ultimate performance.Kunpeng last feature of native development is calculate force more compatible,Compatible with various computing power,Develop once and reuse many times,Performance is portable.

null
After introducing the concept of native development,Let's have a look at the kunpeng development framework plug-in is what.Many developers at first contact kunpeng primary development will face such a problem,Kunpeng to accelerate the library API 不熟悉,不知道有哪些 API I don't know how to use.At the same time how to program for kunpeng processor speed optimization method also know nothing.According to these developers to these common problems,Kunpeng launched the Kunpeng development framework plug-in,Help developers to develop Kunpeng applications more conveniently,使能开发者高效创新.Kunpeng development framework plugins can be found at ID Get it for free in the plugin marketplace,In the plug-in market search kunpeng keyword can see.Kunpeng development framework plug-ins make full use of the new platform of each type of work force,That is, third-party components with better performance,Provides three major characteristics,They are Kunpeng Engineering Wizard Shampoo、Daily programming code affinity check and other abilities.One-click introduction of Kunpeng acceleration library,快速构建鲲鹏应用软件框架,Guide users to get started quickly.原生开发.Next we see kunpeng of whole development framework plug-in to provide us with the function of what.从图中我们可以看出,Kunpeng development framework plug-in focuses on the entire development process,在开发前、开发中、Developed to provide important features,帮助开发者提升开发效率,提高应用性能.在开发前,Developers can use the development wizard function,By entering some simple project configuration items,You can create a Kunpeng project with one click,So as to quickly get started with Kunpeng native development.

null
Kunpeng includes basic engineering demo files and related acceleration libraries demo 和源码文件.Developers through kunpeng engineering can not only understand the running of the peng accelerate library API 是如何调用的,Can also be field on the remote server to run,View the kunpeng accelerate libraries bring extreme performance improvement.在开发过程中,Kunpeng development framework plug-in provides a heuristic programming function,The user only needs to enter the keyword of the relevant function,Kunpeng development framework plug-in production will be according to these keywords smart lenovo,And prompt some related content of the function.These contain feature names、优化内容、Corresponding assembly instructions and other rich information,Help users understand the Kunpeng acceleration library API Check code can be used after the user development affinity function.

null
Code and check is kunpeng native development one of the main feature of,Function distribution in kunpeng development framework and migration in the plugin.In the Kunpeng development framework plugin,The main implementation form is Kunpeng acceleration analysis,It scans the user can be used in engineering kunpeng to accelerate the library API 替换的代码,and generate detailed visual reports,To help users better replacement.Good for plug-in development framework for an integral part of the introduction later,Let's show detailed kunpeng development framework plug-in features.

null
The first to introduce the development framework of plug-in features is kunpeng engineering wizard.Kunpeng engineering guide the implementation of the effect as shown in figure,After entering some simple project configuration items,After selecting the relevant acceleration library information,Can automatically build the Kunpeng project,Encourage users to carry out Kunpeng native development in depth.Next let's take a closer look at the kunpeng engineering to create.In the first place in the page to create a new project input relevant engineering configuration items,such as project name、Engineering language shall be the standard language selection type and so on.

null
Users only need to input and select some key project information,Development framework plug-ins will be created automatically according to user selection kunpeng engineering after user click next to accelerate library select page.Kunpeng Engineering currently supports jstd Get inspired C Hyper scan 等 7 Accelerator library,涵盖系统、压缩、Three main categories of storage.

null
These acceleration libraries are based on Kunpeng 920 The processor micro-architecture features have been heavily optimized,Can make kunpeng server performance gets more fully release.In addition to these shed acceleration libraries,We also provide encryption and decryption media、数学库、Network library and so on four big accelerate the library's main categories of download link,The user can click access to resources button to download and use these libraries of the family.Next, we introduce the development framework of the plugin's second-largest features,启发式编程.Kunpeng native development of heuristic programming for all developers,Provides a total of thousands of function codes,Real-time intelligent completion of full coverage of content information of the ceremony,Contains Kunpeng acceleration library functions and new interest 函数.Equity content includes functional description、Optimization point description、Message corresponding to the assembly instructions, etc.We can see from the figure of the page,After the user enters the keyword of the related function,The development framework plugin will be coded.Tips for smart real-time completion,Prompt about functions the user might want to enter,and displays a wealth of complementary information,帮助用户提高开发效率,提升用户的使用体验.Heuristic programming provides the function of smart tips will function in the user write C 或 C Triggered when a file is added.It is aimed at this two kinds of function of intelligent association and completion,They are the Kunpeng acceleration library function and NEO interest 函数.The intelligent completion of Kunpeng acceleration library functions includes ZSTD chaekml 等 14 Accelerator library,Override system compression encryption and decryption、Four basic math acceleration scenarios,为大数据加解密、Distributed storage compression application scenario to provide high performance speed up.利用 interesting The intelligent association of functions contains arm 提供的所有 new inch 这个函数. new The use of function compared with the traditional pure assembly language for NEO 寄存器进行操作,具有可读性强、开发速度快等优势.

null
At last let's take a look at the code to check the properties of affinity function.Code to check the characteristics on the development framework of affinity is mainly kunpeng acceleration analysis.Kunpeng acceleration analysis for compression system encryption and decryption、Media based acceleration scenario analysis optimization mathematical five,It will scan a developer projects can use kunpeng to accelerate the library function is optimized the code,And sort out the detailed visual report.Users will replace these functions ChengKunPeng accelerating library function after,Can improve your project on a new server running performance.Let's have a look at the visual report provides us with what information.We can see the report, the information provided by the function name、所在路径、函数简介、Key information such as acceleration method.At the same time also provides a download link,Developers will be able to click on the download link to download the relevant kunpeng to accelerate the library function and used to replace.

null
Kunpeng development framework of the plug-in features lecture temporarily here.接下来让我们使用 VSCode This is very mainstream IDE Go for a fight.我们在 vs code Search kunpeng to download using plug-in development framework and field experience kunpeng development framework plug-in to provide us with the power of.

null
Everyone is in the design and development scene,often local Windows 环境中使用 IDE 编码,比如使用 VSCode Then manually upload the code to the remote server,After the run mode is compiled on the server and a series of operation.如果遇到编译错误,You have to go back to the local to continue to modify,After the modification is completed, upload and compile.如果遇到运行错误,This time we need to debug on server location problem,Then modify the code locally,And then upload the compiler running repeat the previous some action.We launched the Kunpeng compiler and debugging plug-in,In order to solve the series of separation for development and debugging environment caused by the low efficiency of develop.Kunpeng Tuning Kunpeng Compilation and Debugging Plug-in Can Be Locally IDE One-stop deployment and development.The remote area compilation and debugging function can simplify everyone's Linux Server development process and improve development efficiency.Below as an introduction to the basic function of the article to compile the plug-in.

null
Before compilation can be used to compile debugging plugin provides one-click deployment compiler function,Will choose the compiler is a key to deploy on the target server.The compiler types that can be selected are GCC for open Euler and Sound Avoidance Compiler and Sound Avoidance gdk After configuring the target server,We can create the compilation task.在编译之前,We can synchronize manually,It is through the button action,Once the project file synchronization to the remote server,或者通过自动同步,By listening for code changes,Automatically synchronize changed files to remote servers.Both upload native code to the remote server.代码同步完成之后,执行编译操作,The process of compiling and results can be through the local terminal view.

null
在编译成功之后,It is also possible to pass the test case function,Is to add test cases,然后执行测试用例,Execute the whole process by executing the code of the test case.The whole process can also be without frequent switching between local and remote server,实现的本地 IDE One-stop deployment, development, remote debugging and compilation.Below introduce you to compile debugging of the plug-in features and some of the cases present.

null
Integrated into the in the form of debugging to the plugin IDE 中,Install and use for Kunpeng ecological users.The current tool supports deploying the compiler、Three functions of remote compilation and remote running and debugging,The purpose is to solve the developers for development and debugging environment caused the poor efficiency of the development of separation,实现本地 IDE Development and debugging integration.The ability to deploy the compiler.支持部署 GCC for open 欧拉、Soundproofing Compiler and Soundproofing gdk Ar compiler the deployment process does not need to manually login to the remote server,仅在本地 ID end to complete the deployment. GCC for open Euler is a GCC 开发,Mainly because many current server software are based on open source GCC 开发.To reduce customer switching costs,我们在 GCC Optimized and improved,Such as providing high-performance compiling algorithm,Provides accelerated instruction set、High-performance math library, etc. SPC 2006 和 SPC 2017 Performance than open source GCC Nine-thirty high 10% 以上.

null
B L compiler is based on open source LVM 开发,是一种 Linux A high-performance compiler for Kunpeng 90.主要支持 C 语言、 C 加语言、 fountrie 语言.The three languages ​​are HPC The most used languages ​​in high-performance computing scenarios.Lifetime compiler for Kunpeng's chip specification set、The pipeline has also been enhanced and optimized,such as high-performance compilation algorithms,Increase instruction and data throughput.In addition, some accelerated instruction sets and AI 迭代调优,Give full play to the best performance of the Kunpeng architecture.

null
毕森 gdk 是基于 openjdk Custom developed open source version,is a high-performance production-ready openjdk 发行版.毕生 gdk 是 open gdk 的下游,We are inside Huawei 500 Widely used on multiple products,积累了大量使用场景和 Java Developer feedback issues and needs,Solved many practical problems in business operation,and fixes for these issues.在 arm The architecture has also been optimized and stability enhanced,使得在 arm More stable under the architecture,In the big data scenarios also obtained better performance.

null
远程编译,Your plugin is to provide the visual interface of perform,No need to repeatedly manually enter compile commands,At the same time, along with other debugging plugin support deployment,In conjunction with other debugging plugins,Features that support remote execution and debugging.Of course in the use of compiler debugging plugin and remote to compile and run before,Need to finish configuring the remote server.This way is to deploy a key part of a compiler interface.One click is the target server where the compiler is deployed,Just need to be online.Enter the relevant parameters of the target server,比如 IP 地址 polar 端口以及用户名和密码.配置好之后,The plugin will be based on the selected compiler type,From the official mirror sites to download the corresponding compiler automatically complete the installation.That is why want to ensure that the target server is in a state of networked.Because of this from the official website to download the corresponding compiler.during download and installation,也可以通过 ID The terminal to check specific to download and install the progress.在安装完成之后,It will also give a prompt that the tool is deployed successfully,The whole process does not need to log in to the remote server.

null
After the completion of a compiler installed,The next step is to do remote compilation.First create a compile task,Compile tasks can be named differently,And specify the compile command.This creates a compilation task.Here is to compile native code synchronization to the remote server for,At the same time can look up in the end the compilation of results.Of course in the set set up a remote synchronization code,You can also enable auto-sync in settings.If the local code change,will automatically sync to the server.After the code is automatically synced to the server,Can be directly generated by compiling new executable file.During the compilation of complete cases,Add test cases to remotely run, and debug.This is a page for a debug binary.You can see this is attribution has some debugging buttons and running a line.The highlighted line here is the one that is running.下面是运行的结果,Let's take a look at some of the case demonstrations.Here is a page where the compiler deploys,This above is the type of compiler that can be selected,It's the three compilers and the server on the right IP 地址、端口号,Also the username and the user's password.这边

null
Choose through key certification after the information filled out the complete can connect through testing,If you can connect,If there is no problem with the connection, it can be deployed directly.Here is the edit to deploy this function.Remote compilation is to create a compilation task to specify the name and compile compile command.Then in the list of tasks below there will be a show,List showing the above to this button you can click on to perform the entire compilation task.When the compile task is executed,By selecting the corresponding target server,Comes to execute the compiler to compile in the process of the terminal is able to view the whole compilation process executed compilation process over here is the add test case,Then run and debug remotely.Test cases here also is to have a test case task name and executable program and the path to the location of the,You can also add some parameters at the end.Then after a run that can also click the debug button,Debug button will enter to the debug interface.The debug interface is the same as local debugging,There's something going on what's stepping in and out,There are also some some restart next will suspend some function.下面用一个 demo 给大家演示一下.

null
下面这个例子比较简单,就是一个简单的 hard word 输出.First without interfering with our debugging plugin,If you want to debug and run this program,We need to upload the local code above people on the server,Make a zip first,然后通过本地的 sap The command goes to the human server.I am a server through the remote laboratory also application. Workspace.输入密码.

null
It has been sent to the free order server in the workspace 目录,然后进行解压,然后再进到 demo 的 demo 目录.This time need to go to the remote server performs its compilation command,You can see the generated one hello 的二进制文件,这个时候就执行 hello and then print this hello world This is without our tools.And if if only by changing the code,For example, I modified another one in the code,再打印一个 hi word Then at this time you need to enter the project again.But this time can be uploaded to a separate file,No need to pack any more.

null
Then in this file directory to be uploaded to it demo Enter the password again below.After uploading this time,To recompile this file,It generates a new binary.This whole process can be seen in the remote server and local IDE switching back and forth between,But also need to manually change the code and the first code is to synchronize to a remote server.This process is rather complex,It completely affects everyone's development efficiency..For our Kunpeng debugging plugin,Just optimized this one.First search for Kunpeng in the plugin market,These are some plugins of our Kunpeng Ecosystem,This is our debugging plugin.安装完之后,First, because we do not need can do not need the above can,If you have don't need to install the compiler compiler sources,Can be directly invited by adding a target server.This is the input server IP 地址,Then the port number defaults 2 加 2 端口,然后用户名 root 工作空间就是 root workspace Here because I created a new one test 目录,In order to compare your now in this directory is to create a new test 目录,Here can input need into the private key, public or private.公钥,Is for the convenience of automatic upload code to avoid close behind side to fill in root 的账号密码.配置完成之后,It will prompt you to start debugging tasks.Click to confirm here is to add a debugging task,Because the deployment editor can do not need to deploy compiling,指定一个名称 build SED Our compile command just now is make Create a compile task,is to start compiling,Here you need to select your target server.If adding multiple target servers,Here will be a list,Just need to choose you this compilation task in which the target server up and running.Because we have not synchronized code at this time to a remote server,Now the directory of the remote server is empty.So the first step is to choose synchronization and compile,This code is to local synchronization to the remote server.Here is the output of the compilation,可以看到编译成功.可以看到编译成功,also generated this hello 的二进制文件.And then this time can by creating the test cases.to test this compiled.Asked the compiled binary path of this program is that the generated binary.This also has no parameters,So the debugging parameters are left blank..then add the test case.After adding test cases,Can click the above the test cases for a test case,It is also possible to choose a IPD A target server fetches test cases.After completion of side can be expanded with the task of a test case,One click to run.This is just the code printed words here,一个 hello word 一个 high word.You can also debug through this.这个是通过 GDB 远程调试,Then implement local debugging,This can be through this or continue next,这都是可以的.Here is if the configuration is below the automatic code since the configuration,Automatic upload of selected configured servers,After the configuration is complete, you can take a look.That is, if I go to modify the code at this time.then click directly ctrl S Then in the lower right corner below prompt code already sync up here,We can take a look here.Is the remote server code is already synchronized come over,And then directly at this time can don't need to upload the code,You can directly click on this compilation task,Will this can only be generated once again the binary file only compile the binary files are generated after the test cases to perform here is the latest.So the whole process is people do not have to go the extra frequently switch the remote server and local ID Just need to modify and debug here.For example, if you need to debug,just click,这是下一步.This is all possible to fully implement local debugging.If every time just don't want to modify the code to the code synchronization to the distal.Can remote server will be able to give it manually in that place,manually change it from automatic to manual,Is there any automatic synchronization function that is turned off?.就不需要去.But this time if the code synchronization again before compilation can the above is the introduction and part of the compiler debugging plugin function demo,谢谢大家.Below by my colleague Wang Qikun continue to introduce kunpeng plug-in development framework for everyone.好,Next let's open VSCode 这个开发工具,Install the Kunpeng Development Framework plugin on the spot,Experience the new development framework plug-in to provide us with the power of.打开 VSCode 工具之后,Let's click the extension button,Search for Kunpeng.The search results show so many information,The first is Kunpeng David kit 鲲鹏 David kit It is all Kunpeng David kit A collection of plug-ins.When you install Kunpeng DEV kit 之后,Will automatically all the following four plug-ins to install.Today we only demo kunpeng development framework of the plugin function,So we only install kunpeng development framework plug-ins,Quick installation at the click of a button.After installation will pop up kunpeng development framework plug-in details.We can see from these content kunpeng development framework plug-in support related kunpeng to accelerate the library,such as system libraries、压缩库、Encrypting and decrypting media, etc,Also shows the kunpeng development framework plug-ins around kunpeng processors provide acceleration strategy.Let's have a look at the kunpeng development framework plugin provides us with the first big functions such as project management guide.First click the Kunpeng Development Framework Plugin button,Then close other irrelevant pages first,And click the New Kunpeng Project button.Now we create a contains a kunpeng engineering related to accelerate the library,The project name is  PaaS demo 1 Project location choice by default site after we select two accelerating library to download.For example, we choose the system library Hyper scan and in the compression library. Be zip. 点击创建工程,and choose to continue downloading.Download will accelerate the library from the destination address for us to download kunpeng accelerating library source code,Then we view the project in the current window.

At this point, the project content has been displayed in the left column..We can see from the left column of information mainly has the following several main content.首先 SRC Include some simple hello world 式的 demo Let's disable this wrong waveform first.之后在 sort party We just choice contains two accelerating library folder,分别是 zip 还有 Hyper scan 这两款.那么以 gzip 为例,它下面包含 G zip corresponding to the acceleration library demo 以及 G zip Accelerate the library corresponding source code. G zip 是一个压缩库.所以说 jessica demo 中就提供了对 gzip encryption and compression and decompression of API 的调用.Besides these two,also provides a detailed README 文档,Guide the user how to gzip Compile and run the project.Next, we build on this project,Try a new development framework plugin provides us with the second big functions,heuristic programming.First of all, the face C This project is based on,Let's first enter Kunpeng's acceleration library function.以 kml Take math library for example,当我输入 K 的时候,In fact he has function of related tips.Tip of the acceleration of information in addition to the corresponding library functions,Also contains some detailed information corresponding to this function,such as functional descriptions、Optimize the point of reference、下载地址等.When you want to select the corresponding function for completion,Except clicking with the mouse,You can also hit the enter key directly.after you hit enter,You can find the corresponding kunpeng accelerating library functions have been highlighted to show.同理利用 interest function works the same way.比如我输入 VA It will give me hints about some function information,我选择 VBA his 16,Its functional description is the long line absolute difference,再加上 16 Tapping Enter is also highlighted for display,This is a new development framework plug-in to provide us with the second largest function heuristic programming.Next, we use the use the kunpeng speeding up development plug-in provides the framework of analysis.Accelerated analysis can analyze the user selected corresponding engineering or the contents of the file,Scan which can use kunpeng to accelerate the library function to replace the contents of the,And provide a detailed report of visualization for users to view.我们以 gzip demo 中的 demo gzip.cbp file as an example for a scan,右键这个文件,Click the Accelerate Analysis button.At this point we can see that the development framework plug-ins will let the user to select the corresponding acceleration analysis type.If the user just for their own projects or files can be compressed scan,You can directly select the compression library.

null
This time I to give you a better display scan results,I for this file to analyze all relevant acceleration of the library.Click confirm button after analysis,There will be a corresponding progress indicator in the lower right corner.At the same time in the pop-up window will show the following problems related to the function can be optimized,The corresponding details,比如名称、描述、optimization points, etc.扫描结束之后,The meeting in the current page show detailed visual report.We can see from this report has the following important content,For example, the corresponding function name、所在地址、acceleration methods, etc,Both view and download buttons are provided,Users click on the download will automatically jump to the corresponding acceleration library download address,Users can download and then replace the corresponding function.At the same time, the user can click the View button,Jump to the corresponding function address,It is convenient for users to make the next replacement.At this point kunpeng development framework plugin provides us with three big functions already all the presentation.接下来让我们回到 PPT Have a look at a new development framework plug-in related close sandbox experiment contents.Currently kunpeng community launched kunpeng development framework of online experiment,The user can log on to a new community search based on a new affinity development framework for native development so experiment.This experiment will guide the user to create and run kun peng project,Help users quickly familiar with the native development process and advantage.I brought you here today about have a look at the specific content of the experiment.

null
好,It's purpose is to guide the user through the experiment kunpeng development framework plug-ins from 0 到 1 Complete the basic development process of native development,Familiarize users with the basic operation process of native development,Experience the native development of minimalist operation and performance improvement.Let's take a look at the lab manual.The experiment manual is mainly divided into the following four steps,非常简单,安装插件、Create and view projects,Finally compile and execute the kunpeng engineering installation and create kunpeng engineering.So two steps have just give you a show,View the words of the shed project,We look at what the kunlun project.Click to view project button will display the corresponding engineering content.We can see in this experiment is to create gzip A related acceleration library demo 那么这个 demo There are two subfolders in it,分别是 G zip demo 还有 G zip demo 的源码.那么 G zip This source code has been downloaded and unzipped gzip Kunpeng Library.The accelerating library according to the characteristics of the kunpeng processor architecture,对 gzip 原生库进行了加速优化.The next experiment is to use this demo To compare the accelerated library and the native library in decompressing the two G 大小文件时的解压效率.

null
Let's have a look at roughly when compile and execute kunpeng engineering,Accelerate the libraries, and what is the difference between a native library extract efficiency.We skip the relevant content of these commands,Take a look at the specific execution results.You can also go kunpeng community on the online experiment to manual operation,See the result and the result of the sandbox experiment mentioned for and different?The first thing to do is dzip Kunpeng acceleration library for two G Decompression of large and small compressed files.As can be seen from the terminal action results decompression time is 27.3 秒.Below is the native gzip To compare this decompression performance.We can see that the acoustic library targets both G The decompression time for a compressed file of size is 34.8 秒,加速库相比于原生库有 20% 的性能提升.
原网站

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