elips 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (171) hide show
  1. elips-1.0.0/LICENSE +21 -0
  2. elips-1.0.0/MANIFEST.in +10 -0
  3. elips-1.0.0/PKG-INFO +80 -0
  4. elips-1.0.0/README.md +54 -0
  5. elips-1.0.0/core_src/CMakeLists.txt +199 -0
  6. elips-1.0.0/core_src/benchmarks/BenchMain.cpp +154 -0
  7. elips-1.0.0/core_src/benchmarks/gpu/BenchGpuSearch.cpp +91 -0
  8. elips-1.0.0/core_src/bindings/python/elips_python.cpp +1326 -0
  9. elips-1.0.0/core_src/cli/src/Json.hpp +195 -0
  10. elips-1.0.0/core_src/cli/src/main.cpp +261 -0
  11. elips-1.0.0/core_src/include/elips/Config.hpp +187 -0
  12. elips-1.0.0/core_src/include/elips/domain/Errors.hpp +46 -0
  13. elips-1.0.0/core_src/include/elips/domain/Record.hpp +53 -0
  14. elips-1.0.0/core_src/include/elips/domain/RecordID.hpp +47 -0
  15. elips-1.0.0/core_src/include/elips/domain/SearchResult.hpp +22 -0
  16. elips-1.0.0/core_src/include/elips/domain/Vector.hpp +52 -0
  17. elips-1.0.0/core_src/include/elips/elips.hpp +250 -0
  18. elips-1.0.0/core_src/include/elips/gpu_engine/DynamicBatcher.hpp +75 -0
  19. elips-1.0.0/core_src/include/elips/gpu_engine/GpuBruteForceIndex.hpp +69 -0
  20. elips-1.0.0/core_src/include/elips/gpu_engine/GpuBuffer.hpp +57 -0
  21. elips-1.0.0/core_src/include/elips/gpu_engine/GpuConfig.hpp +89 -0
  22. elips-1.0.0/core_src/include/elips/gpu_engine/GpuDeviceInfo.hpp +42 -0
  23. elips-1.0.0/core_src/include/elips/gpu_engine/GpuDeviceManager.hpp +35 -0
  24. elips-1.0.0/core_src/include/elips/gpu_engine/GpuDistributedIndex.hpp +67 -0
  25. elips-1.0.0/core_src/include/elips/gpu_engine/GpuGraphIndex.hpp +76 -0
  26. elips-1.0.0/core_src/include/elips/gpu_engine/GpuHybridIndex.hpp +58 -0
  27. elips-1.0.0/core_src/include/elips/gpu_engine/GpuIVFFlatIndex.hpp +71 -0
  28. elips-1.0.0/core_src/include/elips/gpu_engine/GpuIVFPQIndex.hpp +75 -0
  29. elips-1.0.0/core_src/include/elips/gpu_engine/GpuIndexPort.hpp +49 -0
  30. elips-1.0.0/core_src/include/elips/gpu_engine/GpuIndexTransferManager.hpp +29 -0
  31. elips-1.0.0/core_src/include/elips/gpu_engine/GpuIngestionPipeline.hpp +33 -0
  32. elips-1.0.0/core_src/include/elips/gpu_engine/GpuKernelPort.hpp +40 -0
  33. elips-1.0.0/core_src/include/elips/gpu_engine/GpuMemoryManager.hpp +64 -0
  34. elips-1.0.0/core_src/include/elips/gpu_engine/GpuMemoryPool.hpp +46 -0
  35. elips-1.0.0/core_src/include/elips/gpu_engine/GpuMemoryPort.hpp +33 -0
  36. elips-1.0.0/core_src/include/elips/gpu_engine/GpuMetricsSnapshot.hpp +30 -0
  37. elips-1.0.0/core_src/include/elips/gpu_engine/GpuPort.hpp +90 -0
  38. elips-1.0.0/core_src/include/elips/gpu_engine/GpuProfiler.hpp +31 -0
  39. elips-1.0.0/core_src/include/elips/gpu_engine/GpuQuantizationPipeline.hpp +36 -0
  40. elips-1.0.0/core_src/include/elips/gpu_engine/GpuSearchPipeline.hpp +36 -0
  41. elips-1.0.0/core_src/include/elips/gpu_engine/GpuSelector.hpp +25 -0
  42. elips-1.0.0/core_src/include/elips/gpu_engine/GpuStreamPort.hpp +21 -0
  43. elips-1.0.0/core_src/include/elips/gpu_engine/PinnedBuffer.hpp +49 -0
  44. elips-1.0.0/core_src/include/elips/gpu_engine/UnifiedBuffer.hpp +31 -0
  45. elips-1.0.0/core_src/include/elips/index_engine/ExactIndex.hpp +48 -0
  46. elips-1.0.0/core_src/include/elips/index_engine/HierarchicalGraphIndex.hpp +82 -0
  47. elips-1.0.0/core_src/include/elips/index_engine/IndexFactory.hpp +29 -0
  48. elips-1.0.0/core_src/include/elips/index_engine/IndexPort.hpp +41 -0
  49. elips-1.0.0/core_src/include/elips/index_engine/IndexSnapshot.hpp +55 -0
  50. elips-1.0.0/core_src/include/elips/index_engine/IndexTransferPort.hpp +24 -0
  51. elips-1.0.0/core_src/include/elips/kernel/LockManager.hpp +39 -0
  52. elips-1.0.0/core_src/include/elips/metadata/Filter.hpp +81 -0
  53. elips-1.0.0/core_src/include/elips/metadata/MetadataIndex.hpp +31 -0
  54. elips-1.0.0/core_src/include/elips/query_engine/AST.hpp +58 -0
  55. elips-1.0.0/core_src/include/elips/query_engine/EQLLexer.hpp +24 -0
  56. elips-1.0.0/core_src/include/elips/query_engine/EQLParser.hpp +22 -0
  57. elips-1.0.0/core_src/include/elips/query_engine/QueryExecutor.hpp +26 -0
  58. elips-1.0.0/core_src/include/elips/storage/Serialization.hpp +181 -0
  59. elips-1.0.0/core_src/include/elips/storage/WAL.hpp +61 -0
  60. elips-1.0.0/core_src/include/elips/text_engine/LocalTextEmbedder.hpp +67 -0
  61. elips-1.0.0/core_src/include/elips/text_engine/TextEmbedderPort.hpp +88 -0
  62. elips-1.0.0/core_src/include/elips/vector_engine/Metrics.hpp +24 -0
  63. elips-1.0.0/core_src/src/Database.cpp +1419 -0
  64. elips-1.0.0/core_src/src/EQLLexer.cpp +98 -0
  65. elips-1.0.0/core_src/src/EQLParser.cpp +296 -0
  66. elips-1.0.0/core_src/src/ExactIndex.cpp +89 -0
  67. elips-1.0.0/core_src/src/Filter.cpp +233 -0
  68. elips-1.0.0/core_src/src/HierarchicalGraphIndex.cpp +275 -0
  69. elips-1.0.0/core_src/src/IndexFactory.cpp +51 -0
  70. elips-1.0.0/core_src/src/LocalTextEmbedder.cpp +429 -0
  71. elips-1.0.0/core_src/src/LockManager.cpp +42 -0
  72. elips-1.0.0/core_src/src/MetadataIndex.cpp +102 -0
  73. elips-1.0.0/core_src/src/Metrics.cpp +146 -0
  74. elips-1.0.0/core_src/src/QueryExecutor.cpp +156 -0
  75. elips-1.0.0/core_src/src/RecordID.cpp +97 -0
  76. elips-1.0.0/core_src/src/WAL.cpp +160 -0
  77. elips-1.0.0/core_src/src/gpu_engine/CMakeLists.txt +84 -0
  78. elips-1.0.0/core_src/src/gpu_engine/DynamicBatcher.cpp +125 -0
  79. elips-1.0.0/core_src/src/gpu_engine/GpuBruteForceIndex.cpp +237 -0
  80. elips-1.0.0/core_src/src/gpu_engine/GpuDeviceManager.cpp +238 -0
  81. elips-1.0.0/core_src/src/gpu_engine/GpuDistributedIndex.cpp +327 -0
  82. elips-1.0.0/core_src/src/gpu_engine/GpuGraphIndex.cpp +239 -0
  83. elips-1.0.0/core_src/src/gpu_engine/GpuHybridIndex.cpp +174 -0
  84. elips-1.0.0/core_src/src/gpu_engine/GpuIVFFlatIndex.cpp +207 -0
  85. elips-1.0.0/core_src/src/gpu_engine/GpuIVFPQIndex.cpp +350 -0
  86. elips-1.0.0/core_src/src/gpu_engine/GpuIndexTransferManager.cpp +31 -0
  87. elips-1.0.0/core_src/src/gpu_engine/GpuIngestionPipeline.cpp +50 -0
  88. elips-1.0.0/core_src/src/gpu_engine/GpuMemoryManager.cpp +139 -0
  89. elips-1.0.0/core_src/src/gpu_engine/GpuMemoryPool.cpp +81 -0
  90. elips-1.0.0/core_src/src/gpu_engine/GpuProfiler.cpp +25 -0
  91. elips-1.0.0/core_src/src/gpu_engine/GpuQuantizationPipeline.cpp +122 -0
  92. elips-1.0.0/core_src/src/gpu_engine/GpuSearchPipeline.cpp +39 -0
  93. elips-1.0.0/core_src/src/gpu_engine/GpuSelector.cpp +67 -0
  94. elips-1.0.0/core_src/src/gpu_engine/backends/cuda/CMakeLists.txt +27 -0
  95. elips-1.0.0/core_src/src/gpu_engine/backends/cuda/CudaBackend.cpp +4 -0
  96. elips-1.0.0/core_src/src/gpu_engine/backends/cuda/CudaBackend.hpp +62 -0
  97. elips-1.0.0/core_src/src/gpu_engine/backends/cuda/kernels/cosine_fp32.cu +30 -0
  98. elips-1.0.0/core_src/src/gpu_engine/backends/hip/CMakeLists.txt +17 -0
  99. elips-1.0.0/core_src/src/gpu_engine/backends/hip/HipBackend.cpp +4 -0
  100. elips-1.0.0/core_src/src/gpu_engine/backends/hip/HipBackend.hpp +53 -0
  101. elips-1.0.0/core_src/src/gpu_engine/backends/hip/kernels/cosine_fp32.hip +6 -0
  102. elips-1.0.0/core_src/src/gpu_engine/backends/metal/CMakeLists.txt +31 -0
  103. elips-1.0.0/core_src/src/gpu_engine/backends/metal/MetalBackend.hpp +62 -0
  104. elips-1.0.0/core_src/src/gpu_engine/backends/metal/MetalBackend.mm +272 -0
  105. elips-1.0.0/core_src/src/gpu_engine/backends/metal/shaders/elips_distance_kernels.metal +111 -0
  106. elips-1.0.0/core_src/src/gpu_engine/backends/sycl/CMakeLists.txt +16 -0
  107. elips-1.0.0/core_src/src/gpu_engine/backends/sycl/SyclBackend.cpp +4 -0
  108. elips-1.0.0/core_src/src/gpu_engine/backends/sycl/SyclBackend.hpp +53 -0
  109. elips-1.0.0/core_src/src/gpu_engine/backends/sycl/kernels/cosine_fp32.cpp +5 -0
  110. elips-1.0.0/core_src/src/gpu_engine/backends/vulkan/CMakeLists.txt +21 -0
  111. elips-1.0.0/core_src/src/gpu_engine/backends/vulkan/VulkanBackend.cpp +4 -0
  112. elips-1.0.0/core_src/src/gpu_engine/backends/vulkan/VulkanBackend.hpp +53 -0
  113. elips-1.0.0/core_src/src/gpu_engine/backends/vulkan/shaders/cosine_fp32.comp +55 -0
  114. elips-1.0.0/core_src/src/gpu_engine/backends/vulkan/shaders/dot_product_fp32.comp +41 -0
  115. elips-1.0.0/core_src/src/gpu_engine/backends/vulkan/shaders/euclidean_fp32.comp +42 -0
  116. elips-1.0.0/core_src/src/gpu_engine/detail/IvfIndexState.cpp +520 -0
  117. elips-1.0.0/core_src/src/gpu_engine/detail/IvfIndexState.hpp +126 -0
  118. elips-1.0.0/core_src/tests/concurrency/multi_reader_test.cpp +133 -0
  119. elips-1.0.0/core_src/tests/concurrency/single_writer_test.cpp +35 -0
  120. elips-1.0.0/core_src/tests/integration/gpu/DatabaseGpuLifecycleProbe.cpp +54 -0
  121. elips-1.0.0/core_src/tests/integration/gpu/MetalBackendTest.cpp +209 -0
  122. elips-1.0.0/core_src/tests/integration/local_text_embedder_test.cpp +241 -0
  123. elips-1.0.0/core_src/tests/integration/roundtrip_test.cpp +261 -0
  124. elips-1.0.0/core_src/tests/integration/transaction_filter_test.cpp +82 -0
  125. elips-1.0.0/core_src/tests/parity/CpuGpuRecallParityTest.cpp +89 -0
  126. elips-1.0.0/core_src/tests/python/README.md +34 -0
  127. elips-1.0.0/core_src/tests/python/test_bindings.py +1161 -0
  128. elips-1.0.0/core_src/tests/python/test_local_embedder.py +217 -0
  129. elips-1.0.0/core_src/tests/recovery/wal_recovery_test.cpp +169 -0
  130. elips-1.0.0/core_src/tests/unit/config_test.cpp +110 -0
  131. elips-1.0.0/core_src/tests/unit/durability_test.cpp +110 -0
  132. elips-1.0.0/core_src/tests/unit/eql_edge_test.cpp +127 -0
  133. elips-1.0.0/core_src/tests/unit/eql_test.cpp +75 -0
  134. elips-1.0.0/core_src/tests/unit/exact_edge_cases_test.cpp +98 -0
  135. elips-1.0.0/core_src/tests/unit/exact_index_test.cpp +76 -0
  136. elips-1.0.0/core_src/tests/unit/filter_edge_test.cpp +133 -0
  137. elips-1.0.0/core_src/tests/unit/gpu/DynamicBatcherTest.cpp +103 -0
  138. elips-1.0.0/core_src/tests/unit/gpu/GpuAdvancedIndexTest.cpp +294 -0
  139. elips-1.0.0/core_src/tests/unit/gpu/GpuBruteForceIndexTest.cpp +63 -0
  140. elips-1.0.0/core_src/tests/unit/gpu/GpuDeviceManagerTest.cpp +166 -0
  141. elips-1.0.0/core_src/tests/unit/gpu/GpuMemoryManagerTest.cpp +118 -0
  142. elips-1.0.0/core_src/tests/unit/gpu/TestRecordingBackend.hpp +150 -0
  143. elips-1.0.0/core_src/tests/unit/hnsw_edge_cases_test.cpp +136 -0
  144. elips-1.0.0/core_src/tests/unit/hnsw_recall_test.cpp +86 -0
  145. elips-1.0.0/core_src/tests/unit/metadata_index_test.cpp +90 -0
  146. elips-1.0.0/core_src/tests/unit/metrics_test.cpp +43 -0
  147. elips-1.0.0/core_src/tests/unit/record_id_test.cpp +43 -0
  148. elips-1.0.0/core_src/tests/unit/scan_test.cpp +93 -0
  149. elips-1.0.0/core_src/tests/unit/vector_test.cpp +89 -0
  150. elips-1.0.0/elips/__init__.py +29 -0
  151. elips-1.0.0/elips/_core.pyi +924 -0
  152. elips-1.0.0/elips/_modern/__init__.py +28 -0
  153. elips-1.0.0/elips/_modern/_records.py +84 -0
  154. elips-1.0.0/elips/_modern/arena.py +806 -0
  155. elips-1.0.0/elips/_modern/connect.py +183 -0
  156. elips-1.0.0/elips/_modern/engine.py +128 -0
  157. elips-1.0.0/elips/_modern/models.py +349 -0
  158. elips-1.0.0/elips/_modern/typing.py +47 -0
  159. elips-1.0.0/elips/core.py +145 -0
  160. elips-1.0.0/elips/errors.py +39 -0
  161. elips-1.0.0/elips/modern.py +34 -0
  162. elips-1.0.0/elips/py.typed +0 -0
  163. elips-1.0.0/elips/types.py +86 -0
  164. elips-1.0.0/elips.egg-info/PKG-INFO +80 -0
  165. elips-1.0.0/elips.egg-info/SOURCES.txt +183 -0
  166. elips-1.0.0/elips.egg-info/dependency_links.txt +1 -0
  167. elips-1.0.0/elips.egg-info/not-zip-safe +1 -0
  168. elips-1.0.0/elips.egg-info/top_level.txt +1 -0
  169. elips-1.0.0/pyproject.toml +77 -0
  170. elips-1.0.0/setup.cfg +4 -0
  171. elips-1.0.0/setup.py +93 -0
elips-1.0.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Pawan Kumar
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,10 @@
1
+ recursive-include core_src *
2
+ recursive-include elips *
3
+ include README.md
4
+ include LICENSE
5
+ include pyproject.toml
6
+ include setup.py
7
+ global-exclude *.pyc
8
+ global-exclude *.so
9
+ global-exclude *.dylib
10
+ global-exclude *.dll
elips-1.0.0/PKG-INFO ADDED
@@ -0,0 +1,80 @@
1
+ Metadata-Version: 2.4
2
+ Name: elips
3
+ Version: 1.0.0
4
+ Summary: Embedded local vector database (SQLite for vectors)
5
+ Author-email: Pawan Kumar <aegis.invincible@gmail.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/axiomchronicles/elips
8
+ Project-URL: Repository, https://github.com/axiomchronicles/elips.git
9
+ Project-URL: Issues, https://github.com/axiomchronicles/elips/issues
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.9
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Programming Language :: C++
20
+ Classifier: Topic :: Database
21
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
22
+ Requires-Python: >=3.9
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ Dynamic: license-file
26
+
27
+ # ELIPS (Python Bindings)
28
+
29
+ Embedded Local Index & Persistence System (ELIPS) Python package.
30
+
31
+ ELIPS is an in-process vector and document retrieval engine built in C++23 with native Python bindings. It keeps the embedded deployment model of SQLite, but adds ANN indexes, typed metadata filters, first-class document lineage, hybrid retrieval, segmented persistence, and optional GPU-backed indexes.
32
+
33
+ ## Installation
34
+
35
+ ### From PyPI
36
+ ```bash
37
+ pip install elips
38
+ ```
39
+
40
+ ### From Source
41
+ ```bash
42
+ pip install .
43
+ ```
44
+ *Note: Building from source requires a C++23 compatible compiler (GCC 13+ or Clang 17+), CMake >= 3.24, and Ninja.*
45
+
46
+ ## Quick Start
47
+
48
+ ```python
49
+ import elips
50
+
51
+ # Connect to database (either path or ":memory:")
52
+ engine = elips.connect(":memory:", dimension=128)
53
+
54
+ # Access or create a documents arena
55
+ arena = engine.arena("documents")
56
+
57
+ # Ingest documents with text and optional metadata
58
+ arena.ingest(
59
+ texts=["alpha design note", "beta incident runbook"],
60
+ meta=[{"kind": "design"}, {"kind": "ops"}],
61
+ )
62
+
63
+ # Run semantic search
64
+ for hit in arena.probe_text("alpha", top=2):
65
+ print(hit.key, hit.distance, hit.text, hit.meta)
66
+ ```
67
+
68
+ ## Features
69
+
70
+ - **Vector Search**: Optimized HNSW (`graph`) and `exact` index backends.
71
+ - **Embedded Deployment**: Simple SQLite-like single-writer/multi-reader lock model.
72
+ - **Local Embedding**: Built-in local text embedding using local models.
73
+ - **Metadata Filters**: Rich metadata equality filters via `MetadataIndex` and `Filter`.
74
+ - **Hybrid Retrieval**: Combine dense semantic search and document retrieval out of the box.
75
+ - **Segmented Persistence**: Durable writes with WAL crash recovery and snapshot checkpoints.
76
+ - **GPU Acceleration**: Optional Metal backend on Apple Silicon and CUDA/Vulkan backends on Linux.
77
+
78
+ ## License
79
+
80
+ ELIPS Python bindings are released under the [MIT License](LICENSE).
elips-1.0.0/README.md ADDED
@@ -0,0 +1,54 @@
1
+ # ELIPS (Python Bindings)
2
+
3
+ Embedded Local Index & Persistence System (ELIPS) Python package.
4
+
5
+ ELIPS is an in-process vector and document retrieval engine built in C++23 with native Python bindings. It keeps the embedded deployment model of SQLite, but adds ANN indexes, typed metadata filters, first-class document lineage, hybrid retrieval, segmented persistence, and optional GPU-backed indexes.
6
+
7
+ ## Installation
8
+
9
+ ### From PyPI
10
+ ```bash
11
+ pip install elips
12
+ ```
13
+
14
+ ### From Source
15
+ ```bash
16
+ pip install .
17
+ ```
18
+ *Note: Building from source requires a C++23 compatible compiler (GCC 13+ or Clang 17+), CMake >= 3.24, and Ninja.*
19
+
20
+ ## Quick Start
21
+
22
+ ```python
23
+ import elips
24
+
25
+ # Connect to database (either path or ":memory:")
26
+ engine = elips.connect(":memory:", dimension=128)
27
+
28
+ # Access or create a documents arena
29
+ arena = engine.arena("documents")
30
+
31
+ # Ingest documents with text and optional metadata
32
+ arena.ingest(
33
+ texts=["alpha design note", "beta incident runbook"],
34
+ meta=[{"kind": "design"}, {"kind": "ops"}],
35
+ )
36
+
37
+ # Run semantic search
38
+ for hit in arena.probe_text("alpha", top=2):
39
+ print(hit.key, hit.distance, hit.text, hit.meta)
40
+ ```
41
+
42
+ ## Features
43
+
44
+ - **Vector Search**: Optimized HNSW (`graph`) and `exact` index backends.
45
+ - **Embedded Deployment**: Simple SQLite-like single-writer/multi-reader lock model.
46
+ - **Local Embedding**: Built-in local text embedding using local models.
47
+ - **Metadata Filters**: Rich metadata equality filters via `MetadataIndex` and `Filter`.
48
+ - **Hybrid Retrieval**: Combine dense semantic search and document retrieval out of the box.
49
+ - **Segmented Persistence**: Durable writes with WAL crash recovery and snapshot checkpoints.
50
+ - **GPU Acceleration**: Optional Metal backend on Apple Silicon and CUDA/Vulkan backends on Linux.
51
+
52
+ ## License
53
+
54
+ ELIPS Python bindings are released under the [MIT License](LICENSE).
@@ -0,0 +1,199 @@
1
+ cmake_minimum_required(VERSION 3.24)
2
+ project(elips LANGUAGES CXX VERSION 1.0.0)
3
+
4
+ set(CMAKE_CXX_STANDARD 23)
5
+ set(CMAKE_CXX_STANDARD_REQUIRED ON)
6
+ set(CMAKE_CXX_EXTENSIONS OFF)
7
+ # Static libraries are linked into the Python extension module, so build
8
+ # library objects as PIC by default across supported toolchains.
9
+ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
10
+
11
+ if(NOT CMAKE_BUILD_TYPE)
12
+ set(CMAKE_BUILD_TYPE RelWithDebInfo)
13
+ endif()
14
+
15
+ # Enable Objective-C++ for Metal backend on Apple platforms
16
+ if(APPLE)
17
+ enable_language(OBJCXX)
18
+ endif()
19
+
20
+ # ------------------------------- GPU engine -------------------------------
21
+
22
+ option(ELIPS_GPU_METAL "Enable Apple Metal GPU backend" ON)
23
+ option(ELIPS_GPU_CUDA "Enable NVIDIA CUDA GPU backend" OFF)
24
+ option(ELIPS_GPU_HIP "Enable AMD ROCm/HIP GPU backend" OFF)
25
+ option(ELIPS_GPU_SYCL "Enable Intel oneAPI/SYCL GPU backend" OFF)
26
+ option(ELIPS_GPU_VULKAN "Enable Vulkan compute GPU backend" OFF)
27
+
28
+ set(ELIPS_GPU_ENABLED OFF)
29
+ if(ELIPS_GPU_CUDA OR ELIPS_GPU_HIP OR ELIPS_GPU_METAL OR ELIPS_GPU_SYCL OR ELIPS_GPU_VULKAN)
30
+ set(ELIPS_GPU_ENABLED ON)
31
+ endif()
32
+
33
+ if(ELIPS_GPU_ENABLED)
34
+ add_subdirectory(src/gpu_engine)
35
+ endif()
36
+
37
+ # ----------------------------- core library ------------------------------
38
+ add_library(elips_core
39
+ src/LocalTextEmbedder.cpp
40
+ src/RecordID.cpp
41
+ src/Metrics.cpp
42
+ src/ExactIndex.cpp
43
+ src/HierarchicalGraphIndex.cpp
44
+ src/IndexFactory.cpp
45
+ src/LockManager.cpp
46
+ src/WAL.cpp
47
+ src/Filter.cpp
48
+ src/MetadataIndex.cpp
49
+ src/EQLLexer.cpp
50
+ src/EQLParser.cpp
51
+ src/QueryExecutor.cpp
52
+ src/Database.cpp
53
+ )
54
+ target_include_directories(elips_core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
55
+ target_compile_options(elips_core PRIVATE -Wall -Wextra -Wpedantic)
56
+
57
+ if(ELIPS_GPU_ENABLED)
58
+ target_link_libraries(elips_core PUBLIC elips_gpu)
59
+ target_compile_definitions(elips_core PUBLIC ELIPS_GPU_ENABLED)
60
+ endif()
61
+
62
+ # -------------------------------- elips-cli ------------------------------
63
+ option(ELIPS_BUILD_CLI "Build the elips command-line tool" ON)
64
+ if(ELIPS_BUILD_CLI)
65
+ add_executable(elips_cli cli/src/main.cpp)
66
+ set_target_properties(elips_cli PROPERTIES OUTPUT_NAME elips)
67
+ target_link_libraries(elips_cli PRIVATE elips_core)
68
+ target_compile_options(elips_cli PRIVATE -Wall -Wextra -Wpedantic)
69
+ endif()
70
+
71
+ # ------------------------------- benchmarks ------------------------------
72
+ option(ELIPS_BUILD_BENCH "Build the benchmark suite" ON)
73
+ if(ELIPS_BUILD_BENCH)
74
+ add_executable(elips_bench benchmarks/BenchMain.cpp)
75
+ target_link_libraries(elips_bench PRIVATE elips_core)
76
+ target_compile_options(elips_bench PRIVATE -Wall -Wextra -Wpedantic)
77
+
78
+ if(ELIPS_GPU_ENABLED)
79
+ add_executable(elips_gpu_bench benchmarks/gpu/BenchGpuSearch.cpp)
80
+ target_link_libraries(elips_gpu_bench PRIVATE elips_core)
81
+ target_compile_definitions(elips_gpu_bench PRIVATE ELIPS_GPU_ENABLED)
82
+ target_compile_options(elips_gpu_bench PRIVATE -Wall -Wextra -Wpedantic)
83
+ endif()
84
+ endif()
85
+
86
+ # -------------------------------- tests ----------------------------------
87
+ option(ELIPS_BUILD_TESTS "Build the ELIPS test suite" ON)
88
+
89
+ if(ELIPS_BUILD_TESTS)
90
+ include(FetchContent)
91
+ FetchContent_Declare(
92
+ googletest
93
+ URL https://github.com/google/googletest/archive/refs/tags/v1.15.2.zip
94
+ )
95
+ set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
96
+ FetchContent_MakeAvailable(googletest)
97
+
98
+ enable_testing()
99
+
100
+ add_executable(elips_tests
101
+ tests/unit/metrics_test.cpp
102
+ tests/unit/exact_index_test.cpp
103
+ tests/unit/record_id_test.cpp
104
+ tests/unit/hnsw_recall_test.cpp
105
+ tests/unit/eql_test.cpp
106
+ tests/unit/vector_test.cpp
107
+ tests/unit/config_test.cpp
108
+ tests/unit/metadata_index_test.cpp
109
+ tests/unit/exact_edge_cases_test.cpp
110
+ tests/unit/hnsw_edge_cases_test.cpp
111
+ tests/unit/filter_edge_test.cpp
112
+ tests/unit/scan_test.cpp
113
+ tests/unit/durability_test.cpp
114
+ tests/unit/eql_edge_test.cpp
115
+ tests/integration/roundtrip_test.cpp
116
+ tests/integration/local_text_embedder_test.cpp
117
+ tests/integration/transaction_filter_test.cpp
118
+ tests/recovery/wal_recovery_test.cpp
119
+ tests/concurrency/single_writer_test.cpp
120
+ tests/concurrency/multi_reader_test.cpp
121
+ )
122
+ target_link_libraries(elips_tests PRIVATE elips_core GTest::gtest_main)
123
+
124
+ if(ELIPS_GPU_ENABLED)
125
+ target_sources(elips_tests PRIVATE
126
+ tests/unit/gpu/GpuDeviceManagerTest.cpp
127
+ tests/unit/gpu/GpuBruteForceIndexTest.cpp
128
+ tests/unit/gpu/GpuAdvancedIndexTest.cpp
129
+ tests/unit/gpu/GpuMemoryManagerTest.cpp
130
+ tests/unit/gpu/DynamicBatcherTest.cpp
131
+ tests/integration/gpu/MetalBackendTest.cpp
132
+ tests/parity/CpuGpuRecallParityTest.cpp
133
+ )
134
+ target_compile_definitions(elips_tests PRIVATE ELIPS_GPU_ENABLED)
135
+ if(APPLE AND ELIPS_GPU_METAL)
136
+ target_link_libraries(elips_tests PRIVATE elips_gpu_metal)
137
+ find_library(METAL_FW Metal)
138
+ find_library(MPS_FW MetalPerformanceShaders)
139
+ find_library(FOUNDATION_FW Foundation)
140
+ target_link_libraries(elips_tests PRIVATE ${METAL_FW} ${MPS_FW} ${FOUNDATION_FW})
141
+ endif()
142
+
143
+ add_executable(elips_gpu_lifecycle_probe
144
+ tests/integration/gpu/DatabaseGpuLifecycleProbe.cpp
145
+ )
146
+ target_link_libraries(elips_gpu_lifecycle_probe PRIVATE elips_core)
147
+ if(APPLE AND ELIPS_GPU_METAL)
148
+ target_link_libraries(elips_gpu_lifecycle_probe PRIVATE elips_gpu_metal)
149
+ target_link_libraries(elips_gpu_lifecycle_probe PRIVATE ${METAL_FW} ${MPS_FW} ${FOUNDATION_FW})
150
+ endif()
151
+ add_test(NAME GpuDatabaseLifecycleProbe COMMAND elips_gpu_lifecycle_probe)
152
+ endif()
153
+
154
+ include(GoogleTest)
155
+ gtest_discover_tests(elips_tests)
156
+ endif()
157
+
158
+ # ----------------------------- python bindings ---------------------------
159
+ option(ELIPS_BUILD_PYTHON "Build the Python (PyBind11) bindings" OFF)
160
+
161
+ if(ELIPS_BUILD_PYTHON)
162
+ set(
163
+ ELIPS_PYBIND11_SOURCE_DIR
164
+ ""
165
+ CACHE PATH
166
+ "Optional local pybind11 source tree used instead of FetchContent"
167
+ )
168
+ if(ELIPS_PYBIND11_SOURCE_DIR)
169
+ add_subdirectory(
170
+ "${ELIPS_PYBIND11_SOURCE_DIR}"
171
+ "${CMAKE_CURRENT_BINARY_DIR}/_deps/pybind11-local"
172
+ )
173
+ else()
174
+ include(FetchContent)
175
+ FetchContent_Declare(
176
+ pybind11
177
+ URL https://github.com/pybind/pybind11/archive/refs/tags/v2.13.6.zip
178
+ )
179
+ FetchContent_MakeAvailable(pybind11)
180
+ endif()
181
+
182
+ pybind11_add_module(elips_pymodule bindings/python/elips_python.cpp)
183
+ target_link_libraries(elips_pymodule PRIVATE elips_core)
184
+ if(ELIPS_GPU_ENABLED)
185
+ target_compile_definitions(elips_pymodule PRIVATE ELIPS_GPU_ENABLED)
186
+ endif()
187
+
188
+ set(
189
+ ELIPS_PYTHON_OUTPUT_DIR
190
+ "${CMAKE_CURRENT_SOURCE_DIR}/bindings/python/elips"
191
+ CACHE PATH
192
+ "Directory where the Python extension module is written"
193
+ )
194
+ set_target_properties(elips_pymodule PROPERTIES
195
+ OUTPUT_NAME _core
196
+ LIBRARY_OUTPUT_DIRECTORY "${ELIPS_PYTHON_OUTPUT_DIR}"
197
+ RUNTIME_OUTPUT_DIRECTORY "${ELIPS_PYTHON_OUTPUT_DIR}"
198
+ )
199
+ endif()
@@ -0,0 +1,154 @@
1
+ // ELIPS benchmark suite. Measures insert throughput, search latency
2
+ // percentiles, recall@10 vs the ExactIndex ground truth, and crash-recovery
3
+ // time. Self-contained (no dependency beyond the ELIPS library).
4
+ //
5
+ // elips_bench [--count N] [--dim D] [--queries Q]
6
+ #include <algorithm>
7
+ #include <chrono>
8
+ #include <cstdint>
9
+ #include <filesystem>
10
+ #include <iostream>
11
+ #include <map>
12
+ #include <random>
13
+ #include <string>
14
+ #include <unordered_set>
15
+ #include <vector>
16
+
17
+ #include "elips/elips.hpp"
18
+ #include "elips/index_engine/ExactIndex.hpp"
19
+ #include "elips/index_engine/HierarchicalGraphIndex.hpp"
20
+
21
+ namespace {
22
+
23
+ using clock_type = std::chrono::steady_clock;
24
+ using elips::GraphParams;
25
+ using elips::Metric;
26
+ using elips::RecordID;
27
+
28
+ double seconds_since(clock_type::time_point start) {
29
+ return std::chrono::duration<double>(clock_type::now() - start).count();
30
+ }
31
+
32
+ std::vector<std::vector<float>> random_dataset(std::size_t count,
33
+ std::uint16_t dim,
34
+ std::mt19937& rng) {
35
+ std::normal_distribution<float> dist(0.0F, 1.0F);
36
+ std::vector<std::vector<float>> data(count, std::vector<float>(dim));
37
+ for (auto& row : data) {
38
+ for (auto& v : row) {
39
+ v = dist(rng);
40
+ }
41
+ }
42
+ return data;
43
+ }
44
+
45
+ void bench_insert_and_search(std::size_t count, std::uint16_t dim,
46
+ std::size_t queries) {
47
+ std::mt19937 rng(7);
48
+ const auto data = random_dataset(count, dim, rng);
49
+ const auto probes = random_dataset(queries, dim, rng);
50
+
51
+ elips::HierarchicalGraphIndex graph(Metric::euclidean, dim, GraphParams{});
52
+ elips::ExactIndex exact(Metric::euclidean, dim);
53
+ std::vector<RecordID> ids(count);
54
+
55
+ const auto t_insert = clock_type::now();
56
+ for (std::size_t i = 0; i < count; ++i) {
57
+ ids[i] = RecordID::generate();
58
+ graph.insert(ids[i], data[i]);
59
+ }
60
+ const double insert_s = seconds_since(t_insert);
61
+ for (std::size_t i = 0; i < count; ++i) {
62
+ exact.insert(ids[i], data[i]);
63
+ }
64
+
65
+ constexpr std::size_t k = 10;
66
+ std::vector<double> latencies_us;
67
+ latencies_us.reserve(queries);
68
+ std::size_t recall_hits = 0;
69
+ std::size_t recall_total = 0;
70
+ for (const auto& probe : probes) {
71
+ const auto t_q = clock_type::now();
72
+ const auto approx = graph.search(probe, k);
73
+ latencies_us.push_back(seconds_since(t_q) * 1e6);
74
+
75
+ const auto truth = exact.search(probe, k);
76
+ std::unordered_set<RecordID> truth_ids;
77
+ for (const auto& [id, d] : truth) {
78
+ truth_ids.insert(id);
79
+ }
80
+ for (const auto& [id, d] : approx) {
81
+ if (truth_ids.count(id) != 0) {
82
+ ++recall_hits;
83
+ }
84
+ }
85
+ recall_total += truth.size();
86
+ }
87
+
88
+ std::sort(latencies_us.begin(), latencies_us.end());
89
+ auto pct = [&](double p) {
90
+ return latencies_us[static_cast<std::size_t>(p * (latencies_us.size() - 1))];
91
+ };
92
+ const double recall =
93
+ static_cast<double>(recall_hits) / static_cast<double>(recall_total);
94
+
95
+ std::cout << "[insert] " << count << " x " << dim << " "
96
+ << static_cast<std::size_t>(count / insert_s) << " rec/s ("
97
+ << insert_s << "s)\n";
98
+ std::cout << "[search] p50=" << pct(0.50) << "us p95=" << pct(0.95)
99
+ << "us p99=" << pct(0.99) << "us\n";
100
+ std::cout << "[recall] recall@" << k << " = " << recall << "\n";
101
+ }
102
+
103
+ void bench_recovery(std::size_t count, std::uint16_t dim) {
104
+ namespace fs = std::filesystem;
105
+ const fs::path dir = fs::temp_directory_path() / "elips_bench_recovery";
106
+ fs::remove_all(dir);
107
+
108
+ std::mt19937 rng(11);
109
+ const auto data = random_dataset(count, dim, rng);
110
+ {
111
+ auto db = elips::open(dir.string(),
112
+ elips::Config{}.dimension(dim).durability(
113
+ elips::Durability::standard));
114
+ auto& vault = db->vault("bench");
115
+ for (const auto& row : data) {
116
+ vault.place(elips::Vector{row});
117
+ }
118
+ db->abandon(); // crash before checkpoint -> recovery replays WAL
119
+ }
120
+ const auto t_recover = clock_type::now();
121
+ auto db = elips::open(dir.string());
122
+ const double recover_s = seconds_since(t_recover);
123
+ std::cout << "[recovery] replayed " << db->vault("bench").info().count
124
+ << " records in " << recover_s << "s\n";
125
+ db->close();
126
+ fs::remove_all(dir);
127
+ }
128
+
129
+ std::size_t arg_value(const std::map<std::string, std::string>& opts,
130
+ const std::string& key, std::size_t fallback) {
131
+ const auto it = opts.find(key);
132
+ return it != opts.end() ? std::stoul(it->second) : fallback;
133
+ }
134
+
135
+ } // namespace
136
+
137
+ int main(int argc, char** argv) {
138
+ std::map<std::string, std::string> opts;
139
+ for (int i = 1; i + 1 < argc; i += 2) {
140
+ std::string key = argv[i];
141
+ if (key.rfind("--", 0) == 0) {
142
+ opts[key.substr(2)] = argv[i + 1];
143
+ }
144
+ }
145
+ const auto count = arg_value(opts, "count", 20000);
146
+ const auto dim = static_cast<std::uint16_t>(arg_value(opts, "dim", 128));
147
+ const auto queries = arg_value(opts, "queries", 1000);
148
+
149
+ std::cout << "ELIPS benchmark — count=" << count << " dim=" << dim
150
+ << " queries=" << queries << "\n";
151
+ bench_insert_and_search(count, dim, queries);
152
+ bench_recovery(count / 4, dim);
153
+ return 0;
154
+ }
@@ -0,0 +1,91 @@
1
+ // ELIPS GPU Benchmark Suite
2
+ // Compares GPU-accelerated vs CPU baseline performance
3
+ #include <iostream>
4
+ #include <chrono>
5
+ #include <random>
6
+ #include <iomanip>
7
+
8
+ #include "elips/gpu_engine/GpuDeviceManager.hpp"
9
+ #include "elips/gpu_engine/GpuSelector.hpp"
10
+ #include "elips/gpu_engine/GpuConfig.hpp"
11
+ #include "elips/gpu_engine/GpuBruteForceIndex.hpp"
12
+ #include "elips/index_engine/ExactIndex.hpp"
13
+ #include "elips/vector_engine/Metrics.hpp"
14
+
15
+ using namespace elips;
16
+ using namespace elips::gpu;
17
+ using Clock = std::chrono::high_resolution_clock;
18
+
19
+ struct BenchResult {
20
+ std::string name;
21
+ double cpu_ms;
22
+ double gpu_ms;
23
+ double speedup;
24
+ };
25
+
26
+ BenchResult bench_search(size_t n_vectors, size_t dim, Metric metric, size_t n_queries) {
27
+ std::mt19937 rng(42);
28
+ std::uniform_real_distribution<float> dist(-1.0f, 1.0f);
29
+
30
+ std::vector<float> db_vecs(n_vectors * dim);
31
+ std::vector<float> queries(n_queries * dim);
32
+ for (auto& v : db_vecs) v = dist(rng);
33
+ for (auto& v : queries) v = dist(rng);
34
+
35
+ std::vector<RecordID> ids;
36
+ for (size_t i = 0; i < n_vectors; ++i) ids.push_back(RecordID::generate());
37
+
38
+ auto cpu_idx = std::make_unique<ExactIndex>(metric, static_cast<uint16_t>(dim));
39
+ for (size_t i = 0; i < n_vectors; ++i) {
40
+ cpu_idx->insert(ids[i], {db_vecs.data() + i * dim, dim});
41
+ }
42
+
43
+ auto cpu_start = Clock::now();
44
+ for (size_t q = 0; q < n_queries; ++q) {
45
+ cpu_idx->search({queries.data() + q * dim, dim}, 10);
46
+ }
47
+ auto cpu_end = Clock::now();
48
+ double cpu_ms = std::chrono::duration<double, std::milli>(cpu_end - cpu_start).count() / n_queries;
49
+
50
+ GpuDeviceManager manager;
51
+ auto devices = manager.probe_all_devices();
52
+ GpuSelector selector;
53
+ GpuConfig config;
54
+ config.policy = GpuPolicy::Auto;
55
+ auto backend = selector.select(config, devices);
56
+
57
+ double gpu_ms = 0.0;
58
+ if (backend.has_value()) {
59
+ GpuBruteForceIndex gpu_idx(**backend, metric, static_cast<uint16_t>(dim), config);
60
+ gpu_idx.build_from_batch(db_vecs, ids, GpuIndexBuildParams{});
61
+
62
+ auto gpu_start = Clock::now();
63
+ for (size_t q = 0; q < n_queries; ++q) {
64
+ gpu_idx.search({queries.data() + q * dim, dim}, 10);
65
+ }
66
+ auto gpu_end = Clock::now();
67
+ gpu_ms = std::chrono::duration<double, std::milli>(gpu_end - gpu_start).count() / n_queries;
68
+ }
69
+
70
+ std::string dim_str = "dim=" + std::to_string(dim);
71
+ return {dim_str, cpu_ms, gpu_ms, cpu_ms / std::max(gpu_ms, 0.001)};
72
+ }
73
+
74
+ int main() {
75
+ std::cout << "=== ELIPS GPU Benchmark ===\n\n";
76
+ std::cout << std::left << std::setw(12) << "Config"
77
+ << std::setw(12) << "CPU (ms)"
78
+ << std::setw(12) << "GPU (ms)"
79
+ << std::setw(12) << "Speedup" << "\n";
80
+ std::cout << std::string(48, '-') << "\n";
81
+
82
+ for (size_t dim : {128, 384, 768, 1536}) {
83
+ auto r = bench_search(10000, dim, Metric::cosine, 100);
84
+ std::cout << std::left << std::setw(12) << r.name
85
+ << std::setw(12) << std::fixed << std::setprecision(3) << r.cpu_ms
86
+ << std::setw(12) << r.gpu_ms
87
+ << std::setw(12) << r.speedup << "x\n";
88
+ }
89
+
90
+ return 0;
91
+ }