mirror of
https://github.com/SikongJueluo/Mini-Nav.git
synced 2026-07-12 20:15:31 +08:00
feat: vectorize CAM retrieval with NumPy and add multi-worker support
- Replace scalar hamming distance with NumPy bitwise_count for batch retrieval - Add ThreadPoolExecutor-based multi-worker query parallelism - Improve missing dataset error message with generation command hint - Increase DEFAULT_MAX_QUERIES from 128 to 8192 for meaningful throughput tests
This commit is contained in:
@@ -1,20 +1,27 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import csv
|
||||
import importlib.util
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
HW_SIM_DIR = Path(__file__).resolve().parents[1] / "hw" / "sim"
|
||||
if str(HW_SIM_DIR) not in sys.path:
|
||||
sys.path.insert(0, str(HW_SIM_DIR))
|
||||
if str(HW_SIM_DIR) in sys.path:
|
||||
sys.path.remove(str(HW_SIM_DIR))
|
||||
sys.path.insert(0, str(HW_SIM_DIR))
|
||||
benchmark_path = HW_SIM_DIR / "benchmarks" / "retrieval" / "test_retrieval_benchmark.py"
|
||||
spec = importlib.util.spec_from_file_location("hw_retrieval_benchmark", benchmark_path)
|
||||
assert spec is not None
|
||||
assert spec.loader is not None
|
||||
hw_retrieval_benchmark = importlib.util.module_from_spec(spec)
|
||||
sys.modules[spec.name] = hw_retrieval_benchmark
|
||||
spec.loader.exec_module(hw_retrieval_benchmark)
|
||||
|
||||
from benchmarks.retrieval.test_retrieval_benchmark import ( # noqa: E402
|
||||
QueryTiming,
|
||||
build_hardware_performance,
|
||||
summarize_query_timings,
|
||||
write_outputs,
|
||||
)
|
||||
QueryTiming = hw_retrieval_benchmark.QueryTiming
|
||||
build_hardware_performance = hw_retrieval_benchmark.build_hardware_performance
|
||||
summarize_query_timings = hw_retrieval_benchmark.summarize_query_timings
|
||||
write_outputs = hw_retrieval_benchmark.write_outputs
|
||||
|
||||
|
||||
def test_summarize_query_timings_uses_query_only_accept_to_last_cycles() -> None:
|
||||
|
||||
Reference in New Issue
Block a user