Skip to content

Latest commit

 

History

History
157 lines (124 loc) · 8.07 KB

File metadata and controls

157 lines (124 loc) · 8.07 KB

AiSAQ-DiskANN

AiSAQ (All-in-Storage ANNS with Product Quantization) is a scalable, DRAM-free method for approximate nearest neighbor search (ANNS). AiSAQ can now be tuned for best performance by storing all PQ vectors inline as part of the node, for minimum cost by reading the PQ vectors on demand, or, anywhere in between by storing some of the PQ vectors inline. This code was forked from code for Microsoft DiskANN algorithm. The index search is described in our arXiv paper.

AiSAQ-DiskANN includes the following enhancements:

  1. Scalable & DRAM-free search - The PQ vectors are not loaded into DRAM during disk-index-search, instead they are being read from the media on demand.
  2. Inline PQ vectors - Some or all PQ vectors can be stored as part of the index node, which saves I/O operations during during a search.
  3. Vectors rearrangement - An optimal rearrangement of the vectors to minimize the number of I/O operations required to read the PQ vectors from the media during a search.
  4. Multiple entry points - Generate multiple entry points to minimize the number of search iterations.
  5. Vector beamwidth - Tune the number of nodes used in each greedy search iteration; this parallelizes the I/O operations for reading PQ vectors.
  6. Greedy search algorithm improvements.
  7. Static PQ vectors cache - A common static cache of PQ vectors, which is populated during the loading phase before the search.
  8. Dynamic PQ vectors read cache - A dynamic page level read cache of PQ vectors, which is managed per-thread using LRU eviction policy.

The usage of our additional AiSAQ indices is described below:

Installation notes

liburing is used for asynchronous reading the PQ vectors from the media. Make sure liburing-dev is installed.

sudo apt install liburing-dev

You might need to increase aio-max-nr value. Append the following line to the file /etc/sysctl.conf

fs.aio-max-nr = 1048576

To apply new setting, run:

sysctl -p /etc/sysctl.conf

Please cite this software in your work as:

@misc{aisaq-diskann,
    author = {Shimon Tsalmon, Kento Tatsuno, Daisuke Miyashita},
    title = {AiSAQ-DiskANN: Scalable implementation for ANNS based on DiskANN},
    url = {https://github.com/KioxiaAmerica/aisaq-diskann},
    year = {2025}
}

DiskANN

DiskANN Main PyPI version Downloads shield License: MIT

DiskANN Paper DiskANN Paper DiskANN Paper

DiskANN is a suite of scalable, accurate and cost-effective approximate nearest neighbor search algorithms for large-scale vector search that support real-time changes and simple filters. This code is based on ideas from the DiskANN, Fresh-DiskANN and the Filtered-DiskANN papers with further improvements. This code forked off from code for NSG algorithm.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

See guidelines for contributing to this project.

Linux build:

Install the following packages through apt-get

sudo apt install make cmake g++ libaio-dev libgoogle-perftools-dev clang-format libboost-all-dev

Install Intel MKL

Ubuntu 20.04 or newer

sudo apt install libmkl-full-dev

Earlier versions of Ubuntu

Install Intel MKL either by downloading the oneAPI MKL installer or using apt (we tested with build 2019.4-070 and 2022.1.2.146).

# OneAPI MKL Installer
wget https://registrationcenter-download.intel.com/akdlm/irc_nas/18487/l_BaseKit_p_2022.1.2.146.sh
sudo sh l_BaseKit_p_2022.1.2.146.sh -a --components intel.oneapi.lin.mkl.devel --action install --eula accept -s

Build

mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Release .. && make -j 

Windows build:

The Windows version has been tested with Enterprise editions of Visual Studio 2022, 2019 and 2017. It should work with the Community and Professional editions as well without any changes.

Prerequisites:

  • CMake 3.15+ (available in VisualStudio 2019+ or from https://cmake.org)
  • NuGet.exe (install from https://www.nuget.org/downloads)
  • The build script will use NuGet to get MKL, OpenMP and Boost packages.
  • DiskANN git repository checked out together with submodules. To check out submodules after git clone:
git submodule init
git submodule update
  • Environment variables:
  • [optional] If you would like to override the Boost library listed in windows/packages.config.in, set BOOST_ROOT to your Boost folder.

Build steps:

  • Open the "x64 Native Tools Command Prompt for VS 2019" (or corresponding version) and change to DiskANN folder
  • Create a "build" directory inside it
  • Change to the "build" directory and run
cmake ..

OR for Visual Studio 2017 and earlier:

<full-path-to-installed-cmake>\cmake ..

This will create a diskann.sln solution. Now you can:

  • Open it from VisualStudio and build either Release or Debug configuration.
  • <full-path-to-installed-cmake>\cmake --build build
  • Use MSBuild:
msbuild.exe diskann.sln /m /nologo /t:Build /p:Configuration="Release" /property:Platform="x64"
  • This will also build gperftools submodule for libtcmalloc_minimal dependency.
  • Generated binaries are stored in the x64/Release or x64/Debug directories.

Usage:

Please see the following pages on using the compiled code:

Please cite this software in your work as:

@misc{diskann-github,
   author = {Simhadri, Harsha Vardhan and Krishnaswamy, Ravishankar and Srinivasa, Gopal and Subramanya, Suhas Jayaram and Antonijevic, Andrija and Pryce, Dax and Kaczynski, David and Williams, Shane and Gollapudi, Siddarth and Sivashankar, Varun and Karia, Neel and Singh, Aditi and Jaiswal, Shikhar and Mahapatro, Neelam and Adams, Philip and Tower, Bryan and Patel, Yash}},
   title = {{DiskANN: Graph-structured Indices for Scalable, Fast, Fresh and Filtered Approximate Nearest Neighbor Search}},
   url = {https://github.com/Microsoft/DiskANN},
   version = {0.6.1},
   year = {2023}
}