These examples utilize LVQ and LeanVec interfaces which are available when linking to a SVS shared/static library, which are published with releases, as a tarball, pip wheel, or conda package. Note that these examples will not run after building the open source codebase without the shared/static library. These examples include:
- example_vamana_with_compression.cpp: Demonstrates building, searching, saving, and reloading a Vamana index with a LeanVec-compressed dataset.
- example_vamana_with_compression_lvq.cpp: Demonstrates building, searching, saving, and reloading a Vamana index with a LVQ-compressed dataset.
- example_vamana_with_compression_dynamic.cpp: Demonstrates building, searching, saving, and reloading a dynamic Vamana index (allows vector insertions and deletions over time) with a LeanVec-compressed dataset.
- example_ivf_with_compression_lvq.cpp: Demonstrates building, searching, saving, and reloading a Dynamic IVF index with a LVQ-compressed dataset.
- example_ivf_with_compression_leanvec.cpp: Demonstrates building, searching, saving, and reloading a Dynamic IVF index with a LeanVec-compressed dataset.
- example_ivf_with_compression_dynamic.cpp: Demonstrates building, searching, adding/deleting vectors, compacting, saving, and reloading a Dynamic IVF index with a LeanVec-compressed dataset (similar to the dynamic Vamana example).
Note: IVF examples require a shared/static library built with
SVS_EXPERIMENTAL_ENABLE_IVF=ON, and compiling the examples with-DSVS_ENABLE_IVF_EXAMPLES=ON. Additionally, Intel MKL must be available in the environment (e.g., by sourcingsource /opt/intel/oneapi/setvars.sh).
See CMakeLists.txt for details on linking to the SVS shared library.
The CMakeLists.txt is set up to detail usage of all options (tarball, pip, conda), and will prioritize utilization in the following order:
- System/Conda/Pip installation - If SVS is installed in a standard location that CMake can find
- GitHub Release download - If not found, it will download the tarball from GitHub
Install the libsvs package:
conda install -c https://software.repos.intel.com/python/conda libsvs
mkdir build
cd build
CC=gcc-11 CXX=g++-11 cmake ../
make -j
./example_vamana_with_compression_dynamicInstall the libsvs package and ensure CMake can find it by setting CMAKE_PREFIX_PATH:
pip install --index-url https://software.repos.intel.com/python/pypi libsvs
mkdir build
cd build
# Note that pip packages require setting CMAKE_PREFIX_PATH to find the library, conda handles this automatically
CC=gcc-11 CXX=g++-11 cmake -DCMAKE_PREFIX_PATH=$(python -c "import libsvs; print(libsvs.get_cmake_prefix_path())") ..
make -j
./example_vamana_with_compression_dynamicIf libsvs is not installed, CMake will download the tarball (see CMakeLists.txt for the necessary steps here):
mkdir build
cd build
CC=gcc-11 CXX=g++-11 cmake ../
make -j
./example_vamana_with_compression_dynamic