Test single-slot memory pressure and update Strata to 0.1.44.1

This commit is contained in:
Mikei386 committed 2026-10-14 13:37:45 +02:00
1 parent 417d06f404
commit 482add7ca4
19 files changed
+1268 -3

No files matched your search

@@ -0,0 +1,162 @@
# Single-slot memory pressure and direct Strata update, 2026-10-14
Explicit user request: test existing single-slot 262K and 512K profiles for the
same memory pressure as dual-slot; then compile and directly replace Strata
with the newest official release. No extra fallback generation. User reported
the system idle and authorized maintenance while away.
## Protocol
Test the old installed runtime 0.1.43.1 first, before modifying its source or
binaries. Exact same IQ3_XXS weights, layer split 16, GPU order 3060 / 5080,
1024-MiB reserves, int8 KV, 32768 GPU-resident KV, CPU vision, resident experts
with 6-GiB headroom and previous measured performance arguments. Actual profiles
were read and confirmed to differ in context/slot count only for this purpose.
Single-slot tests remove dual-only batch flags. 512K uses the existing YaRN
factor 2; 262K does not change native RoPE.
Each profile uses a separate fresh isolated container/cgroup: 44 GiB, no extra
swap, six CPU equivalents, UID 65534, read-only production mounts/root, no
network beyond loopback. CPU STT and Deck remain running. Production LLM was
regularly unloaded through the authenticated GUI with no active requests.
OpenWebUI remains stopped. No private inputs, raw model responses or production
logs are used/saved. Generated text is held in RAM only for a cached follow-up.
Five cases per profile: short request (512 output tokens), identical fresh
~131072-token prompt (128 output), its cached continuation (256 output),
near-full window (~245760 or ~491520 input tokens, 128 output), then its cached
continuation (256 output). Installed tokenizer calibrates exact input size.
The first 128K fixture is copied unchanged between the two fresh containers.
Measure actual backend timings/usage/cache, peak cgroup memory, full memory PSI,
major faults, file refaults, cgroup limit/OOM events, engine disk reads and GPU
samples. One measurement per case, not a statistically estimated speed ratio.
Paths: `/opt/athena-deck-dev/single-update-20261014` and
`/data/experiments/strata-single-memory-20261014/{262144,524288}`.
Own unit `athena-strata-single-memory-20261014`; temporary test containers named
`athena-strata-single-{262144,524288}-20261014`, removed on exit.
The launcher intentionally leaves LLM unloaded after tests for the subsequent
authorized runtime replacement. It never starts an update before tests finish.
## Direct update
Official latest release verified at execution:
https://github.com/Niko1221/Strata/releases/tag/v0.1.44.1
Annotated tag object `9791ea335ba2001c87b5f783146d6eb08fdd9e5e`, peeled source
commit **296b59d2f73c8f04a805df29c2fa97655adace78**. Use the peeled commit in
`strata_sources.json`; do not confuse the tag object with the source revision.
`build.py` uses the native version-pinned installers in the existing runtime
path. Compiler targets sm_86 and sm_120, private CUDA 13.0, two build jobs.
CPU vision is rebuilt; official setup verifies existing explicitly selected
IQ3_XXS/IQ2_XS packs without starting inference or accepting the new IQ3_S default.
No new weights or driver changes. Only successful setup advances prepared
markers. `deploy/install_strata.py` now also copies the K-quant MMQ shared
library supplied by 0.1.44 **if built**. The existing Athena build cache retains
`STRATA_MMQ_KQUANTS=OFF` (also `STRATA_PREFILL_MMQ=OFF`), so that optional library
is not built/present in this qualified IQ3 installation and is not required
by IQ3. A fresh build uses upstream's new ON default and copies its library.
`update.py` checks tests complete, zero active requests and LLM unloaded before
changing the runtime. A temporary build container has 16-GiB memory/no additional
swap and six CPU equivalents, existing writable runtime/model mounts, no exposed
ports. Then a minimal child image replaces the installed Deck image, carrying
only matching recipe/installers, with existing manifest/mounts/limits preserved.
No fallback image/container/config copy is created. A brief regular Deck restart
is needed to load the matching pinned recipe; no host/OpenCode/OpenWebUI restart.
Finally restore previous `flash-next-strata-iq3-dual` via regular inference API
and verify actual loaded state. This is a maintenance action explicitly requested
in this turn, not a production restart during an active coding task.
Native restore requirements remain in `deploy/STRATA_NATIVE.md`; Docker here is
only the current transport/toolchain. No complete native fresh-host restore
test is claimed. Credentials stay in their existing files and are used internally;
no keys, templates with real auth, raw responses or weights belong in Git.
## Pre-update memory results (0.1.43.1)
Both profiles completed all five cases with zero OOM kills. Engine-confirmed
one serving slot, actual expert RAM: 21.72 GiB for 262K and 21.92 GiB for 512K.
These are actual automatic allocations, not a claim of identical pinned budgets.
The fresh 128K input was identical; near-full inputs differ in size as shown.
Files `results/262144.json` and `results/524288.json` contain metrics only.
| Profile / case | Actual input tokens | Wall time | Backend input token/s | Backend output token/s | Peak cgroup RAM | Full memory PSI | Engine storage read |
| --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: |
| 262K / short | 47 | 8.3 s | 79.7 | 66.1 | 30.95 GiB | 0% | 0.05 GiB |
| 262K / fresh 128K | 131072 | 68.2 s | 1981.3 | 64.7 | 39.13 GiB | 0.012% | 7.17 GiB |
| 262K / cached 128K | 131233 | 4.2 s | 88.4 | 67.5 | 39.09 GiB | 0% | 0.02 GiB |
| 262K / fresh near-full | 245732 | 131.3 s | 1900.6 | 67.5 | 40.71 GiB | 0.002% | 1.56 GiB |
| 262K / cached near-full | 245893 | 4.2 s | 104.8 | 68.3 | 40.68 GiB | 0% | 0.02 GiB |
| 512K / short | 47 | 8.6 s | 76.2 | 64.3 | 37.49 GiB | 0% | 0.05 GiB |
| 512K / fresh 128K | 131072 | 71.2 s | 1893.0 | 66.3 | 43.42 GiB | 0% | 8.05 GiB |
| 512K / cached 128K | 131233 | 4.2 s | 89.1 | 68.1 | 43.37 GiB | 0% | 0.02 GiB |
| 512K / fresh near-full | 491504 | 301.1 s | 1644.5 | 64.3 | 44.00 GiB | 0.251% | 2.18 GiB |
| 512K / cached near-full | 491665 | 4.8 s | 91.0 | 61.2 | 43.89 GiB | 0.019% | 0.02 GiB |
The small cached input rates describe only 33–34 *new* tokens and are not
whole-context rereading rates. Both near-full continuations reused their
prefixes (245859 and 491632 tokens). No cgroup memory-limit events occurred
in any 262K case. 512K near-full had 1970 limit events, 11 in its continuation;
these are memory reclamation events, not OOMs or aborted generations.
**Conclusion:** the severe dual-slot pressure was not reproduced by either
single-slot profile. 262K has clear reserve in these tests. 512K has much less
reserve and briefly hits the cap, but measured full memory PSI stayed about
0.25%, versus roughly 30% in the prior dual-slot fresh-context cases. Do not
confuse high RAM/cache occupancy with severe memory stalls. Host page cache
was not flushed and measurement order affects physical storage reads; these
are warm-system experiments, not guaranteed first-boot cold-start numbers.
Both single-slot near-full tests also had zero prefix reuse on the initial
request, so their low storage traffic is not explained by skipping prompt work.
CPU vision was present but these memory cases did not process an image.
## Validation
Python compile checks pass. Existing 14 `test_strata.py` tests, including the
encrypted backup/restore-version plan, pass in an isolated container using the
existing application image with the new pinned recipe. No production mounts,
network or exposed ports. Synthetic setup mode was enabled **only in that test
container**. Local macOS attempts first encountered the sandbox loopback bind
restriction, then a missing local `cryptography` package; no production workaround
or dependency change was made for those local test-environment limitations.
This does not constitute a native fresh-host restore acceptance.
## Installed update and endpoint acceptance
Completed 14 October 2026, approximately 13:33 Europe/Berlin. Direct native
build in the existing path; no new fallback generation. CPU vision and both
existing prepared packs were checked successfully. Minimal Deck image now
`athena-deck-standalone:strata-0.1.44.1-20261014`; installed binary reports
`strata 0.1.44.1`. Source HEAD, runtime `ready.json`, CPU `vision-ready.json`
and the recipe actually loaded by Deck all match
`296b59d2f73c8f04a805df29c2fa97655adace78`.
See `versions.json` (including binary SHA-256). Actual cgroup memory and
memory+swap limit remain 44 GiB; Samsung-980 extra mount is present.
`restore-after-update.json` confirms regular HTTP 200 generation on the prior
`flash-next-strata-iq3-dual` and actual loaded state. `acceptance.json` records:
- Two synchronized synthetic text requests, HTTP 200 each, 256 output tokens
each, nonempty replies, completed in 9.62 and 9.35 seconds. Regular Deck status
observed **two active requests at once**. These short acceptance timings are
not the earlier resource benchmark or a statistically qualified speed claim.
- Synthetic red 128×128 image through the normal Deck API: HTTP 200 and correct
red-color recognition, confirming CPU-Vision integration after the rebuild.
- Zero active requests after acceptance, LLM still loaded. Final status also
confirms CPU STT loaded and unchanged IQ3 API IDs, contexts and slot counts.
- Both own single-memory/update systemd jobs inactive, test containers removed.
The native Mac app could not be visually rechecked after activation because
the user's Mac was locked while away. No automatic unlock/login bypass was
attempted. Verification above comes from the actual regular endpoint, runtime
files and container settings; no GUI confirmation or fresh-host restore is
claimed. The earlier memory table explicitly describes **pre-update 0.1.43.1**;
the new release was accepted with short parallel text and CPU vision, not
silently credited with the old version's long-context measurements.
Reproduction uses existing `test_strata.py`, the native pinned installers and
the included synthetic harness. `after_tests.py` is a one-shot sequence, not
a recurring automation. Build/progress logs and synthetic fixture text remain
in the experiment directory on Athena and are not committed to Git.
@@ -0,0 +1,43 @@
{
"text_requests": [
{
"http_status": 200,
"seconds": 9.624581525989925,
"usage": {
"prompt_tokens": 26,
"completion_tokens": 256,
"total_tokens": 282,
"prompt_tokens_details": {
"cached_tokens": 0
}
},
"nonempty": true
},
{
"http_status": 200,
"seconds": 9.345493546003127,
"usage": {
"prompt_tokens": 31,
"completion_tokens": 256,
"total_tokens": 287,
"prompt_tokens_details": {
"cached_tokens": 0
}
},
"nonempty": true
}
],
"max_observed_active_requests": 2,
"vision_http_status": 200,
"vision_red_recognized": true,
"vision_usage": {
"prompt_tokens": 48,
"completion_tokens": 2,
"total_tokens": 50,
"prompt_tokens_details": {
"cached_tokens": 0
}
},
"active_requests_after": 0,
"loaded_after": true
}
@@ -0,0 +1,12 @@
"""One-shot sequencing only; never interrupt a test or start extra tests."""
import json,pathlib,subprocess,time
root=pathlib.Path('/data/experiments/strata-single-memory-20261014')
deadline=time.monotonic()+7200
while time.monotonic()<deadline:
value=json.loads((root/'launcher-status.json').read_text())
if value['phase']=='tests_complete_ready_for_update':
subprocess.run(['/usr/bin/python3','/opt/athena-deck-dev/single-update-20261014/update.py'],check=True)
break
if value['phase'] in ('test_failed','failed'):raise RuntimeError('Single-slot measurements did not finish; inspect own test status')
time.sleep(5)
else:raise TimeoutError('One-shot maintenance deadline')
@@ -0,0 +1,28 @@
"""Direct native runtime replacement, inside existing container toolchain only."""
import json,os,pathlib,subprocess,time
P=pathlib.Path;ROOT=P('/var/lib/deck/strata-runtime');APP=P('/update/app');OUT=P('/progress');DATA=P('/data/athena-deck-strata')
recipe=json.loads((APP/'strata_sources.json').read_text())
def mark(phase,state='running',**extra):
p=OUT/'build-status.tmp';p.write_text(json.dumps(dict(phase=phase,state=state,updated=time.time(),version=recipe['version'],**extra)));p.replace(OUT/'build-status.json')
def run(args):
with (OUT/'build.log').open('a') as f:subprocess.run(list(map(str,args)),stdout=f,stderr=subprocess.STDOUT,check=True)
def main():
os.environ['PATH']=str(ROOT/'cuda/bin')+os.pathsep+str(ROOT/'source/.venv/bin')+os.pathsep+os.environ.get('PATH','')
os.environ['CUDAToolkit_ROOT']=str(ROOT/'cuda')
os.environ['LD_LIBRARY_PATH']=str(ROOT/'cuda/lib64')+os.pathsep+str(ROOT/'cuda/lib')+os.pathsep+os.environ.get('LD_LIBRARY_PATH','')
mark('engine_compile_direct_replacement')
run(['python3',APP/'deploy/install_strata.py','--destination',ROOT,'--nvcc',ROOT/'cuda/bin/nvcc','--update'])
mark('cpu_vision_compile')
run(['python3',APP/'deploy/install_strata_vision.py','--runtime',ROOT,'--storage',DATA])
source=ROOT/'source';python=source/'.venv/bin/python'
# Explicit existing quantization: never accept the upstream changed IQ3_S default.
for quant in ('IQ3_XXS','IQ2_XS'):
marker=DATA/'models'/quant/'prepared.json'
if not marker.exists():continue
mark('verify_existing_pack',quant=quant)
run([python,source/'setup.py','--setup','--yes','--family','qwen','--model',quant,'--context','131072','--vision','no','--data-dir',DATA,'--gguf-dir',marker.parent,'--gpus','0,1','--layer-split','16','--low-ram','resident','--kv-streaming','on','--no-start','--no-browser'])
value=json.loads(marker.read_text());value['commit']=recipe['code'];marker.write_text(json.dumps(value))
mark('complete',state='complete',commit=recipe['code'])
if __name__=='__main__':
try:main()
except BaseException as e:mark('failed',state='failed',error_type=type(e).__name__);raise
@@ -0,0 +1,40 @@
{
"active_requests": 0,
"llm": {
"enabled": 12,
"available": 12,
"loaded": true,
"supported": true
},
"stt": {
"enabled": 1,
"available": 1,
"loaded": true,
"supported": true
},
"test_units": {
"athena-strata-single-memory-20261014": "inactive",
"athena-strata-single-update-20261014": "inactive"
},
"own_containers": [],
"profiles": [
{
"model": "flash-next-strata-iq3",
"context": 262144,
"slots": 1,
"vision_device": "cpu"
},
{
"model": "flash-next-strata-iq3-512k",
"context": 524288,
"slots": 1,
"vision_device": "cpu"
},
{
"model": "flash-next-strata-iq3-dual",
"context": 262144,
"slots": 2,
"vision_device": "cpu"
}
]
}
@@ -0,0 +1,33 @@
"""Host launcher: separate fresh cgroups, sequential tests, then direct update."""
import json,pathlib,subprocess,sys,time
P=pathlib.Path
STAGE=P('/opt/athena-deck-dev/single-update-20261014')
OUT=P('/data/experiments/strata-single-memory-20261014')
sys.path.insert(0,'/opt/athena-deck-dev/batch-ab-20261014')
from launch import request
def mark(phase,**extra):
p=OUT/'launcher.tmp';p.write_text(json.dumps(dict(phase=phase,updated=time.time(),**extra)));p.replace(OUT/'launcher-status.json')
def main():
_,s=request('/api/v1/status');e=s['endpoint']
if e['active_requests'] or e['counts']['llm']['loaded']:raise RuntimeError('Regular GUI unload required')
g=subprocess.check_output(['nvidia-smi','--query-compute-apps=pid','--format=csv,noheader,nounits'],text=True).strip()
if g and 'No running processes' not in g:raise RuntimeError('GPUs not free')
d=json.loads(subprocess.check_output(['docker','inspect','athena-deck-dev']))[0]
for ctx in (262144,524288):
target=OUT/str(ctx);target.mkdir(exist_ok=False);target.chmod(0o700)
import os,shutil
os.chown(target,65534,65534);(target/'home').mkdir();os.chown(target/'home',65534,65534)
if ctx==524288:
for f in (OUT/'262144').glob('fixture-131072-*.json'):
shutil.copyfile(f,target/f.name);os.chown(target/f.name,65534,65534)
args=['docker','run','--rm','--name','athena-strata-single-'+str(ctx)+'-20261014','--gpus','all','--user','65534:65534','--read-only','--cap-drop','ALL','--security-opt','no-new-privileges:true','--memory','44g','--memory-swap','44g','--cpus','6','--network','none','--tmpfs','/tmp:rw,nosuid,nodev,size=512m','-e','HOME=/experiment/home','-e','PYTHONDONTWRITEBYTECODE=1','-e','NVIDIA_DRIVER_CAPABILITIES=compute,utility','-e','TEST_CONTEXT='+str(ctx),'--entrypoint','python3']
for m in d['Mounts']:
if m['Type']=='bind' and (m['Destination']=='/var/lib/deck' or 'strata' in m['Destination']):args+=['--mount',f"type=bind,src={m['Source']},dst={m['Destination']},readonly"]
args+=['--mount',f'type=bind,src={STAGE},dst=/test,readonly','--mount',f'type=bind,src={target},dst=/experiment',d['Config']['Image'],'/test/single.py']
mark('testing',context=ctx)
with (target/'container.log').open('w') as f:r=subprocess.run(args,stdout=f,stderr=subprocess.STDOUT)
if r.returncode:mark('test_failed',context=ctx,exit_code=r.returncode);return
mark('tests_complete_ready_for_update')
if __name__=='__main__':
try:main()
except BaseException as e:mark('failed',error_type=type(e).__name__);raise
@@ -0,0 +1,186 @@
"""Isolated, synthetic serial-MTP versus pipelined dual-slot comparison."""
import concurrent.futures, copy, json, os, pathlib, random, re, signal
import socket, subprocess, threading, time, urllib.request
P = pathlib.Path
ROOT = P('/experiment')
SOURCE = P('/var/lib/deck/strata-runtime/source')
MODEL = 'synthetic-batch-ab'
KEY = 'synthetic-isolated-batch-test'
RESULTS = []
def save(phase, **extra):
ROOT.mkdir(exist_ok=True)
p = ROOT/'status.tmp'
p.write_text(json.dumps(dict(phase=phase, completed=len(RESULTS), updated=time.time(), **extra)))
p.replace(ROOT/'status.json')
(ROOT/'results.json').write_text(json.dumps(RESULTS, indent=2))
def http(base, route, data=None, timeout=900):
req = urllib.request.Request(base+route, data=json.dumps(data).encode() if data is not None else None,
headers={'Authorization':'Bearer '+KEY, 'Content-Type':'application/json'})
return urllib.request.urlopen(req, timeout=timeout)
def numeric():
cg=P('/sys/fs/cgroup')
stat=dict((k,int(v)) for k,v in (x.split() for x in (cg/'memory.stat').read_text().splitlines()))
events=dict((k,int(v)) for k,v in (x.split() for x in (cg/'memory.events').read_text().splitlines()))
io=0; ticks=0
for p in P('/proc').glob('[0-9]*'):
try:
if (p/'comm').read_text().strip()!='strata': continue
st=(p/'stat').read_text().rsplit(')',1)[1].split()
ticks+=int(st[11])+int(st[12])
io+=int(dict(x.split(':') for x in (p/'io').read_text().splitlines())['read_bytes'])
except (OSError,ValueError): pass
pressure={x.split()[0]:int(re.search(r'total=(\d+)',x).group(1)) for x in (cg/'memory.pressure').read_text().splitlines()}
return dict(at=time.monotonic(), memory=int((cg/'memory.current').read_text()), read_bytes=io,
cpu_ticks=ticks, refault=stat.get('workingset_refault_file',0), major_fault=stat.get('pgmajfault',0),
max_events=events.get('max',0), oom=events.get('oom',0), oom_kill=events.get('oom_kill',0), pressure=pressure)
class Sampler:
def __init__(self,base): self.base=base; self.rows=[]; self.stop=threading.Event()
def run(self):
while not self.stop.is_set():
try:
r=numeric()
with http(self.base,'/slots',timeout=3) as response:
r['processing_slots']=sum(bool(x.get('is_processing')) for x in json.load(response))
if len(self.rows)%5==0:
raw=subprocess.check_output(['nvidia-smi','--query-gpu=index,utilization.gpu,memory.used','--format=csv,noheader,nounits'],text=True,timeout=8)
r['gpus']=[[float(v.strip()) for v in line.split(',')] for line in raw.splitlines()]
self.rows.append(r)
except (OSError,ValueError): pass
self.stop.wait(1)
def generate(base,messages,limit=512):
body=dict(model=MODEL,messages=messages,max_tokens=limit,reasoning_effort='none',
temperature=0,top_p=1,top_k=0,seed=42,stream=True,stream_options={'include_usage':True})
start=time.monotonic(); first=None; content=''; usage={}; timings={}; finish=None; done=False
with http(base,'/v1/chat/completions',body) as response:
for line in response:
if not line.startswith(b'data:'): continue
raw=line[5:].strip()
if raw==b'[DONE]': done=True; break
v=json.loads(raw)
if 'error' in v: raise RuntimeError('Synthetic stream returned an error')
usage=v.get('usage') or usage
timings=v.get('timings') or v.get('backend_timings') or timings
for choice in v.get('choices',[]):
text=choice.get('delta',{}).get('content') or ''
if text and first is None: first=time.monotonic()
content+=text
finish=choice.get('finish_reason') or finish
if not done: raise RuntimeError('Synthetic stream ended without DONE')
return dict(wall_seconds=time.monotonic()-start,ttft_seconds=first-start if first else None,
usage=usage,backend_timings=timings,finish_reason=finish,_content=content)
def fixture(base,target,client):
path=ROOT/f'fixture-{target}-{client}.json'
if path.exists(): return json.loads(path.read_text())
system=f'Messung Kontext {target}, Gespräch {client}. Antworte auf Deutsch. Schreibe mindestens 1200 Wörter über '+('Home-Assistant-Automatisierungen.' if client else 'zuverlässige Datensicherung.')
def count(text):
with http(base,'/v1/messages/count_tokens',dict(model=MODEL,system=system,messages=[dict(role='user',content=text)]),120) as r:
return json.load(r)['input_tokens']
rng=random.Random(20261014+client)
rows=[f'Datensatz {i:06d}: Standort {rng.randrange(10000):04d}, Messwert {rng.randrange(100000000,999999999)}, Status archiviert.\n' for i in range(target//10+300)]
per=(count(''.join(rows[:100]))-count(''))/100
n=int((target-count(''))/per)
for _ in range(6):
text=''.join(rows[:n])+'\nFühre jetzt die ausführliche Schreibaufgabe aus.'
actual=count(text); delta=target-actual
if abs(delta)<64: break
n=max(1,n+int(delta/per))
if abs(actual-target)>128: raise RuntimeError('Tokenizer calibration failed')
value=[dict(role='system',content=system),dict(role='user',content=text)]
path.write_text(json.dumps(value)); return value
def measure(base,arm,case,messages,limit=512):
save('measuring',arm=arm,case=case)
before=numeric(); sampler=Sampler(base); thread=threading.Thread(target=sampler.run,daemon=True);thread.start()
start=time.monotonic()
try:
if len(messages)==1: rows=[generate(base,messages[0],limit)]
else:
barrier=threading.Barrier(len(messages))
def one(m): barrier.wait(); return generate(base,m,limit)
with concurrent.futures.ThreadPoolExecutor(max_workers=len(messages)) as pool: rows=list(pool.map(one,messages))
finally:
sampler.stop.set();thread.join(5)
elapsed=time.monotonic()-start; after=numeric(); peak=max([before['memory'],after['memory']]+[r['memory'] for r in sampler.rows])
res=dict(arm=arm,case=case,requests=len(messages),wall_seconds=elapsed,
aggregate_output_tok_s=sum(r['usage'].get('completion_tokens',0) for r in rows)/elapsed,
rows=[{k:v for k,v in r.items() if k!='_content'} for r in rows],
resources=dict(peak_memory_gib=peak/2**30,read_gib=(after['read_bytes']-before['read_bytes'])/2**30,
read_mib_s=(after['read_bytes']-before['read_bytes'])/elapsed/2**20,
refaults=after['refault']-before['refault'],major_faults=after['major_fault']-before['major_fault'],
limit_events=after['max_events']-before['max_events'],oom_kill_delta=after['oom_kill']-before['oom_kill'],
cpu_cores=(after['cpu_ticks']-before['cpu_ticks'])/os.sysconf('SC_CLK_TCK')/elapsed,
pressure_full_percent=(after['pressure']['full']-before['pressure']['full'])/elapsed/10000,
peak_processing_slots=max([0]+[r.get('processing_slots',0) for r in sampler.rows])))
gpu_rows=[g for r in sampler.rows for g in r.get('gpus',[])]
res['resources']['gpu_samples']={str(int(i)):dict(mean_utilization=sum(g[1] for g in gpu_rows if g[0]==i)/sum(g[0]==i for g in gpu_rows),peak_memory_mib=max(g[2] for g in gpu_rows if g[0]==i)) for i in {g[0] for g in gpu_rows}}
RESULTS.append(res);save('measured',arm=arm,case=case)
return rows
def run():
baseline=json.loads(P('/test/base-template.json').read_text())
baseline.pop('previous_model',None)
for arm,group in [('serial_mtp','1'),('pipeline','auto')]:
if arm not in os.environ.get('TEST_ARMS','serial_mtp,pipeline').split(','):continue
cfg=copy.deepcopy(baseline); args=cfg['args']
if '--batch-groups' in args:
i=args.index('--batch-groups');del args[i:i+2]
args+=['--batch-groups',group]
if os.environ.get('TEST_RESIDENT_GIB'):
if '--resident-budget-gib' in args:
i=args.index('--resident-budget-gib');del args[i:i+2]
args+=['--resident-budget-gib',os.environ['TEST_RESIDENT_GIB']]
with socket.socket() as s:s.bind(('127.0.0.1',0));port=s.getsockname()[1]
cfg.update(api_key=KEY,port=port,host='127.0.0.1',model_name=MODEL,open_browser=False,log=str(ROOT/f'engine-{arm}.log'))
path=ROOT/f'config-{arm}.json';path.write_text(json.dumps(cfg));path.chmod(0o600)
base=f'http://127.0.0.1:{port}'; proc=None
env=dict(os.environ,**cfg.get('env',{}),PYTHONUNBUFFERED='1',PYTHONDONTWRITEBYTECODE='1')
env['LD_LIBRARY_PATH']='/var/lib/deck/strata-runtime/cuda/lib64:/var/lib/deck/strata-runtime/cuda/lib:'+env.get('LD_LIBRARY_PATH','')
try:
save('loading',arm=arm)
with (ROOT/f'server-{arm}.log').open('w') as log:
proc=subprocess.Popen([str(SOURCE/'.venv/bin/python'),str(SOURCE/'serve/server.py'),'--engine','strata','--config',str(path),'--host','127.0.0.1','--port',str(port),'--fit-max-tokens'],cwd=SOURCE,env=env,stdout=log,stderr=subprocess.STDOUT,start_new_session=True)
end=time.monotonic()+600
while time.monotonic()<end:
if proc.poll() is not None: raise RuntimeError('Test server exited while loading')
try:
with http(base,'/health',timeout=3) as r: h=json.load(r)
if h.get('status')=='ok' and h.get('loaded',True): break
except (OSError,ValueError): pass
time.sleep(1)
else: raise TimeoutError('Test load deadline')
with http(base,'/v1/status') as r: status=json.load(r)
if status.get('concurrency',{}).get('serving')!=2: raise RuntimeError('Two slots not confirmed')
if os.environ.get('TEST_RESIDENT_GIB'):
text=(ROOT/f'engine-{arm}.log').read_text(errors='replace')
allocated=re.findall(r'resident RAM mode: ([0-9.]+) GiB of experts in RAM',text)
expected=float(os.environ['TEST_RESIDENT_GIB'])
if not allocated or abs(float(allocated[-1])-expected)>0.02:
raise RuntimeError('Controlled expert budget was clamped; do not compare unequal allocations')
for rep in range(int(os.environ.get('TEST_REPETITIONS','2'))):
msgs=[[dict(role='system',content=f'Kurzmessung {rep}, Gespräch {i}. Schreibe auf Deutsch.'),dict(role='user',content='Schreibe einen ausführlichen Fachtext mit mindestens 1200 Wörtern über '+('Home Assistant.' if i else 'Datensicherung.'))] for i in range(2)]
measure(base,arm,f'solo-short-{rep}',[msgs[0]])
msgs[0][0]['content']+=' Parallele Messung.'
measure(base,arm,f'parallel-short-{rep}',msgs)
for target in map(int,os.environ.get('TEST_TARGETS','65536,131072').split(',')):
save('calibrating',arm=arm,target=target)
msgs=[fixture(base,target,i) for i in range(2)]
first=measure(base,arm,f'parallel-cold-{target}',msgs,256)
follow=[m+[dict(role='assistant',content=r['_content']),dict(role='user',content='Führe den Fachtext mit mindestens 1200 weiteren Wörtern fort.')] for m,r in zip(msgs,first)]
measure(base,arm,f'parallel-cached-{target}',follow,512)
finally:
if proc and proc.poll() is None:
os.killpg(proc.pid,signal.SIGTERM)
try:proc.wait(30)
except subprocess.TimeoutExpired:os.killpg(proc.pid,signal.SIGKILL);proc.wait()
path.unlink(missing_ok=True)
save('complete')
if __name__=='__main__':
try:run()
except BaseException as e:save('failed',error_type=type(e).__name__);raise
@@ -0,0 +1 @@
{"version": "0.1.44.1", "http_status": 200, "model": "flash-next-strata-iq3-dual", "loaded": true, "active_requests": 0, "backup_created": false}
@@ -0,0 +1,287 @@
[
{
"arm": "single-262144",
"case": "short",
"requests": 1,
"wall_seconds": 8.340111433004495,
"aggregate_output_tok_s": 61.39006704081337,
"rows": [
{
"wall_seconds": 8.340038196009118,
"ttft_seconds": 0.6307227550132666,
"usage": {
"prompt_tokens": 47,
"completion_tokens": 512,
"total_tokens": 559,
"prompt_tokens_details": {
"cached_tokens": 0
}
},
"backend_timings": {
"cache_n": 0,
"prompt_n": 47,
"prompt_ms": 589.6,
"prompt_per_token_ms": 12.545,
"prompt_per_second": 79.7,
"predicted_n": 512,
"predicted_ms": 7746.8,
"predicted_per_token_ms": 15.13,
"predicted_per_second": 66.1,
"draft_n": 269,
"draft_n_accepted": 172
},
"finish_reason": "length"
}
],
"resources": {
"peak_memory_gib": 30.94940948486328,
"read_gib": 0.054141998291015625,
"read_mib_s": 6.647561809618105,
"refaults": 0,
"major_faults": 1,
"limit_events": 0,
"oom_kill_delta": 0,
"cpu_cores": 5.878818334006015,
"pressure_full_percent": 0.0,
"peak_processing_slots": 1,
"gpu_samples": {
"0": {
"mean_utilization": 20.5,
"peak_memory_mib": 11249.0
},
"1": {
"mean_utilization": 29.0,
"peak_memory_mib": 15524.0
}
}
}
},
{
"arm": "single-262144",
"case": "cold-131072",
"requests": 1,
"wall_seconds": 68.19656064300216,
"aggregate_output_tok_s": 1.8769274988816382,
"rows": [
{
"wall_seconds": 68.19648740600678,
"ttft_seconds": 66.23631558900524,
"usage": {
"prompt_tokens": 131072,
"completion_tokens": 128,
"total_tokens": 131200,
"prompt_tokens_details": {
"cached_tokens": 0
}
},
"backend_timings": {
"cache_n": 0,
"prompt_n": 131072,
"prompt_ms": 66153.0,
"prompt_per_token_ms": 0.505,
"prompt_per_second": 1981.3,
"predicted_n": 128,
"predicted_ms": 1978.0,
"predicted_per_token_ms": 15.453,
"predicted_per_second": 64.7,
"draft_n": 69,
"draft_n_accepted": 49
},
"finish_reason": "length"
}
],
"resources": {
"peak_memory_gib": 39.1279296875,
"read_gib": 7.173004150390625,
"read_mib_s": 107.70566991568228,
"refaults": 5,
"major_faults": 30766,
"limit_events": 0,
"oom_kill_delta": 0,
"cpu_cores": 1.16838736805382,
"pressure_full_percent": 0.012450774525784367,
"peak_processing_slots": 1,
"gpu_samples": {
"0": {
"mean_utilization": 95.85714285714286,
"peak_memory_mib": 11289.0
},
"1": {
"mean_utilization": 52.07142857142857,
"peak_memory_mib": 15580.0
}
}
}
},
{
"arm": "single-262144",
"case": "cached-131072",
"requests": 1,
"wall_seconds": 4.248033206997206,
"aggregate_output_tok_s": 60.26318240128775,
"rows": [
{
"wall_seconds": 4.247962383989943,
"ttft_seconds": 0.47587463600211777,
"usage": {
"prompt_tokens": 131233,
"completion_tokens": 256,
"total_tokens": 131489,
"prompt_tokens_details": {
"cached_tokens": 131199
}
},
"backend_timings": {
"cache_n": 131199,
"prompt_n": 34,
"prompt_ms": 384.6,
"prompt_per_token_ms": 11.312,
"prompt_per_second": 88.4,
"predicted_n": 256,
"predicted_ms": 3793.4,
"predicted_per_token_ms": 14.818,
"predicted_per_second": 67.5,
"draft_n": 151,
"draft_n_accepted": 108
},
"finish_reason": "length"
}
],
"resources": {
"peak_memory_gib": 39.09386444091797,
"read_gib": 0.0212554931640625,
"read_mib_s": 5.123694646300893,
"refaults": 0,
"major_faults": 0,
"limit_events": 0,
"oom_kill_delta": 0,
"cpu_cores": 5.755604725435489,
"pressure_full_percent": 0.0,
"peak_processing_slots": 1,
"gpu_samples": {
"0": {
"mean_utilization": 28.0,
"peak_memory_mib": 11289.0
},
"1": {
"mean_utilization": 67.0,
"peak_memory_mib": 15580.0
}
}
}
},
{
"arm": "single-262144",
"case": "cold-245760",
"requests": 1,
"wall_seconds": 131.31004364699766,
"aggregate_output_tok_s": 0.9747921518029795,
"rows": [
{
"wall_seconds": 131.3099300640024,
"ttft_seconds": 129.42870114000107,
"usage": {
"prompt_tokens": 245732,
"completion_tokens": 128,
"total_tokens": 245860,
"prompt_tokens_details": {
"cached_tokens": 0
}
},
"backend_timings": {
"cache_n": 0,
"prompt_n": 245732,
"prompt_ms": 129293.8,
"prompt_per_token_ms": 0.526,
"prompt_per_second": 1900.6,
"predicted_n": 128,
"predicted_ms": 1897.7,
"predicted_per_token_ms": 14.826,
"predicted_per_second": 67.5,
"draft_n": 67,
"draft_n_accepted": 46
},
"finish_reason": "length"
}
],
"resources": {
"peak_memory_gib": 40.7127685546875,
"read_gib": 1.5624160766601562,
"read_mib_s": 12.184247435032981,
"refaults": 0,
"major_faults": 6218,
"limit_events": 0,
"oom_kill_delta": 0,
"cpu_cores": 1.0954226805885983,
"pressure_full_percent": 0.0021582507486012843,
"peak_processing_slots": 1,
"gpu_samples": {
"0": {
"mean_utilization": 91.70370370370371,
"peak_memory_mib": 11289.0
},
"1": {
"mean_utilization": 42.7037037037037,
"peak_memory_mib": 15590.0
}
}
}
},
{
"arm": "single-262144",
"case": "cached-245760",
"requests": 1,
"wall_seconds": 4.193191621001461,
"aggregate_output_tok_s": 61.05134778907611,
"rows": [
{
"wall_seconds": 4.193123763005133,
"ttft_seconds": 0.4659214749990497,
"usage": {
"prompt_tokens": 245893,
"completion_tokens": 256,
"total_tokens": 246149,
"prompt_tokens_details": {
"cached_tokens": 245859
}
},
"backend_timings": {
"cache_n": 245859,
"prompt_n": 34,
"prompt_ms": 324.3,
"prompt_per_token_ms": 9.538,
"prompt_per_second": 104.8,
"predicted_n": 256,
"predicted_ms": 3747.1,
"predicted_per_token_ms": 14.637,
"predicted_per_second": 68.3,
"draft_n": 154,
"draft_n_accepted": 105
},
"finish_reason": "length"
}
],
"resources": {
"peak_memory_gib": 40.67921447753906,
"read_gib": 0.015766143798828125,
"read_mib_s": 3.850177313419366,
"refaults": 0,
"major_faults": 0,
"limit_events": 0,
"oom_kill_delta": 0,
"cpu_cores": 5.709254945587821,
"pressure_full_percent": 0.0,
"peak_processing_slots": 1,
"gpu_samples": {
"0": {
"mean_utilization": 40.0,
"peak_memory_mib": 11289.0
},
"1": {
"mean_utilization": 48.0,
"peak_memory_mib": 15590.0
}
}
}
}
]
@@ -0,0 +1,287 @@
[
{
"arm": "single-524288",
"case": "short",
"requests": 1,
"wall_seconds": 8.589486170996679,
"aggregate_output_tok_s": 59.60775648359769,
"rows": [
{
"wall_seconds": 8.589409957989119,
"ttft_seconds": 0.6589462979900418,
"usage": {
"prompt_tokens": 47,
"completion_tokens": 512,
"total_tokens": 559,
"prompt_tokens_details": {
"cached_tokens": 0
}
},
"backend_timings": {
"cache_n": 0,
"prompt_n": 47,
"prompt_ms": 616.8,
"prompt_per_token_ms": 13.123,
"prompt_per_second": 76.2,
"predicted_n": 512,
"predicted_ms": 7966.1,
"predicted_per_token_ms": 15.559,
"predicted_per_second": 64.3,
"draft_n": 303,
"draft_n_accepted": 191
},
"finish_reason": "length"
}
],
"resources": {
"peak_memory_gib": 37.48900604248047,
"read_gib": 0.05385589599609375,
"read_mib_s": 6.42045826748224,
"refaults": 0,
"major_faults": 0,
"limit_events": 0,
"oom_kill_delta": 0,
"cpu_cores": 5.8757880268108895,
"pressure_full_percent": 0.0,
"peak_processing_slots": 1,
"gpu_samples": {
"0": {
"mean_utilization": 18.0,
"peak_memory_mib": 11249.0
},
"1": {
"mean_utilization": 26.0,
"peak_memory_mib": 15520.0
}
}
}
},
{
"arm": "single-524288",
"case": "cold-131072",
"requests": 1,
"wall_seconds": 71.242702189993,
"aggregate_output_tok_s": 1.7966752532581411,
"rows": [
{
"wall_seconds": 71.2426205160009,
"ttft_seconds": 69.33030188399425,
"usage": {
"prompt_tokens": 131072,
"completion_tokens": 128,
"total_tokens": 131200,
"prompt_tokens_details": {
"cached_tokens": 0
}
},
"backend_timings": {
"cache_n": 0,
"prompt_n": 131072,
"prompt_ms": 69238.7,
"prompt_per_token_ms": 0.528,
"prompt_per_second": 1893.0,
"predicted_n": 128,
"predicted_ms": 1930.9,
"predicted_per_token_ms": 15.085,
"predicted_per_second": 66.3,
"draft_n": 69,
"draft_n_accepted": 51
},
"finish_reason": "length"
}
],
"resources": {
"peak_memory_gib": 43.41750717163086,
"read_gib": 8.048011779785156,
"read_mib_s": 115.67730882136,
"refaults": 6,
"major_faults": 34819,
"limit_events": 0,
"oom_kill_delta": 0,
"cpu_cores": 1.1639086875012896,
"pressure_full_percent": 2.8073050832158457e-06,
"peak_processing_slots": 1,
"gpu_samples": {
"0": {
"mean_utilization": 91.46666666666667,
"peak_memory_mib": 11295.0
},
"1": {
"mean_utilization": 42.333333333333336,
"peak_memory_mib": 15578.0
}
}
}
},
{
"arm": "single-524288",
"case": "cached-131072",
"requests": 1,
"wall_seconds": 4.198339095004485,
"aggregate_output_tok_s": 60.97649432476976,
"rows": [
{
"wall_seconds": 4.198248294997029,
"ttft_seconds": 0.45782527899427805,
"usage": {
"prompt_tokens": 131233,
"completion_tokens": 256,
"total_tokens": 131489,
"prompt_tokens_details": {
"cached_tokens": 131200
}
},
"backend_timings": {
"cache_n": 131200,
"prompt_n": 33,
"prompt_ms": 370.5,
"prompt_per_token_ms": 11.227,
"prompt_per_second": 89.1,
"predicted_n": 256,
"predicted_ms": 3757.4,
"predicted_per_token_ms": 14.677,
"predicted_per_second": 68.1,
"draft_n": 138,
"draft_n_accepted": 94
},
"finish_reason": "length"
}
],
"resources": {
"peak_memory_gib": 43.36903381347656,
"read_gib": 0.023090362548828125,
"read_mib_s": 5.631877443661978,
"refaults": 0,
"major_faults": 10,
"limit_events": 0,
"oom_kill_delta": 0,
"cpu_cores": 5.764184229138391,
"pressure_full_percent": 2.381894309561319e-05,
"peak_processing_slots": 1,
"gpu_samples": {
"0": {
"mean_utilization": 21.0,
"peak_memory_mib": 11295.0
},
"1": {
"mean_utilization": 52.0,
"peak_memory_mib": 15578.0
}
}
}
},
{
"arm": "single-524288",
"case": "cold-491520",
"requests": 1,
"wall_seconds": 301.10723286500433,
"aggregate_output_tok_s": 0.4250977260894505,
"rows": [
{
"wall_seconds": 301.1071569240012,
"ttft_seconds": 299.1330768480111,
"usage": {
"prompt_tokens": 491504,
"completion_tokens": 128,
"total_tokens": 491632,
"prompt_tokens_details": {
"cached_tokens": 0
}
},
"backend_timings": {
"cache_n": 0,
"prompt_n": 491504,
"prompt_ms": 298873.8,
"prompt_per_token_ms": 0.608,
"prompt_per_second": 1644.5,
"predicted_n": 128,
"predicted_ms": 1991.8,
"predicted_per_token_ms": 15.561,
"predicted_per_second": 64.3,
"draft_n": 65,
"draft_n_accepted": 49
},
"finish_reason": "length"
}
],
"resources": {
"peak_memory_gib": 43.999996185302734,
"read_gib": 2.179107666015625,
"read_mib_s": 7.410669709818656,
"refaults": 142628,
"major_faults": 18521,
"limit_events": 1970,
"oom_kill_delta": 0,
"cpu_cores": 1.0547405220995982,
"pressure_full_percent": 0.25061337544764895,
"peak_processing_slots": 1,
"gpu_samples": {
"0": {
"mean_utilization": 96.13333333333334,
"peak_memory_mib": 11295.0
},
"1": {
"mean_utilization": 48.516666666666666,
"peak_memory_mib": 15596.0
}
}
}
},
{
"arm": "single-524288",
"case": "cached-491520",
"requests": 1,
"wall_seconds": 4.785418961007963,
"aggregate_output_tok_s": 53.49583852237635,
"rows": [
{
"wall_seconds": 4.785312750987941,
"ttft_seconds": 0.6256935699930182,
"usage": {
"prompt_tokens": 491665,
"completion_tokens": 256,
"total_tokens": 491921,
"prompt_tokens_details": {
"cached_tokens": 491632
}
},
"backend_timings": {
"cache_n": 491632,
"prompt_n": 33,
"prompt_ms": 362.7,
"prompt_per_token_ms": 10.991,
"prompt_per_second": 91.0,
"predicted_n": 256,
"predicted_ms": 4181.8,
"predicted_per_token_ms": 16.335,
"predicted_per_second": 61.2,
"draft_n": 151,
"draft_n_accepted": 99
},
"finish_reason": "length"
}
],
"resources": {
"peak_memory_gib": 43.89266586303711,
"read_gib": 0.020603179931640625,
"read_mib_s": 4.4087375466820475,
"refaults": 6,
"major_faults": 8,
"limit_events": 11,
"oom_kill_delta": 0,
"cpu_cores": 5.57317973981163,
"pressure_full_percent": 0.01863995623514051,
"peak_processing_slots": 1,
"gpu_samples": {
"0": {
"mean_utilization": 48.0,
"peak_memory_mib": 11295.0
},
"1": {
"mean_utilization": 50.0,
"peak_memory_mib": 15596.0
}
}
}
}
]
@@ -0,0 +1 @@
{"context": 262144, "slots": 1, "allocated_expert_gib": 21.72, "memory_limit_gib": 44, "vision": "cpu", "rope_scale": 1}
@@ -0,0 +1 @@
{"context": 524288, "slots": 1, "allocated_expert_gib": 21.92, "memory_limit_gib": 44, "vision": "cpu", "rope_scale": 2}
@@ -0,0 +1,57 @@
"""Synthetic single-slot pressure test; no production inputs or responses saved."""
import copy,json,os,pathlib,re,signal,socket,subprocess,time
import measure as b
P=pathlib.Path
CTX=int(os.environ['TEST_CONTEXT'])
b.ROOT=P('/experiment');b.RESULTS=[]
def run():
cfg=json.loads(P('/test/base-template.json').read_text());cfg.pop('previous_model',None)
args=cfg['args']
for flag in ('--batch-groups','--resident-budget-gib','--rope-scaling','--rope-scale'):
if flag in args:i=args.index(flag);del args[i:i+2]
if '--batch-mtp' in args:args.remove('--batch-mtp')
args[args.index('--max-context')+1]=str(CTX)
if CTX>262144:args+=['--rope-scaling','yarn','--rope-scale','2']
cfg['parallel']=1
with socket.socket() as s:s.bind(('127.0.0.1',0));port=s.getsockname()[1]
cfg.update(api_key=b.KEY,port=port,host='127.0.0.1',model_name=b.MODEL,open_browser=False,log=str(b.ROOT/'engine.log'))
path=b.ROOT/'config.json';path.write_text(json.dumps(cfg));path.chmod(0o600)
env=dict(os.environ,**cfg.get('env',{}),PYTHONUNBUFFERED='1',PYTHONDONTWRITEBYTECODE='1')
env['LD_LIBRARY_PATH']='/var/lib/deck/strata-runtime/cuda/lib64:/var/lib/deck/strata-runtime/cuda/lib:'+env.get('LD_LIBRARY_PATH','')
base=f'http://127.0.0.1:{port}';proc=None;arm=f'single-{CTX}'
try:
b.save('loading',context=CTX)
with (b.ROOT/'server.log').open('w') as log:
proc=subprocess.Popen([str(b.SOURCE/'.venv/bin/python'),str(b.SOURCE/'serve/server.py'),'--engine','strata','--config',str(path),'--host','127.0.0.1','--port',str(port),'--fit-max-tokens'],cwd=b.SOURCE,env=env,stdout=log,stderr=subprocess.STDOUT,start_new_session=True)
end=time.monotonic()+600
while time.monotonic()<end:
if proc.poll() is not None:raise RuntimeError('Synthetic server exited at load')
try:
with b.http(base,'/health',timeout=3) as r:h=json.load(r)
if h.get('status')=='ok' and h.get('loaded',True):break
except (OSError,ValueError):pass
time.sleep(1)
else:raise TimeoutError('Synthetic load deadline')
with b.http(base,'/v1/status') as r:s=json.load(r)
if s.get('concurrency',{}).get('serving')!=1:raise RuntimeError('Single-slot capacity not confirmed')
text=(b.ROOT/'engine.log').read_text(errors='replace')
resident=re.findall(r'resident RAM mode: ([0-9.]+) GiB of experts in RAM',text)
(b.ROOT/'settings.json').write_text(json.dumps(dict(context=CTX,slots=1,allocated_expert_gib=float(resident[-1]) if resident else None,memory_limit_gib=44,vision='cpu',rope_scale=2 if CTX>262144 else 1)))
short=[dict(role='system',content='Synthetischer Geschwindigkeitstest. Antworte auf Deutsch.'),dict(role='user',content='Schreibe mindestens 1200 Wörter über zuverlässige Datensicherung.')]
b.measure(base,arm,'short',[short],512)
for target in (131072,245760 if CTX==262144 else 491520):
b.save('calibrating',context=CTX,target=target)
msgs=b.fixture(base,target,0)
first=b.measure(base,arm,f'cold-{target}',[msgs],128)[0]
follow=msgs+[dict(role='assistant',content=first['_content']),dict(role='user',content='Führe den Fachtext mit mindestens 1200 weiteren Wörtern fort.')]
b.measure(base,arm,f'cached-{target}',[follow],256)
b.save('complete',context=CTX)
finally:
if proc and proc.poll() is None:
os.killpg(proc.pid,signal.SIGTERM)
try:proc.wait(30)
except subprocess.TimeoutExpired:os.killpg(proc.pid,signal.SIGKILL);proc.wait()
path.unlink(missing_ok=True)
if __name__=='__main__':
try:run()
except BaseException as e:b.save('failed',context=CTX,error_type=type(e).__name__);raise
@@ -0,0 +1,30 @@
"""Post-update endpoint acceptance with synthetic text/image; metrics only saved."""
import base64,concurrent.futures,json,pathlib,struct,sys,threading,time,zlib
sys.path.insert(0,'/opt/athena-deck-dev/batch-ab-20261014')
from launch import request
OUT=pathlib.Path('/data/experiments/strata-single-memory-20261014')
MODEL='flash-next-strata-iq3-dual'
barrier=threading.Barrier(2)
def one(i):
barrier.wait();t=time.monotonic()
status,r=request('/v1/chat/completions',dict(model=MODEL,messages=[dict(role='user',content='Schreibe mindestens 1000 Wörter über '+('Datensicherung.' if i==0 else 'Home-Assistant-Automatisierungen.'))],max_tokens=256,reasoning_effort='none',temperature=0))
return dict(http_status=status,seconds=time.monotonic()-t,usage=r.get('usage'),nonempty=bool(r.get('choices',[{}])[0].get('message',{}).get('content')))
def chunk(k,v):return struct.pack('>I',len(v))+k+v+struct.pack('>I',zlib.crc32(k+v)&0xffffffff)
def main():
_,s=request('/api/v1/status')
if s['endpoint']['active_requests']:raise RuntimeError('New production request; skip synthetic smoke')
maximum=0
with concurrent.futures.ThreadPoolExecutor(max_workers=2) as p:
f=[p.submit(one,i) for i in range(2)]
while not all(x.done() for x in f):
_,s=request('/api/v1/status');maximum=max(maximum,s['endpoint']['active_requests']);time.sleep(.25)
rows=[x.result() for x in f]
png=b'\x89PNG\r\n\x1a\n'+chunk(b'IHDR',struct.pack('>IIBBBBB',128,128,8,2,0,0,0))+chunk(b'IDAT',zlib.compress((b'\x00'+b'\xff\x00\x00'*128)*128))+chunk(b'IEND',b'')
data='data:image/png;base64,'+base64.b64encode(png).decode()
status,r=request('/v1/chat/completions',dict(model=MODEL,messages=[dict(role='user',content=[dict(type='text',text='Welche Hauptfarbe hat das einfarbige Bild? Antworte mit einem Wort.'),dict(type='image_url',image_url=dict(url=data))])],max_tokens=32,reasoning_effort='none',temperature=0))
text=r.get('choices',[{}])[0].get('message',{}).get('content','').lower()
_,s=request('/api/v1/status')
result=dict(text_requests=rows,max_observed_active_requests=maximum,vision_http_status=status,vision_red_recognized=('rot' in text or 'red' in text),vision_usage=r.get('usage'),active_requests_after=s['endpoint']['active_requests'],loaded_after=s['endpoint']['counts']['llm']['loaded'])
(OUT/'acceptance.json').write_text(json.dumps(result,indent=2));print(json.dumps(result))
if not all(x['http_status']==200 and x['nonempty'] for x in rows) or status!=200 or not result['vision_red_recognized']:raise RuntimeError('Post-update synthetic acceptance failed')
if __name__=='__main__':main()
@@ -0,0 +1,40 @@
"""Host update driver: no fallback, no host restart, preserve production manifest."""
import importlib.util,json,os,pathlib,subprocess,sys,time
P=pathlib.Path;STAGE=P('/opt/athena-deck-dev/single-update-20261014');OUT=P('/data/experiments/strata-single-memory-20261014')
sys.path.insert(0,'/opt/athena-deck-dev/batch-ab-20261014')
from launch import request
def mark(phase,**extra):
p=OUT/'update.tmp';p.write_text(json.dumps(dict(phase=phase,updated=time.time(),**extra)));p.replace(OUT/'update-status.json')
def idle():
_,s=request('/api/v1/status');e=s['endpoint']
if e['active_requests'] or e['counts']['llm']['loaded']:raise RuntimeError('Maintenance needs the regularly unloaded idle model')
def main():
if json.loads((OUT/'launcher-status.json').read_text())['phase']!='tests_complete_ready_for_update':raise RuntimeError('Tests not complete')
idle()
d=json.loads(subprocess.check_output(['docker','inspect','athena-deck-dev']))[0]
if d['Config']['Labels'].get('de.casaderoll.athena-deck.standalone')!='/opt/athena-deck-dev/runtime':raise RuntimeError('Wrong owner')
progress=OUT/'build';progress.mkdir(exist_ok=False);progress.chmod(0o700);os.chown(progress,65534,65534);(progress/'home').mkdir();os.chown(progress/'home',65534,65534)
args=['docker','run','--rm','--name','athena-strata-update-20261014','--gpus','all','--user','65534:65534','--read-only','--cap-drop','ALL','--security-opt','no-new-privileges:true','--memory','16g','--memory-swap','16g','--cpus','6','--tmpfs','/tmp:rw,nosuid,nodev,size=2g','-e','HOME=/progress/home','-e','PYTHONDONTWRITEBYTECODE=1','-e','NVIDIA_DRIVER_CAPABILITIES=compute,utility','--entrypoint','python3']
for m in d['Mounts']:
if m['Type']=='bind' and (m['Destination']=='/var/lib/deck' or 'strata' in m['Destination']):args+=['--mount',f"type=bind,src={m['Source']},dst={m['Destination']}"]
args+=['--mount',f'type=bind,src={STAGE},dst=/update,readonly','--mount',f'type=bind,src={progress},dst=/progress',d['Config']['Image'],'/update/build.py']
mark('building_direct_replacement')
with (OUT/'build-container.log').open('w') as f:subprocess.run(args,stdout=f,stderr=subprocess.STDOUT,check=True)
spec=importlib.util.spec_from_file_location('deck_install',STAGE/'install-deck.py');m=importlib.util.module_from_spec(spec);spec.loader.exec_module(m)
base=P('/opt/athena-deck-dev/runtime');c=m.load_manifest(base);m.owned(c['name'],base)
image='athena-deck-standalone:strata-0.1.44.1-20261014'
(STAGE/'Dockerfile').write_text('FROM '+d['Config']['Image']+'\nCOPY app/strata_sources.json /app/strata_sources.json\nCOPY app/deploy/install_strata.py /app/deploy/install_strata.py\nCOPY app/deploy/install_strata_vision.py /app/deploy/install_strata_vision.py\n')
mark('building_matching_deck_recipe')
with (OUT/'image-build.log').open('w') as f:subprocess.run(['docker','build','-t',image,str(STAGE)],stdout=f,stderr=subprocess.STDOUT,check=True)
idle();mark('activating_matching_deck_recipe')
m.run('docker','stop','--time','30',c['name']);m.run('docker','rm',c['name'])
c['image']=image;c.pop('previous_image',None);m.launch(c);m.ready(c);m.write_manifest(base,c)
mark('restoring_previous_profile')
previous=json.loads((STAGE/'base-template.json').read_text())['previous_model']
status,_=request('/v1/chat/completions',dict(model=previous,messages=[dict(role='user',content='Antworte nur mit OK.')],max_tokens=8,reasoning_effort='none'))
_,s=request('/api/v1/status')
result=dict(version='0.1.44.1',http_status=status,model=previous,loaded=s['endpoint']['counts']['llm']['loaded'],active_requests=s['endpoint']['active_requests'],backup_created=False)
(OUT/'restore-after-update.json').write_text(json.dumps(result));mark('complete',**result)
if __name__=='__main__':
try:main()
except BaseException as e:mark('failed',error_type=type(e).__name__);raise
@@ -0,0 +1,21 @@
{
"image": "athena-deck-standalone:strata-0.1.44.1-20261014",
"memory_gib": 44.0,
"memory_swap_gib": 44.0,
"recipe_version": "0.1.44.1",
"recipe_commit": "296b59d2f73c8f04a805df29c2fa97655adace78",
"runtime": {
"commit": "296b59d2f73c8f04a805df29c2fa97655adace78",
"cuda": "13.0",
"architectures": "86;120",
"origin": "native-build"
},
"source_commit": "296b59d2f73c8f04a805df29c2fa97655adace78",
"binary_version": "strata 0.1.44.1",
"vision_code": "296b59d2f73c8f04a805df29c2fa97655adace78",
"extra_mounts": [
"/opt/athena-deck-dev/runtime/state/strata-ssd"
],
"binary_sha256": "00edfdbd0a0dce84e0b722dbc7b7c83c7eb45731fdd5a592e88a6e8898ad12d7",
"kquant_library_present": false
}