当前位置:网站首页>[play with Huawei cloud] take you through the Kunpeng code migration tool to realize source code migration
[play with Huawei cloud] take you through the Kunpeng code migration tool to realize source code migration
2022-06-10 22:57:00 【Hua Weiyun】
1. Introduction to source code migration
In the context of domestic substitution , Kunpeng computing platform is a very potential industry . In order to solve the problem that developers are x86 A series of pain points encountered in the process of platform application porting to Kunpeng platform , Huawei has launched the Kunpeng code migration tool (Porting Advisor), Help developers speed up the x86 Applications in the environment are migrated to the Kunpeng platform . This paper is based on the instrumental software migration experience of Huawei Kunpeng computing tool chain project team , The practical experience of Kunpeng code migration tool is summarized , It is expected to help developers understand how to use the tool , Improve the software migration efficiency of developers .
1.1 Introduction to source code migration
In the context of domestic substitution , Kunpeng computing platform is a very potential industry . In order to solve the problem that developers are x86 A series of pain points encountered in the process of platform application porting to Kunpeng platform , Huawei has launched the Kunpeng code migration tool (Porting Advisor)
Help developers speed up the x86 In the environment
Use to migrate to Kunpeng platform . This paper is based on the instrumental software migration experience of Huawei Kunpeng computing tool chain project team , It summarizes the practical application of Kunpeng code migration tool F Experience , It is expected to help developers understand how to use the tool , Improve the software migration efficiency of developers .
1.2 Tool features supported by the tool

1.3 Introduction to source code migration
When users can provide source code for migration analysis , You can use the source code migration function to complete the migration. The source code migration function mainly solves the difficulty of manual troubleshooting of user code compatibility 、 Rely heavily on personal experience of migration 、 It is necessary to repeatedly rely on compilation to debug and locate errors, which leads to low execution efficiency . According to the different translation methods from source code to binary file , Code migration tools divide programming languages into two categories : One is compiled ,— Classes are interpretive .
Support source code types

1.4 Migration process

2. Practical project one
2.1 Prerequisite
1. The server and operating system are running normally .
2.Pc The end has been installed sSH Remote login tools .
3.Porting Advisor Already in preparation x86 Complete installation and normal operation in the platform environment and Kunpeng platform environment .4 Relevant software packages to be migrated 、 The source code is ready .
2.2 Relocation plan
1. utilize Porting Advisor The source code migration function of smartdenovo Source code scanning , Get its $o Library dependencies 、 Portability 、 Migration workload and other analysis results .
2 according to Porting Advisor From the analysis of source code migration function smartdenovo Dependency to prepare the corresponding sO library .
3. Check smartdenovo Source code analysis report of source code , Get the compile build file 、.h/.c And other source code files , And modify according to the modification suggestions .
4. Compile with the modified source code , Generate Kunpeng version smartdenovo Software .5. Use Kunpeng version smartdenovo Software deployment and simple validation .

2.3 Open source software smartdenovo-master The actual battle of migration
step 1 from https://github.com/ruanjue/smartdenovo Download and obtain the software source code package to be used smartdenovo-
master.zip.
step 2︰ Get into Porting Advisor“ Source code migration ” Menu for scanning analysis . In the related configuration items and buttons that appear later , As shown in the figure 1 Strike “ Upload ”, Upload the previously downloaded smartdenovo-master.zip, And click the input box , Select the source package as "smartdenovo-master”. Several other options are selected according to our actual situation

stay “ Suggestions for source code migration ” page , see Makefile Suggestions on modification of documents , Pictured 1 The migration proposal is shown in
According to the above suggestions ,Makefile The document needs to give CFLAGS Variable increase option inner Valley marcn=avo-a -iightea , i To delete CFLAGS Options in variables “-mpopcnt” and “-msse3". The modified code ( The modification was made x86_64 Branches and aarch64 Branch differentiation ), Pictured 2 The modified makefile Shown .

stay “ Suggestions for source code migration ” page , see ksw.c Suggestions on modification of documents , Pictured 1 The migration proposal is shown in
These tips are all about intrinsic Function usage . Based on the advice provided , Need to increase the ‘#include 'avx2neon.h” To ksw.c To include avx2neon.h, And aim at x86 and aarch64 Set the branch definitions contained in the header file respectively , To ensure that the code fits at the same time x86 and arch64 Complete the code modification in the case of two architectures , Pictured 2 The code is modified as shown in . meanwhile , Need to download avx2neon Related header files to ksw.c In the directory . Due to avx2neon There are some directional open source functions in open source projects , When these open source functions appear in the code , It will appear as shown in the figure 1 Suggestions shown in the source code . here , Users need to access github Website through README.md To learn how to get the code files for these directed open source functions . After obtaining this part of the code header file , Place it in avx2neon.h In the directory .
At the completion of the right Makefilb and ksw.c After the modification of , You can download the whole modified source code to Kunpeng ring, as shown in the figure 1 List file information and figures 2 In the world , perform make clean && make command , Complete the compilation action ,make In the figure shown in the command smartdenovo-master Is the source code file we need to download .

step 2︰ take smartdenovo-master After downloading to local , Clean up the local directory smartdenovo-master Tool generation in
In between Makefile.20210104220958.bak.0、ksw.c.20210104220958.bak.0.
step 3 Put the local directory smartdenovo-master Upload to Kunpeng server , Execute the compile and install actions . step 4Make After success , It can be executed make install Command execution installation , Check the installation results as shown in the figure 3 Shown

3. Practical project II

From the dependency library information provided in the scan report , The source package does not depend on the basic environment (OS The basic installation of the environment depends on , Such as GLIBC etc. ) Other dependent files besides .



4. summary
In this software migration practice , Through the complete simulation of the software migration process , It covers the pre analysis of the migration process by using the code migration tool 、 Intermediate modification and late compilation 、 restructure 、 The process of verification . In the migration of other software , You can refer to the idea and operation process of this practice .
边栏推荐
- CCF CSP 202109-1数组推导
- UE4骨骼动画新手入门
- smb匿名
- Play electronics, poor three generations
- [tcapulusdb knowledge base] tcapulusdb refresh tbus channel introduction
- kubernetes多网卡方案之Multus CNI部署和基本使用
- Can Huawei matepad become the secondary screen of your laptop?
- 存储引擎分析
- Tcapulusdb Jun · industry news collection (I)
- Implementation of simply untyped lambda calculus
猜你喜欢

Play electronics, poor three generations

【TcaplusDB知识库】TcaplusDB刷新tbus通道介绍

Opencv_ 100 questions_ Chapter III (11-15)

leetcode 130. Surrounded regions (medium)

Web3 ecological decentralized financial platform sealem Finance

存储引擎分析

Web3技术栈权威指南【2022】

Swin_ Interpretation of transformer source code

200个C语言单词,请收藏!

Blue Bridge Cup_ Pick substring_ Combinatorial mathematics_ Multiplication principle/ Ruler method
随机推荐
Mmcv Config class introduction
【TcaplusDB知识库】TcaplusDB引擎参数调整介绍
Play electronics, poor three generations
CCF CSP 202109-1数组推导
[applet] vant sliding cell adds the function of clicking other positions to close automatically
【TcaplusDB知识库】TcaplusDB机器初始化和上架介绍
Niuke: expression evaluation
【TcaplusDB知识库】TcaplusDB推送配置介绍
smb匿名
[tcapulusdb knowledge base] tcapulusdb daily inspection introduction
That's great. The Ministry of industry and information technology has launched an internet account with a "one click unbinding" mobile phone number, which can be called an artifact
Sherri Monroe was appointed as the new executive director of the additive manufacturers green trade association
[tcapulusdb knowledge base] tcapulusdb refresh tbus channel introduction
MySQL master-slave replication solves read-write separation
Opencv_ 100 questions_ Chapter III (11-15)
[tcapulusdb knowledge base] tcapulusdb shard relocation introduction
Typescript - declaration files and built-in objects
Pki/tls Swiss Army knife cfssl
C语言内功修炼【整型在内存中的存储】
Digital twin: third person mouse operation