Kunpeng Math Library Acceleration
Installing the Kunpeng Math Library
Some machine learning algorithms (for example, PCA and SVD) use math libraries such as BLAS and LAPACK to implement math operations in algorithms. Kunpeng optimizes such math libraries so that the algorithm performance can be improved. Perform the following steps to install the Kunpeng Math Library on each management and data node in the cluster:
- Compile the JAR files and SO files related to netlib and jniloader based on the AArch64 architecture and upload them to the /opt/netlib/ directory.

- Install netlib dependencies.
- Install GCC.

- Install GFortran.
1yum install gcc-gfortran

- Install libblas.
1yum install blas-devel
View the installation result.
1ll /usr/lib64/ | grep libblas

- Install liblapack.
1yum install lapack-devel
View the installation result.
1ll /usr/lib64/ | grep liblapack

- Install GCC.
- Obtain and install the Kunpeng BLAS and LAPACK math libraries, and generate the KML_LAPACK dynamic library with complete functions by following instructions in Kunpeng Math Library Developer Guide.
- Create a soft link to the installed BLAS and LAPACK math libraries.
Example:
1 2 3 4
sudo update-alternatives --install /usr/lib64/libblas.so libblas.so /usr/local/kml_blas/lib/single/libkblas.so 1000 sudo update-alternatives --install /usr/lib64/libblas.so.3 libblas.so.3 /usr/local/kml_blas/lib/single/libkblas.so 1000 sudo update-alternatives --install /usr/lib64/liblapack.so liblapack.so /usr/local/kml_lapack/lib/libklapack-full.so 1000 sudo update-alternatives --install /usr/lib64/liblapack.so.3 liblapack.so.3 /usr/local/kml_lapack/lib/libklapack-full.so 1000
Verification:
1 2 3 4
sudo update-alternatives --display libblas.so sudo update-alternatives --display libblas.so.3 sudo update-alternatives --display liblapack.so sudo update-alternatives --display liblapack.so.3

Using the Kunpeng Math Library
When running Spark, add the following configuration:
1 2 3 4 |
--conf "spark.driver.extraLibraryPath=/opt/netlib" \ --conf "spark.executor.extraLibraryPath=/opt/netlib" \ --conf "spark.driver.extraClassPath=/opt/netlib/*:lib/boostkit-ml-acc_2.11-2.1.0-spark2.3.2.jar:lib/boostkit-ml-core_2.11-2.1.0-spark2.3.2.jar:lib/boostkit-ml-kernel_2.11-2.1.0-spark2.3.2-aarch64.jar" \ --conf "spark.executor.extraClassPath=/opt/netlib/*" \ |
Parent topic: Tuning Process
