Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
217 lines (177 loc) · 8.83 KB
/
Copy pathMakefile
File metadata and controls
217 lines (177 loc) · 8.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
# ==========================================================
# VECTOR-ADIS — Makefile
# Simplified benchmark automation for Qdrant & Milvus
# ==========================================================
.PHONY: install format lint test qdrant milvus run-all monitor sync-results clean \
logs tail status benchmark-quick-qdrant benchmark-quick-milvus \
archive deps reset help plot plot-thesis \
qdrant-on-disk milvus-on-disk run-all-on-disk \
benchmark-quick-qdrant-on-disk benchmark-quick-milvus-on-disk \
thesis thesis-watch thesis-clean convert
# ----------------------------------------------------------
# Variables
# ----------------------------------------------------------
POETRY ?= poetry
PYTHON := $(POETRY) run python
LOG_LEVEL ?= INFO
DATASETS ?= glove-100-angular,deep-image-96-angular,laion-small-clip,dbpedia-openai-100K-1536-angular,dbpedia-openai-1M-1536-angular,h-and-m-2048-angular-filters,msmarco-sparse-100K
DATASETS_ON_DISK ?= dbpedia-openai-100K-1536-angular,laion-small-clip,deep-image-96-angular
HOST ?= localhost
TIMEOUT ?= 3600
FORCE ?=
DATE := $(shell date +%Y-%m-%d_%H-%M-%S)
# ----------------------------------------------------------
# Environment Setup
# ----------------------------------------------------------
## Install all dependencies via Poetry
install:
$(POETRY) install --no-interaction
@echo "✅ Environment ready."
## Format codebase using Black
format:
$(POETRY) run black .
## Lint with Ruff
lint:
$(POETRY) run ruff check .
## Run tests
test:
$(POETRY) run pytest -v
## Upgrade all dependencies
deps:
$(POETRY) update
@echo "⬆️ Dependencies updated."
# ----------------------------------------------------------
# Benchmark Targets
# ----------------------------------------------------------
## Run Qdrant benchmark locally
qdrant:
@echo "🚀 Running Qdrant benchmark..."
ENGINES="qdrant-single-node" DATASETS="$(DATASETS)" HOST="$(HOST)" TIMEOUT="$(TIMEOUT)" FORCE="$(FORCE)" $(POETRY) run bash scripts/run_all_engines.sh
## Run Milvus benchmark locally
milvus:
@echo "🚀 Running Milvus benchmark..."
ENGINES="milvus-single-node" DATASETS="$(DATASETS)" HOST="$(HOST)" TIMEOUT="$(TIMEOUT)" FORCE="$(FORCE)" $(POETRY) run bash scripts/run_all_engines.sh
## Run both engines sequentially
run-all:
@echo "🚀 Running Qdrant & Milvus benchmarks..."
DATASETS="$(DATASETS)" HOST="$(HOST)" TIMEOUT="$(TIMEOUT)" FORCE="$(FORCE)" $(POETRY) run bash scripts/run_all_engines.sh
## ⚡ Quick smoke test for Qdrant (1 dataset, 2 min)
benchmark-quick-qdrant:
@echo "⚡ Running quick smoke test for Qdrant..."
ENGINES="qdrant-single-node" DATASETS="glove-100-angular" HOST="$(HOST)" TIMEOUT="120" FORCE="$(FORCE)" $(POETRY) run bash scripts/run_all_engines.sh
## ⚡ Quick smoke test for Milvus (1 dataset, 2 min)
benchmark-quick-milvus:
@echo "⚡ Running quick smoke test for Milvus..."
ENGINES="milvus-single-node" DATASETS="glove-100-angular" HOST="$(HOST)" TIMEOUT="120" FORCE="$(FORCE)" $(POETRY) run bash scripts/run_all_engines.sh
# ----------------------------------------------------------
# On-Disk Benchmark Targets (2GB RAM limit)
# ----------------------------------------------------------
## Run Qdrant on-disk benchmark (2GB RAM)
qdrant-on-disk:
@echo "🚀 Running Qdrant benchmark (on-disk, 2GB RAM)..."
ENGINES="qdrant-on-disk" DATASETS="$(DATASETS_ON_DISK)" HOST="$(HOST)" TIMEOUT="$(TIMEOUT)" FORCE="$(FORCE)" $(POETRY) run bash scripts/run_all_engines.sh
## Run Milvus on-disk benchmark (2GB RAM)
milvus-on-disk:
@echo "🚀 Running Milvus benchmark (on-disk, 2GB RAM)..."
ENGINES="milvus-on-disk" DATASETS="$(DATASETS_ON_DISK)" HOST="$(HOST)" TIMEOUT="$(TIMEOUT)" FORCE="$(FORCE)" $(POETRY) run bash scripts/run_all_engines.sh
## Run both engines on-disk sequentially
run-all-on-disk:
@echo "🚀 Running Qdrant & Milvus benchmarks (on-disk, 2GB RAM)..."
ENGINES="qdrant-on-disk,milvus-on-disk" DATASETS="$(DATASETS_ON_DISK)" HOST="$(HOST)" TIMEOUT="$(TIMEOUT)" FORCE="$(FORCE)" $(POETRY) run bash scripts/run_all_engines.sh
## ⚡ Quick smoke test for Qdrant (on-disk)
benchmark-quick-qdrant-on-disk:
@echo "⚡ Running quick smoke test for Qdrant (on-disk)..."
ENGINES="qdrant-on-disk" DATASETS="glove-100-angular" HOST="$(HOST)" TIMEOUT="$(TIMEOUT)" FORCE="$(FORCE)" $(POETRY) run bash scripts/run_all_engines.sh
## ⚡ Quick smoke test for Milvus (on-disk)
benchmark-quick-milvus-on-disk:
@echo "⚡ Running quick smoke test for Milvus (on-disk)..."
ENGINES="milvus-on-disk" DATASETS="glove-100-angular" HOST="$(HOST)" TIMEOUT="$(TIMEOUT)" FORCE="$(FORCE)" $(POETRY) run bash scripts/run_all_engines.sh
## Monitor Docker resource usage (CPU, RAM, I/O)
monitor:
@echo "📊 Monitoring Docker resources... (Ctrl+C to stop)"
$(POETRY) run bash scripts/monitor_resources.sh
# ----------------------------------------------------------
# Utilities
# ----------------------------------------------------------
## Rsync results from remote host (e.g., benchmark VM)
sync-results:
@echo "⬇️ Syncing results from remote host '$(HOST)'..."
$(POETRY) run bash scripts/sync_results.sh $(HOST)
@echo "✅ Results synced to ./results/"
## Create an archive of all results
archive:
@mkdir -p archives
tar -czf archives/results-$(DATE).tar.gz results/
@echo "📦 Archived results → archives/results-$(DATE).tar.gz"
## Show container status
status:
@docker ps --filter "name=qdrant" --filter "name=milvus" --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"
## Tail Qdrant logs
logs:
@echo "📜 Tailing Qdrant logs (Ctrl+C to exit)..."
docker logs -f qdrant-single-node-qdrant_bench-1 2>/dev/null || echo "⚠️ No container running."
## Display last 30 log lines
tail:
docker logs --tail=30 qdrant-single-node-qdrant_bench-1 2>/dev/null || echo "⚠️ No container running."
# ----------------------------------------------------------
# Plotting and Analysis
# ----------------------------------------------------------
## Generate benchmark plots from JSON results
plot:
@echo "📈 Generating benchmark plots..."
$(PYTHON) scripts/plot_results.py consolidated/results.json
@echo "✅ Plots generated in ./plots/"
## Generate thesis-safe plots (memory-constrained analysis)
plot-thesis:
@echo "📊 Generating thesis-safe benchmark plots..."
$(PYTHON) scripts/plot_thesis_safe.py
@echo "✅ Thesis-safe plots generated in ./plots/"
## Convert raw benchmark results to a consolidated JSON
convert:
@echo "🔄 Converting raw benchmark results into consolidated JSON..."
$(PYTHON) run.py convert ./results ./consolidated/results.json
@echo "✅ Consolidated results saved to ./consolidated/results.json"
# ----------------------------------------------------------
# Maintenance
# ----------------------------------------------------------
## Remove all cached results & containers
clean:
@echo "🧹 Cleaning up Docker containers and temporary files..."
docker compose -f engine/servers/qdrant-single-node/docker-compose.yaml down -v 2>/dev/null || true
docker compose -f engine/servers/milvus-single-node/docker-compose.yaml down -v 2>/dev/null || true
docker compose -f engine/servers/qdrant-on-disk/docker-compose.yaml down -v 2>/dev/null || true
docker compose -f engine/servers/milvus-on-disk/docker-compose.yaml down -v 2>/dev/null || true
@echo "✅ Cleanup complete."
## Reset environment (full clean + reinstall)
reset: clean
@echo "♻️ Full reset in progress..."
$(POETRY) env remove --all || true
$(MAKE) install
# ----------------------------------------------------------
# Thesis Generation
# ----------------------------------------------------------
thesis:
@echo "Building thesis PDF (using latexmk)..."
@cd thesis && latexmk -pdf -interaction=nonstopmode -quiet -f main.tex 2>/dev/null || latexmk -pdf -interaction=nonstopmode -quiet main.tex
@echo "✓ Thesis PDF built successfully: thesis/main.pdf"
@cd thesis && pdfinfo main.pdf 2>/dev/null | grep "Pages:" | awk '{print " Pages:", $$2}' || true
@cd thesis && pdftotext main.pdf - 2>/dev/null | wc -w | awk '{print " Word count:", $$1}' || echo " Word count: n/a"
thesis-watch:
@echo "Building thesis PDF with auto-rebuild (Ctrl+C to stop)..."
cd thesis && latexmk -pdf -pvc -interaction=nonstopmode main.tex
thesis-clean:
@echo "Cleaning LaTeX build artifacts..."
@rm -f thesis/main.aux thesis/main.bbl thesis/main.blg thesis/main.log thesis/main.out thesis/main.toc thesis/main.lof thesis/main.lot thesis/main.fls thesis/main.fdb_latexmk thesis/main.pdf
@rm -f thesis/chapters/*.aux
@rm -f thesis/frontmatter/*.aux
@rm -f thesis/appendices/*.aux
@echo "✓ Cleaned all LaTeX build artifacts"
# ----------------------------------------------------------
# Help
# ----------------------------------------------------------
help:
@echo ""
@echo "🧠 VECTOR-ADIS — Available Commands"
@echo "-----------------------------------"
@grep -E '^##' $(MAKEFILE_LIST) | sed -e 's/## //'
@echo ""