Overview
Kunpeng Math Library
The Kunpeng Math Library (KML) provides high-performance mathematical functions which are optimized based on the Kunpeng platform. All interfaces are implemented by C/C++ and assembly language. Table 1 shows the composition of a KML.
No. |
Library |
Description |
Application Scenario |
|---|---|---|---|
1 |
KML_BLAS |
Based on the Kunpeng architecture, Basic Linear Algebra Subprograms (KML_BLAS) performs in-depth mining on the computing efficiency of BLAS by means of vectorization, data prefetch, compilation optimization, and data rearrangement. As a result, the performance of BLAS interface functions approaches the theoretical peak value. |
Vector-vector operation Vector-matrix operation Matrix-matrix operation |
2 |
KML_SPBLAS |
Sparse Basic Linear Algebra Subprograms (KML_SPBLAS) is a basic linear algebra operation library of sparse matrices. It provides high-performance vector and matrix operations for sparse matrices in compressed format based on the Kunpeng architecture. Based on the instruction set and architecture features of Kunpeng, a high-performance sparse matrix operation library is developed to improve the service performance of HPC and big data solutions. |
Sparse vector-vector operation Sparse vector-matrix operation Sparse matrix-matrix operation |
3 |
KML_VML |
Vector Mathematical Library (KML_VML) performs vectorization on input data by using methods such as NEON instruction optimization and inline assembly. It makes full use of register features in the Kunpeng architecture to improve performance of Kunpeng servers. |
Vector mathematical operations include power functions, trigonometric functions, exponential functions, hyperbolic functions, and logarithmic functions |
4 |
KML_MATH |
KML_MATH is a mathematical library for basic operations. It provides functions with high performance that is based on Kunpeng processors by means of Periodic function range reduction and algorithm improvement. |
Basic mathematical operations, including trigonometric, logarithmic, exponential, and power functions |
5 |
KML_FFT |
Fast Fourier Transform (KML_FFT) is a mathematical library of fast Fourier transform. It is the fast computing methods of discrete Fourier transform (DFT) and inverse discrete Fourier transform (IDFT), and is widely used in the fields of engineering, science, and mathematics. KML_FFT reduces the complexity of Fourier transform calculation from O(n2) to O(n log n), and is listed in the top 10 algorithms of the 20th century by the IEEE Computing in Science & Engineering. |
FFT C2C, C2R, R2C, and R2R transformation |
6 |
KML_LAPACK |
KML_LAPACK optimizes the Linear Algebra PACKage (LAPACK) computing efficiency based on the Kunpeng architecture by means of block division, algorithm combination, multi-thread, and BLAS interface optimization. |
Linear equation system operations, including solving linear equations, as well as the eigenvalue and singular value problems, etc. |
KML applies only to Kunpeng processors.
To achieve optimal performance, the KML interface does not verify all input parameters. The validity of input parameters is ensured by the service that invokes the interface.
This document provides the installation guide, detailed interface definition, and sample code of the Kunpeng math library to help users quickly get familiar with KML.
File Structure of the Source Package
The source package of KML contains six folders: KML_BLAS, KML_SPBLAS, KML_VML, KML_MATH, KML_FFT, and KML_LAPACK, which correspond to the six libraries in Table 1. Table 2 describes the file structure of the source package.
Folder |
Subfolder/File |
Description |
|---|---|---|
KML_BLAS |
build |
The build folder contains the following files:
|
source |
This folder stores all source files related to KML_BLAS. It contains the following folders and files:
|
|
KML_SPBLAS |
include |
Folder for storing header files |
src |
Folder for storing the KML_SPBLAS source code files |
|
build.sh |
Script for building KML_SPBLAS |
|
CMakeLists.txt |
CMake file for compiling KML_SPBLAS |
|
config.xml |
Common configuration information of KML_SPBLAS |
|
toolchain.cmake |
CMake compilation configuration file of KML_SPBLAS |
|
KML_VML |
include |
Folder for storing the header files of the KML_VML library functions. |
src |
Stores the source files for implementing the KML_VML library functions. |
|
build.sh |
Script for compiling KML_VML |
|
CMakeLists.txt |
CMake file for compiling KML_VML |
|
KML_MATH |
src |
Folder for storing the source files for implementing the KML_MATH library functions |
include |
Folder for storing the header files of the KML_MATH library functions |
|
licenses |
Folder for storing the copyright interface definitions of the KML_MATH library |
|
build.sh |
Script for compiling the KML_MATH library |
|
CMakeLists.txt |
CMake file for compiling the KML_MATH library |
|
KML_FFT |
include |
Folder for storing the header files of the KML_FFT library functions |
src |
Folder for storing the source files for implementing the KML_FFT library functions |
|
build.sh |
Compilation script file of the KML_FFT library |
|
clean.sh |
Script for deleting the KML_FFT library |
|
CMakeLists.txt |
CMake file for compiling the KML_FFT library |
|
config.xml |
Common configuration file of the KML_FFT library |
|
KML_LAPACK |
cmake |
CMake compilation script file |
libkml |
Folder for storing the implementation source files of the KML_LAPACK functions |
|
util |
Auxiliary scripts used during compilation |
|
build.sh |
Script for compiling the KML_LAPACK library |
|
CMakeLists.txt |
CMake file for compiling the KML_LAPACK library |
|
config.cmake.in |
Compilation configuration file of the KML_LAPACK library |
