Capture prepared events through a test-only producer consumer and measure serial and indexed parallel generation independently. Compare the production atomic kernel with bounded pixel-owned tile reductions while preserving double HDR, cache support, and direct fallback ordering. Validate captured inputs, edge and multichunk fixtures, CPU/HIP renderer regressions, and 45 isolated final replays. Keep the production HIP algorithm unchanged because gains depend on event distribution.
46 lines
2.3 KiB
Python
46 lines
2.3 KiB
Python
#!/usr/bin/env python3
|
|
"""Bounded diagnostic accounting, output refusal, and parallel checksum checks."""
|
|
from pathlib import Path
|
|
import os
|
|
import re
|
|
import subprocess
|
|
import sys
|
|
import tempfile
|
|
|
|
renderer=Path(sys.argv[1]).resolve()
|
|
capture=Path(sys.argv[2]).resolve()
|
|
repo=Path(__file__).resolve().parents[1]
|
|
env=dict(os.environ,OMP_NUM_THREADS='4')
|
|
def call(command, success=True):
|
|
print('RUN',command,flush=True)
|
|
p=subprocess.run(list(map(str,command)),env=env,text=True,stdout=subprocess.PIPE,stderr=subprocess.STDOUT,timeout=30)
|
|
print(p.stdout,flush=True)
|
|
assert (p.returncode==0)==success,(p.returncode,p.stdout)
|
|
return p.stdout
|
|
with tempfile.TemporaryDirectory(prefix='gr-capture-test-') as temp:
|
|
temp=Path(temp);lens=temp/'mixed.grlens';events=temp/'mixed.events'
|
|
catalog=repo/'tests/data/hip_psf_mixed_catalog.csv'
|
|
call([renderer,'--catalog',catalog,'--width','96','--height','64','--fov-deg','30',
|
|
'--look-ra-deg','2','--look-dec-deg','1','--coarse-cell-pixels','16','--refine-max-level','0',
|
|
'--exposure','1000','--lens-map-output',lens,'--output',temp/'reference.png'])
|
|
base=[capture,lens,catalog,'0','48','65536']
|
|
for min_y,expected in [('0',(2,1,0)),('1e30',(0,0,3))]:
|
|
summaries=[]
|
|
for mode in ['--diagnose','--diagnose-parallel','--diagnose-indexed-serial','--diagnose-indexed']:
|
|
text=call(base+[mode,'1000','1',min_y])
|
|
counts=tuple(int(re.search(key+r'=(\d+)',text)[1]) for key in ['cached','direct','discarded'])
|
|
assert counts==expected,(counts,expected)
|
|
assert 'no HDR' in text
|
|
summaries.append(re.search(r'checksum=([0-9a-f]+)',text)[1])
|
|
assert len(set(summaries))==1,summaries
|
|
call(base+[events,'1000','1','0'])
|
|
lines=events.read_text().splitlines()
|
|
assert lines[0].split()[3]=='2' and len(lines)==3
|
|
call(base+[events,'1000','1','0'],False) # exclusive creation
|
|
call([capture,lens,catalog,'0','49','1','--diagnose','1000'],False)
|
|
call([capture,lens,catalog,'0','48','65537','--diagnose','1000'],False)
|
|
capped=temp/'capped.events'
|
|
call([capture,lens,catalog,'0','48','1',capped,'1000'])
|
|
assert len(capped.read_text().splitlines())==2
|
|
print('PASS: capture bounds, classifications, exclusive output, serial/parallel checksum')
|