Skip to content

Commit e86cbda

Browse files
author
Sovereign Map Test Suite
committed
2 parents 90470d2 + 675ea33 commit e86cbda

2 files changed

Lines changed: 25 additions & 6 deletions

File tree

prototype/test_correctness_suite.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"""
1313

1414
import sys
15+
import time
1516
import numpy as np
1617
import pytest
1718
from prototype.model_tools import ToyModel
@@ -319,19 +320,28 @@ def test_throughput_consistency(self):
319320
for bs in batch_sizes:
320321
x = np.random.randn(bs, 8).astype(np.float32)
321322

322-
# Measure time for single-node
323-
start = np.datetime64('now')
324-
_ = single_node_forward(model, x[0]) # First element only
325-
end = np.datetime64('now')
323+
# Warm up to avoid first-run JIT/cache effects
324+
for _ in range(3):
325+
_ = single_node_forward(model, x[0])
326326

327-
latency = (end - start).astype(np.float64) * 1e9 # nanoseconds
327+
# Take best-of-N to reduce OS scheduling noise
328+
samples = []
329+
for _ in range(10):
330+
start = time.perf_counter_ns()
331+
_ = single_node_forward(model, x[0]) # First element only
332+
end = time.perf_counter_ns()
333+
samples.append(end - start)
328334

329-
latencies.append(latency)
335+
best_latency = float(min(samples)) # nanoseconds
336+
latencies.append(best_latency)
330337

331338
# Latencies should be within 20% of each other (allowing for variance)
332339
min_latency = min(latencies)
333340
max_latency = max(latencies)
334341

342+
if min_latency < 100:
343+
pytest.skip("Timer resolution too low to measure latency reliably")
344+
335345
assert (max_latency - min_latency) / min_latency < 0.2, \
336346
f"Latency variance too high: {min_latency} vs {max_latency}"
337347

requirements.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
transformers>=4.30.0
2+
accelerate>=0.20.0
3+
bitsandbytes>=0.41.0
4+
optimum>=1.6.0
5+
vllm>=0.4.0
6+
kubernetes>=27.0.0
7+
cryptography>=41.0.0
8+
pyoqs>=0.9.0 # For PQC liboqs binding
9+
prometheus-client>=0.15.0

0 commit comments

Comments
 (0)