编译hnswlib
从GitHub和GitCode获取hnswlib开源代码和hnswlib补丁,应用补丁后编译hnswlib。
- 获取开源代码,假设安装路径为“/path/to”。
cd /path/to git clone -b v0.8.0 https://github.com/nmslib/hnswlib.git
- 下载hnswlib的Patch文件,假设安装路径为“/path/to”。
git clone -b v1.0.0 https://gitcode.com/boostkit/hnswlib.git k_hnswlib
- 应用Patch。
cd hnswlib patch -p1 < ../k_hnswlib/0001-boostsra-hnswlib.patch
- 安装GCC 12.3.1与GCC-C++ 12.3.1。
yum install gcc-toolset-12-gcc gcc-toolset-12-gcc-c++ export PATH=/opt/openEuler/gcc-toolset-12/root/usr/bin/:$PATH export LD_LIBRARY_PATH=/opt/openEuler/gcc-toolset-12/root/usr/lib64/:$LD_LIBRARY_PATH
- 安装OpenMP、CMake、Make。
yum install cmake libgomp make
- 安装HDF5库。
yum install hdf5-devel
- 编译hnswlib源码。
make hnswlib_neon_test make hnswlib_sve_test make hnswlib_fp16_neon_test make hnswlib_fp16_sve_test
编译选项说明:
- hnswlib_neon_test:FP32数据类型使用NEON向量化指令。
- hnswlib_sve_test:FP32数据类型使用SVE向量化指令。
- hnswlib_fp16_neon_test:FP16数据类型使用NEON向量化指令。
- hnswlib_fp16_sve_test:FP16数据类型使用SVE向量化指令。
父主题: 安装配置环境