-
Notifications
You must be signed in to change notification settings - Fork 755
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add expann * Switch to a stable ann-benchmarks-specific branch of expann
- Loading branch information
Showing
5 changed files
with
202 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,6 +38,7 @@ jobs: | |
- dolphinnpy | ||
- elasticsearch | ||
- elastiknn | ||
- expann | ||
- faiss | ||
- flann | ||
- glass | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
FROM ann-benchmarks | ||
|
||
RUN apt update | ||
RUN apt install -y software-properties-common | ||
RUN add-apt-repository -y ppa:git-core/ppa | ||
RUN apt update | ||
RUN DEBIAN_FRONTEND=noninteractive apt install -y git make cmake g++ libaio-dev libgoogle-perftools-dev libunwind-dev clang-format libboost-dev libboost-program-options-dev libmkl-full-dev libcpprest-dev python3.10 nlohmann-json3-dev libeigen3-dev nlohmann-json3-dev valgrind | ||
|
||
ADD https://api.github.com/repos/jacketsj/expANN/git/refs/heads/ann-benchmarks-stable-v1 version.json | ||
RUN git clone -b main https://github.com/jacketsj/expANN.git | ||
RUN cd expANN && git submodule update --init --recursive | ||
RUN cd expANN && pip install pybind11 | ||
RUN cd expANN && bash build.sh | ||
|
||
ENV PYTHONPATH=$PYTHONPATH:/home/app/expANN/build | ||
|
||
WORKDIR /home/app | ||
|
||
RUN python3 -c "import expann_py" | ||
RUN python3 -c "import expann_py_64" | ||
RUN python3 -c "import expann_py_128" | ||
RUN python3 -c "import expann_py_256" | ||
RUN python3 -c "import expann_py_832" | ||
RUN python3 -c "import expann_py_960" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
float: | ||
any: | ||
- base_args: ['@metric'] | ||
constructor: ExpAnnWrapper | ||
disabled: false | ||
docker_tag: ann-benchmarks-expann | ||
module: ann_benchmarks.algorithms.expann | ||
name: expann | ||
run_groups: | ||
rg20_10: | ||
arg_groups: [{M: 20, ef_construction: 500, ortho_count: 1, prune_overflow: 0, use_compression: True}] | ||
args: {} | ||
query_args: [[10, 20, 30, 40, 50, 80, 120]] | ||
rg20_11: | ||
arg_groups: [{M: 20, ef_construction: 500, ortho_count: 1, prune_overflow: 1, use_compression: True}] | ||
args: {} | ||
query_args: [[10, 20, 30, 40, 50, 80, 120]] | ||
rg20_13: | ||
arg_groups: [{M: 20, ef_construction: 500, ortho_count: 1, prune_overflow: 3, use_compression: True}] | ||
args: {} | ||
query_args: [[10, 20, 30, 40, 50, 80, 120]] | ||
rg20_00: | ||
arg_groups: [{M: 20, ef_construction: 500, ortho_count: 1, prune_overflow: 0, use_compression: False}] | ||
args: {} | ||
query_args: [[10, 20, 30, 40, 50, 80, 120]] | ||
rg20_01: | ||
arg_groups: [{M: 20, ef_construction: 500, ortho_count: 1, prune_overflow: 1, use_compression: False}] | ||
args: {} | ||
query_args: [[10, 20, 30, 40, 50, 80, 120]] | ||
rg20_03: | ||
arg_groups: [{M: 20, ef_construction: 500, ortho_count: 1, prune_overflow: 3, use_compression: False}] | ||
args: {} | ||
query_args: [[10, 20, 30, 40, 50, 80, 120]] | ||
rg40_10: | ||
arg_groups: [{M: 40, ef_construction: 500, ortho_count: 1, prune_overflow: 0, use_compression: True}] | ||
args: {} | ||
query_args: [[10, 20, 30, 40, 50, 80, 120]] | ||
rg40_11: | ||
arg_groups: [{M: 40, ef_construction: 500, ortho_count: 1, prune_overflow: 1, use_compression: True}] | ||
args: {} | ||
query_args: [[10, 20, 30, 40, 50, 80, 120]] | ||
rg40_13: | ||
arg_groups: [{M: 40, ef_construction: 500, ortho_count: 1, prune_overflow: 3, use_compression: True}] | ||
args: {} | ||
query_args: [[10, 20, 30, 40, 50, 80, 120]] | ||
rg40_00: | ||
arg_groups: [{M: 40, ef_construction: 500, ortho_count: 1, prune_overflow: 0, use_compression: False}] | ||
args: {} | ||
query_args: [[10, 20, 30, 40, 50, 80, 120]] | ||
rg40_01: | ||
arg_groups: [{M: 40, ef_construction: 500, ortho_count: 1, prune_overflow: 1, use_compression: False}] | ||
args: {} | ||
query_args: [[10, 20, 30, 40, 50, 80, 120]] | ||
rg40_03: | ||
arg_groups: [{M: 40, ef_construction: 500, ortho_count: 1, prune_overflow: 3, use_compression: False}] | ||
args: {} | ||
query_args: [[10, 20, 30, 40, 50, 80, 120]] | ||
rg60_10: | ||
arg_groups: [{M: 60, ef_construction: 500, ortho_count: 1, prune_overflow: 0, use_compression: True}] | ||
args: {} | ||
query_args: [[10, 20, 30, 40, 50, 80, 120]] | ||
rg60_11: | ||
arg_groups: [{M: 60, ef_construction: 500, ortho_count: 1, prune_overflow: 1, use_compression: True}] | ||
args: {} | ||
query_args: [[10, 20, 30, 40, 50, 80, 120]] | ||
rg60_13: | ||
arg_groups: [{M: 60, ef_construction: 500, ortho_count: 1, prune_overflow: 3, use_compression: True}] | ||
args: {} | ||
query_args: [[10, 20, 30, 40, 50, 80, 120]] | ||
rg60_00: | ||
arg_groups: [{M: 60, ef_construction: 500, ortho_count: 1, prune_overflow: 0, use_compression: False}] | ||
args: {} | ||
query_args: [[10, 20, 30, 40, 50, 80, 120]] | ||
rg60_01: | ||
arg_groups: [{M: 60, ef_construction: 500, ortho_count: 1, prune_overflow: 1, use_compression: False}] | ||
args: {} | ||
query_args: [[10, 20, 30, 40, 50, 80, 120]] | ||
rg60_03: | ||
arg_groups: [{M: 60, ef_construction: 500, ortho_count: 1, prune_overflow: 3, use_compression: False}] | ||
args: {} | ||
query_args: [[10, 20, 30, 40, 50, 80, 120]] | ||
rg80_10: | ||
arg_groups: [{M: 80, ef_construction: 500, ortho_count: 1, prune_overflow: 0, use_compression: True}] | ||
args: {} | ||
query_args: [[10, 20, 30, 40, 50, 80, 120]] | ||
rg80_11: | ||
arg_groups: [{M: 80, ef_construction: 500, ortho_count: 1, prune_overflow: 1, use_compression: True}] | ||
args: {} | ||
query_args: [[10, 20, 30, 40, 50, 80, 120]] | ||
rg80_13: | ||
arg_groups: [{M: 80, ef_construction: 500, ortho_count: 1, prune_overflow: 3, use_compression: True}] | ||
args: {} | ||
query_args: [[10, 20, 30, 40, 50, 80, 120]] | ||
rg80_00: | ||
arg_groups: [{M: 80, ef_construction: 500, ortho_count: 1, prune_overflow: 0, use_compression: False}] | ||
args: {} | ||
query_args: [[10, 20, 30, 40, 50, 80, 120]] | ||
rg80_01: | ||
arg_groups: [{M: 80, ef_construction: 500, ortho_count: 1, prune_overflow: 1, use_compression: False}] | ||
args: {} | ||
query_args: [[10, 20, 30, 40, 50, 80, 120]] | ||
rg80_03: | ||
arg_groups: [{M: 80, ef_construction: 500, ortho_count: 1, prune_overflow: 3, use_compression: False}] | ||
args: {} | ||
query_args: [[10, 20, 30, 40, 50, 80, 120]] | ||
rg150_10: | ||
arg_groups: [{M: 150, ef_construction: 500, ortho_count: 1, prune_overflow: 0, use_compression: True}] | ||
args: {} | ||
query_args: [[10, 20, 30, 40, 50, 80, 120]] | ||
rg150_11: | ||
arg_groups: [{M: 150, ef_construction: 500, ortho_count: 1, prune_overflow: 1, use_compression: True}] | ||
args: {} | ||
query_args: [[10, 20, 30, 40, 50, 80, 120]] | ||
rg150_13: | ||
arg_groups: [{M: 150, ef_construction: 500, ortho_count: 1, prune_overflow: 3, use_compression: True}] | ||
args: {} | ||
query_args: [[10, 20, 30, 40, 50, 80, 120]] | ||
rg150_00: | ||
arg_groups: [{M: 150, ef_construction: 500, ortho_count: 1, prune_overflow: 0, use_compression: False}] | ||
args: {} | ||
query_args: [[10, 20, 30, 40, 50, 80, 120]] | ||
rg150_01: | ||
arg_groups: [{M: 150, ef_construction: 500, ortho_count: 1, prune_overflow: 1, use_compression: False}] | ||
args: {} | ||
query_args: [[10, 20, 30, 40, 50, 80, 120]] | ||
rg150_03: | ||
arg_groups: [{M: 150, ef_construction: 500, ortho_count: 1, prune_overflow: 3, use_compression: False}] | ||
args: {} | ||
query_args: [[10, 20, 30, 40, 50, 80, 120]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import numpy as np | ||
import expann_py as ep_nodim | ||
import expann_py_64 | ||
import expann_py_128 | ||
import expann_py_256 | ||
import expann_py_832 | ||
import expann_py_960 | ||
|
||
from ..base.module import BaseANN | ||
|
||
class ExpAnnWrapper(BaseANN): | ||
def __init__(self, metric, index_param): | ||
self._m = index_param["M"] | ||
self._ef_construction = index_param["ef_construction"] | ||
self._ortho_count = index_param["ortho_count"] | ||
self._prune_overflow = index_param["prune_overflow"] | ||
self._use_compression = index_param["use_compression"] | ||
self.name = "expANN Anti-Topo Engine" | ||
self.res = None | ||
self.metric = metric | ||
self.modules = { | ||
64: expann_py_64, | ||
128: expann_py_128, | ||
256: expann_py_256, | ||
832: expann_py_832, | ||
960: expann_py_960 | ||
} | ||
|
||
def get_module_for_dim(self, d): | ||
for dim in sorted(self.modules.keys()): | ||
if d <= dim: | ||
return dim, self.modules[dim] | ||
return d, ep_nodim | ||
|
||
def fit(self, X): | ||
self.dim_unpadded = X.shape[1] | ||
self.dim_padded, self.epy = self.get_module_for_dim(self.dim_unpadded) | ||
print("God padded dim:", self.dim_padded) | ||
self.engine = self.epy.AntitopoEngine(self._m, self._ef_construction, self._ortho_count, self._prune_overflow, self._use_compression) | ||
self.engine.store_many_vectors(X, self.metric == "angular") | ||
self.engine.build() | ||
|
||
def query(self, q, k): | ||
return self.engine.query_k_numpy(q, k) | ||
|
||
def set_query_arguments(self, ef_search): | ||
self.engine.set_ef_search(ef_search) |