Rate This Document
Findability
Accuracy
Completeness
Readability

Modifying the Source Code

  1. Click View Suggested Source Code in the lower part of the source code porting report. See Figure 1.
    Figure 1 Source code porting suggestions
  2. Under File list on the left, switch between files to view the source code modification suggestions. See Figure 2.
    Figure 2 File list
  3. According to the porting report, five files need to be modified. On the Source Code Porting Suggestions page, check the modification suggestions for each file and modify the source code based on the suggestions.

Modifying Makefile

On the Source Code Porting Suggestions page, view the suggestions for modifying the Makefile file. See the following figure:

Figure 3 Suggestions for modifying Makefile

According to the preceding suggestions, add -march=armv8.2-a -fsigned-char to the FLAGS variable in Makefile.

This sample uses Kunpeng 920 as an example. The compilation options may vary depending on the platform.

Figure 4 Suggestion 2 for modifying Makefile

Obtain the Kunpeng system library (version 2.3.1) from the link in the suggestion and install the library. Add -I /usr/local/ksl/include/ -L /usr/local/ksl/lib/ -lavx2ki -lm to the end of the FLAGS variable.

Figure 5 shows the new code (the x86_64 branch and AArch64 branch are distinguished during the modification).

Figure 5 New code

Modifying file_lock.c

On the Source Code Porting Suggestions page, view the suggestions for modifying file_lock.c. There are three modification points. See Figure 6.

Figure 6 Suggestions for modifying file_lock.c
  1. Figure 7 shows the porting suggestion.
    Figure 7 Porting suggestion (1)

    Click Quick Fix > Replace with Suggested Code. See Figure 8.

    Figure 8 Quick Fix

    Check whether the replacement code in Suggestion is proper based on the note in Description.

    If the replacement code is proper, delete the comment characters (//). Figure 9 shows the new code.

    Figure 9 New code
  2. Figure 10 shows the porting suggestion.
    Figure 10 Porting suggestion (2)

    Click Quick Fix > Replace with Suggested Code. See Figure 11.

    Figure 11 Quick Fix
  3. Figure 12 shows the porting suggestion.
    Figure 12 Porting suggestion (3)

    Click Quick Fix > Replace with Suggested Code. See Figure 13.

    Figure 13 Quick Fix

    Check whether the replacement code in Suggestion is proper based on the note in Description.

    If the replacement code is proper, delete the comment characters (//). Figure 14 shows the new code.

    Figure 14 New code

Modifying ksw.c

On the Source Code Porting Suggestions page, view the suggestions for modifying ksw.c. See Figure 15.

Figure 15 Suggestions for modifying ksw.c

The preceding information is about the usage of the intrinsic function. According to the suggestions, add the avx2ki.h header file to ksw.c. Figure 16 shows the new code.

Figure 16 New code

Modifying ksw.h

On the Source Code Porting Suggestions page, view the suggestions for modifying ksw.h. There are two modification points. See Figure 17.

Figure 17 Suggestions for modifying ksw.h
  1. Figure 18 shows the porting suggestion.
    Figure 18 Porting suggestion (1)

    Click Quick Fix > Batch Apply This Suggestion. See Figure 19.

    Figure 19 Quick Fix
  2. Figure 20 shows the porting suggestion.
    Figure 20 Porting suggestion (2)

    Click Quick Fix > Replace with Suggested Code, as shown in Figure 21. The Kunpeng system library does not need to be installed again.

    Figure 21 Quick Fix

Modifying interface.s

On the Source Code Porting Suggestions page, view the suggestions for modifying the interface.s assembly file. See Figure 22.

Figure 22 Suggestions for modifying interface.s

Click Quick Fix > Replace with Suggested Code. Figure 23 shows the new code.

Figure 23 New code