Document Strata 0.1.45 dual-slot option comparison and restoration
This commit is contained in:
1 parent
7d5096c121
commit
c499c37567
6 files changed
+1408
No files matched your search
@@ -0,0 +1,133 @@
|
||||
# Dual-slot recheck on Strata 0.1.45 — 17 October 2026
|
||||
|
||||
User requested repeating the previous serial-MTP versus pipeline comparison.
|
||||
This is an isolated synthetic experiment, not a production profile change.
|
||||
|
||||
- Official pinned engine 0.1.45, commit 477ac13cbe8e582c20484871ce459d20d82df09d.
|
||||
- Existing IQ3_XXS weights, RTX 3060 / RTX 5080, layer split 16.
|
||||
- Two slots, each 262144 context; int8 KV, 32768 resident KV window.
|
||||
- Same saved synthetic fixtures and generation parameters as 14 October.
|
||||
- Reference: two short solo/parallel repetitions, fresh and cached ~64K pair.
|
||||
User then narrowed the test to new options; the started ~128K reference pair
|
||||
was deliberately stopped and is not a result.
|
||||
- Fixed 16-GiB resident expert allocation must be confirmed within 0.02 GiB;
|
||||
each arm gets its own fresh 44-GiB/no-extra-swap, six-CPU test container.
|
||||
- Scheduling arm A: `--batch-mtp --batch-groups 1`; arm B: `--batch-groups auto`
|
||||
(explicit pipeline disables batch-MTP in the official engine).
|
||||
- Reference has new opt-ins unset. Focused follow-ups enable these six official
|
||||
flags together, each set to 1: `STRATA_SLOT_COPY_DIRECT`,
|
||||
`STRATA_SLOT_COPY_BATCHSYNC`, `STRATA_CKPT_POOL`, `STRATA_CKPT_THREADS`,
|
||||
`STRATA_BATCH_SELF_COMMIT`, `STRATA_QSA_SLOTS`. The experimental
|
||||
`STRATA_SLOT_CKPT_MOVE` stays off. One short solo/parallel repetition and one
|
||||
fresh/cached ~64K pair per follow-up; no ~128K repeat. Native loop guard is `stop`.
|
||||
- Production mounts are read-only; only own experiment data writable.
|
||||
- Service credentials are passed internally on stdin, not saved in the template
|
||||
or documentation. No private chats or production log content is collected.
|
||||
- No host, Deck, Hermes or OpenCode restart. Idle check, regular authenticated
|
||||
GUI unload and GPU-free verification precede each arm. Regular API restoration
|
||||
reloads the previous IQ3 single profile unless newer activity intervenes.
|
||||
|
||||
The fixed-budget ~64K cases can be compared with the previous controlled
|
||||
16-GiB series. Previous ~128K measurements used automatic budgets and are
|
||||
historical context, not a controlled release-to-release comparison. Fresh
|
||||
cgroups avoid carried-over accounting; no global cache flush is performed,
|
||||
so physical disk-cache state and test order remain limitations.
|
||||
|
||||
Status: measurements complete; final restoration evidence is recorded below.
|
||||
|
||||
The initial reference completed six cases before the deliberate scope change.
|
||||
The launcher restored the previous profile normally after stopping only the own
|
||||
test container. No partial ~128K timing may be reported as a completed case.
|
||||
Fresh 0.1.45 serial reference: ~64K pair 212.0 s / 188.3 GiB disk reads;
|
||||
cached follow-up pair 19.6 s / 3.5 GiB. These are individual measurements.
|
||||
|
||||
## Memory-allocation gate and narrowed follow-up
|
||||
|
||||
The first six reference cases at 16.00 GiB are valid. After regular restoration,
|
||||
two fresh option-enabled starts were clamped to 7.97 GiB (serial) and 8.40 GiB
|
||||
(pipeline), respectively. Both failed the pre-measurement equality gate and
|
||||
provide **no speed result**. No claim that flags caused this allocation change
|
||||
is justified: startup/cgroup/file-cache state varies. Technical process-name/RSS
|
||||
checks found no surviving own benchmark engine; no process command lines or
|
||||
private logs were collected.
|
||||
|
||||
Do not disable the safety guard or claim a 16-vs-8 comparison. A narrowed
|
||||
short-request A/B uses separate fresh cgroups, the same serial-MTP scheduling
|
||||
and a confirmed 7.00-GiB expert budget in both arms. Only the six flags differ.
|
||||
The option-enabled arm also runs one 64K cold/cached pair to observe behaviour;
|
||||
there is no matched 7-GiB long baseline, so it cannot establish those flags'
|
||||
causal effect on long-context performance. The old 16-GiB and automatic-budget
|
||||
long measurements remain separately labeled historical context.
|
||||
|
||||
Both GPUs reserve 1024 MiB in the saved test recipe, unchanged from the old
|
||||
experiment. This affects expert-cache capacity and potentially disk traffic;
|
||||
GPU reserve tuning is not part of this flag comparison.
|
||||
|
||||
## Results and decision
|
||||
|
||||
Short controlled A/B, 0.1.45, serial-MTP scheduling, 7.00 GiB experts in
|
||||
both arms. Backend decode rates are distinct from end-to-end throughput.
|
||||
|
||||
| Case | Default flags | Six opt-in flags |
|
||||
| --- | ---: | ---: |
|
||||
| Solo backend output tok/s | 44.8 | 39.6 |
|
||||
| Two requests: backend output tok/s per request | 30.5 / 32.6 | 30.5 / 31.5 |
|
||||
| Solo wall time, 512 output tokens | 12.98 s | 14.68 s |
|
||||
| Pair wall time, 1024 output tokens total | 17.90 s | 18.08 s |
|
||||
|
||||
One ordered measurement per condition, no forced physical cache flush. The
|
||||
observed parallel wall-time difference is about 1%; this does not demonstrate
|
||||
a speedup or establish a statistically significant regression. Solo variability
|
||||
and startup/cache differences preclude a precise general percentage.
|
||||
|
||||
Option-enabled 7-GiB long observation: two fresh ~64K prompts took 273.2 s,
|
||||
223.6 GiB physical engine reads, 31.8% full memory PSI. Their following turns
|
||||
took 18.1 s, 4.9 GiB reads; both reused their prefix (65,771 / 65,773 tokens).
|
||||
There is no matched default-flags 7-GiB long observation. Do not attribute its
|
||||
slower cold read versus the 16-GiB reference to the new flags.
|
||||
|
||||
The 16-GiB serial reference on 0.1.45 was similar to the old controlled 0.1.43.1
|
||||
case: fresh ~64K pair 212.0 vs 201.1 s, 188.3 vs 182.1 GiB reads; next turns
|
||||
19.6 vs 21.7 s. These are individual runs at different dates/cache states, not
|
||||
a precise release regression claim. SSD pressure remains reproducible.
|
||||
|
||||
Do not enable these six flags in production on this evidence. Production
|
||||
profiles, memory limits and GPU reserve settings remain unchanged. Pipeline
|
||||
with the new flags has no valid measurement because its requested expert
|
||||
budget was clamped before the test; no performance claim is made for it.
|
||||
No own output-identity test was performed; this is a resource/speed comparison,
|
||||
not a quality or correctness benchmark.
|
||||
|
||||
The saved launcher requires an existing service token on stdin, for example
|
||||
`{"key":"<existing service token supplied internally>"}`; never save a real
|
||||
credential in this document or its test template. `TEST_RUN`, `TEST_ARMS`,
|
||||
`TEST_RESIDENT_GIB`, `TEST_REPETITIONS`, `TEST_TARGETS`, `TEST_LONG`, and
|
||||
`TEST_OPT` select the documented isolated cases. `TEST_OPT=1` enables exactly
|
||||
the six named flags. The unchanged synthetic fixture generation uses seed
|
||||
20261014; inputs can be regenerated by the benchmark's `fixture` function.
|
||||
|
||||
The launcher is for the current optional Docker deployment. The benchmark
|
||||
itself runs on the native runtime with equivalent configured paths/resources;
|
||||
a native full fresh-host restore has not been retested here.
|
||||
|
||||
## Verified restoration
|
||||
|
||||
`final-restore.json` records regular HTTP 200 restoration of the previous
|
||||
`flash-next-strata-iq3` single-slot profile, loop guard `stop`, none of the six
|
||||
test flags enabled in the production worker, and no remaining own test
|
||||
containers. The regular Deck status then reported `ready`, zero active requests.
|
||||
The earlier deliberately stopped reference is clearly labeled incomplete for
|
||||
its ~128K case. Failed pre-measurement budget checks are retained as failures,
|
||||
not discarded or represented as speed results.
|
||||
|
||||
[All numerical cases and technical budget evidence](results.json) ·
|
||||
[Final restoration proof](final-restore.json).
|
||||
|
||||
For reproduction, use a sanitized copy of the saved dual worker template:
|
||||
remove the real `api_key`, retain local model/pack/projector paths and the
|
||||
recorded args/environment, set `parallel=2`, and save `base-template.json`
|
||||
under the configured stage. Store only the previous model identifier in
|
||||
`previous-model.json`; the launcher reloads that identifier through the normal
|
||||
endpoint. The test replaces its own API key with a synthetic isolated value.
|
||||
Never commit an unfiltered live worker config. Update the allowlisted run
|
||||
names and stage paths for a new experiment instead of overwriting these runs.
|
||||
@@ -0,0 +1,188 @@
|
||||
"""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)
|
||||
if os.environ.get('TEST_OPT')=='1':
|
||||
baseline.setdefault('env',{}).update({k:'1' for k in ('STRATA_SLOT_COPY_DIRECT','STRATA_SLOT_COPY_BATCHSYNC','STRATA_CKPT_POOL','STRATA_CKPT_THREADS','STRATA_BATCH_SELF_COMMIT','STRATA_QSA_SLOTS')})
|
||||
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(',')) if os.environ.get('TEST_LONG','1')=='1' else []):
|
||||
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,19 @@
|
||||
{
|
||||
"launcher-status.json": {
|
||||
"phase": "finished",
|
||||
"updated": 1792261780.5427582,
|
||||
"restored": true,
|
||||
"model": "flash-next-strata-iq3"
|
||||
},
|
||||
"restore.json": {
|
||||
"http_status": 200,
|
||||
"model": "flash-next-strata-iq3"
|
||||
},
|
||||
"production_worker": {
|
||||
"model": "flash-next-strata-iq3",
|
||||
"parallel": 1,
|
||||
"loop_guard": "stop",
|
||||
"tested_flags_enabled": {}
|
||||
},
|
||||
"remaining_own_test_containers": []
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
"""Athena host launcher: regular GUI unload first, isolated test, regular API restore."""
|
||||
import json,os,pathlib,subprocess,time,urllib.request
|
||||
P=pathlib.Path
|
||||
STAGE=P('/opt/athena-deck-dev/batch-ab-20261017')
|
||||
RUN=os.environ['TEST_RUN']
|
||||
if RUN not in ('strata-dual-045-serial-20261017','strata-dual-045-pipeline-20261017','strata-dual-045-optserial-20261017','strata-dual-045-optpipe-20261017','strata-dual-045-base7-20261017','strata-dual-045-opt7-20261017'):
|
||||
raise ValueError('Unknown isolated test directory')
|
||||
OUT=P('/data/experiments')/RUN
|
||||
import sys
|
||||
TOKEN=json.load(sys.stdin)['key']
|
||||
def credentials():return TOKEN
|
||||
def request(path,data=None):
|
||||
req=urllib.request.Request('http://127.0.0.1:'+('8120' if path.startswith('/v1/') else '8108')+path,
|
||||
data=json.dumps(data).encode() if data is not None else None,
|
||||
headers={'Authorization':'Bearer '+credentials(),'Content-Type':'application/json'})
|
||||
with urllib.request.urlopen(req,timeout=600) as r:return r.status,json.load(r)
|
||||
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')
|
||||
if s['endpoint']['active_requests'] or s['endpoint']['counts']['llm']['loaded']:
|
||||
raise RuntimeError('Regularly unload idle Deck LLM first')
|
||||
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('GPU processes still present; no test started')
|
||||
d=json.loads(subprocess.check_output(['docker','inspect','athena-deck-dev']))[0]
|
||||
args=['docker','run','--rm','--name','athena-'+RUN,'--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','--entrypoint','python3']
|
||||
for name in ('TEST_LONG','TEST_OPT','TEST_RESIDENT_GIB','TEST_REPETITIONS','TEST_TARGETS','TEST_ARMS'):
|
||||
if name in os.environ:args+=['-e',name+'='+os.environ[name]]
|
||||
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={OUT},dst=/experiment',d['Config']['Image'],'/test/benchmark.py']
|
||||
try:
|
||||
mark('running')
|
||||
with (OUT/'container-test.log').open('w') as f:r=subprocess.run(args,stdout=f,stderr=subprocess.STDOUT)
|
||||
mark('test_complete' if r.returncode==0 else 'test_failed',exit_code=r.returncode)
|
||||
finally:
|
||||
_,s=request('/api/v1/status');e=s['endpoint']
|
||||
if e['active_requests'] or e['counts']['llm']['loaded']:
|
||||
mark('restore_skipped_new_activity')
|
||||
else:
|
||||
previous=json.loads((STAGE/'previous-model.json').read_text())['model']
|
||||
status,_=request('/v1/chat/completions',dict(model=previous,messages=[dict(role='user',content='OK')],max_tokens=1,reasoning_effort='none'))
|
||||
(OUT/'restore.json').write_text(json.dumps(dict(http_status=status,model=previous)))
|
||||
mark('finished',restored=status==200,model=previous)
|
||||
if __name__=='__main__':
|
||||
try:main()
|
||||
except BaseException as e:mark('launcher_failed',error_type=type(e).__name__);raise
|
||||
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user