鲲鹏社区首页
中文
注册
开发者
我要评分
获取效率
正确性
完整性
易理解
在线提单
论坛求助

编译hnswlib

从GitHub和GitCode获取hnswlib开源代码和hnswlib补丁,应用补丁后编译hnswlib。

  1. 获取开源代码,假设安装路径为“/path/to”
    cd /path/to
    git clone -b v0.8.0 https://github.com/nmslib/hnswlib.git
  2. 下载hnswlib的Patch文件,假设安装路径为“/path/to”
    git clone -b v1.0.0 https://gitcode.com/boostkit/hnswlib.git k_hnswlib
  3. 应用Patch。
    cd hnswlib
    patch -p1 < ../k_hnswlib/0001-boostsra-hnswlib.patch
  4. 安装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
  5. 安装OpenMP、CMake、Make。
    yum install cmake libgomp make
  6. 安装HDF5库。
    yum install hdf5-devel
  7. 编译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向量化指令。