Add crash-resumable search with transactional checkpoints
This commit is contained in:
parent
f71985c0c3
commit
482989c4d2
8 changed files with 388 additions and 9 deletions
|
|
@ -26,6 +26,16 @@ def main():
|
|||
assert r['anchors']==1+2*radius*(radius+1)
|
||||
assert r['first_anchor']==[-123,456-radius] and r['last_anchor']==[-123,456+radius]
|
||||
for bad in [[],['--radius','-1'],['--radius','1','--size','0'],['--radius','1','--size','7'],['--radius','abc'],['--radius','0','--x','2147483647'],['--radius','1','--repeat','0'],['--radius','1','--position-batch','0']]:run(*bad,'--dry-run',ok=False)
|
||||
points=[(dx,dz) for dz in range(-3,4) for dx in range(-3,4) if abs(dx)+abs(dz)<=3]
|
||||
for start in range(len(points)):
|
||||
count=min(4,len(points)-start)
|
||||
r=run('--radius',3,'--start-anchor',start,'--anchor-count',count,'--dry-run')
|
||||
assert r['start_anchor']==start and r['anchor_count']==count and r['anchors']==25
|
||||
assert r['first_anchor']==list(points[start]) and r['last_anchor']==list(points[start+count-1])
|
||||
assert run('--radius',3,'--start-anchor',24,'--dry-run')['anchor_count']==1
|
||||
for opts in [('--start-anchor',25),('--anchor-count',0),('--anchor-count',26),
|
||||
('--start-anchor',24,'--anchor-count',2),('--start-anchor',18446744073709551615)]:
|
||||
run('--radius',3,*opts,'--dry-run',ok=False)
|
||||
pattern='?##./#..?/..#?'
|
||||
r=run('--radius',0,'--pattern',pattern,'--dry-run')
|
||||
assert r['pattern']==pattern.split('/') and r['square_size'] is None
|
||||
|
|
@ -122,6 +132,14 @@ def main():
|
|||
split.extend(map(tuple,r['rounds'][0]['sample']))
|
||||
assert sorted(split)==sorted(map(tuple,diamond['rounds'][0]['sample']))
|
||||
assert diamond['anchors']==13
|
||||
partition=[]
|
||||
for start,count in [(0,4),(4,5),(9,4)]:
|
||||
r=run(*common,'--radius',2,'--start-anchor',start,'--anchor-count',count,
|
||||
'--max-results',1000,'--position-batch',3)
|
||||
assert sum(g['anchors'] for g in r['rounds'][0]['gpus'])==count
|
||||
partition.extend(map(tuple,r['rounds'][0]['sample']))
|
||||
assert sorted(partition)==sorted(split)
|
||||
|
||||
run('--radius',0,'--devices','0,0',ok=False)
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
out=Path(tmp)/'report.json'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue