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 languages. Some interfaces are encapsulated using Java. Table 1 shows the composition of the KML.
No. |
Library |
Description |
Application Scenario |
|---|---|---|---|
1 |
KML_BLAS |
Based on the Kunpeng architecture, KML_BLAS performs in-depth mining on the computing efficiency of Basic Linear Algebra Subprograms (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 |
KML_SPBLAS (Sparse Basic Linear Algebra Subprograms) is a basic linear algebra operation library of sparse matrices. It provides high-performance vector and matrix operations for sparse matrices in packed 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 |
KML_VML (Vector Mathematical Library) 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, including power functions, trigonometric functions, exponential functions, hyperbolic functions, and logarithmic functions |
4 |
KML_MATH |
KML_MATH is a math library for basic operations. It provides functions with high performance that is based on Kunpeng processors by means of periodic function specifications and algorithm improvement. |
Basic mathematical operations, including trigonometric, logarithmic, exponential, and power functions |
5 |
KML_FFT |
KML_FFT is a math library of fast Fourier transform (FFT). 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 transforms |
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 equations, eigenvalue, and singular value problems |
7 |
KML_SVML |
KML_SVML (Short Vector Math Library) processes input vectors in batches 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, including power functions, trigonometric functions, exponential functions, hyperbolic functions, and logarithmic functions |
8 |
KML_SOLVER |
KML_SOLVER is a library for solving the system of linear equations. KML_SOLVER that supports multiple threads on a single node uses the preconditioned conjugate gradient (PCG) and generalized conjugate residual (GCR) methods. KML_SOLVER that supports multiple processes in a cluster uses the conjugate gradient (CG) and Cholesky factorization (LLT/LLH) methods. |
Single-node mode: The system of linear equations for a sparse general matrix or sparse symmetric positive definite matrix are solved iteratively. Cluster mode: The system of linear equations for a sparse symmetric positive definite matrix is solved iteratively, and the system of linear equations for a Hermitian positive definite matrix is solved directly. |
9 |
KML_JAVA |
A KML math library encapsulated in Java based on the JNI technology. |
BLAS and VML |
10 |
KML_SCALAPACK |
KML_ScaLAPACK is a distributed library for linear algebra operations on the Kunpeng platform. It optimizes the computing efficiency of the native Scalable Linear Algebra PACKage (ScaLAPACK) library by means of block division, algorithm combination, and multi-process optimization. |
Linear equation system operations, including solving equations, eigenvalue, and singular value problems |
11 |
KML_VSL |
KML_VSL (Vector Statistical Library) provides multiple random number generation functions. You can use it to generate random numbers that conform to different distributions. |
Generating random numbers that conform to different distributions |
KML is available only for Kunpeng processors.
To achieve the optimal performance, the KML interface does not verify all input parameters. The validity of input parameters is ensured by the service that calls 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.