Verifying Compatibility
This section describes how to verify the compatibility of open source hnswlib with the Kunpeng platform. This section provides details on how to obtain the open source hnswlib code, compile the test script, and execute the test script.
hnswlib is an open source library that implements the HNSW algorithm. It uses a hierarchical greedy search strategy to quickly locate nearest neighbors and is widely used for efficient approximate nearest-neighbor (ANN) search. The following describes how to verify the compatibility of hnswlib.
- Download the open source hnswlib code.
git clone -b v0.8.0 https://github.com/nmslib/hnswlib.git cd /path/to/hnswlib
- Modify CMakeLists.txt.
vim CMakeLists.txt
Change -march=native to -march=armv8.2-a+dotprod.
Press Esc, type :wq!, and press Enter to save the file and exit.
- Add a test script.
vim run.sh
The content of the script file is as follows:rm -rf build mkdir build cd build cmake .. make cd ../tests/cpp python update_gen_data.py cd ../../build ./epsilon_search_test ./example_epsilon_search ./example_filter ./example_mt_filter ./example_mt_replace_deleted ./example_mt_search ./example_multivector_search ./example_replace_deleted ./example_search ./multiThreadLoad_test ./multiThread_replace_test ./multivector_search_test ./searchKnnCloserFirst_test ./searchKnnWithFilter_test ./test_updates ./test_updates update
- Run the following commands to make the script executable:
chmod +x run.sh
- Run the script to execute the test code.
./run.sh
The following figure shows the test result:

Parent topic: hnswlib Description