@@ -124,6 +124,18 @@ def run_queue(args, requests, ready, plan_path):
124124 report .update (measurement_host = socket .gethostname (),parallel_with_gpu_shards = plan .get ('parallel_with_gpu_shards' ,False ))
125125 retained = {e ['output' ]: e ['sha256' ] for e in prior .get ('complete' , []) + prior .get ('serial_references' , [])}
126126 lock = threading .Lock (); failures = []
127+ last_checkpoint = time .monotonic ()
128+ def checkpoint ():
129+ # Samples are separately persisted and checked before a receipt is
130+ # added. Rewriting the complete growing receipt list on every retained
131+ # sample makes recovery quadratic in shared-filesystem traffic. Keep
132+ # progress at one-second intervals; failures and phase boundaries
133+ # always save immediately.
134+ nonlocal last_checkpoint
135+ now = time .monotonic ()
136+ if now - last_checkpoint >= 1. :
137+ write (controller , report )
138+ last_checkpoint = now
127139 def measure (index , request , cohort ):
128140 lane = report ['model_lanes' ][request ['model' ]]; cpus = plan ['lanes' ][lane ]['cpus' ]
129141 folder = args .output if cohort == 'parallel-shared-host' else args .output / 'serial-reference'
@@ -160,7 +172,7 @@ def lane_work(lane):
160172 try :
161173 result = measure (index , request , 'parallel-shared-host' )
162174 with lock :
163- report ['complete' ].append (result ); write ( controller , report )
175+ report ['complete' ].append (result ); checkpoint ( )
164176 if len (report ['complete' ]) % 20 == 0 :
165177 print ({'phase' : args .phase , 'complete' : len (report ['complete' ]), 'expected' : len (requests )}, flush = True )
166178 except Exception as error :
@@ -187,7 +199,7 @@ def lane_work(lane):
187199 original = originals [json .dumps (request , sort_keys = True )]
188200 result ['parallel_output_sha256' ] = original ['sha256' ]
189201 result ['parallel_to_serial_p50_ratios' ] = compare_outputs (load (original ['output' ]), load (result ['output' ]))
190- report ['serial_references' ].append (result ); write ( controller , report )
202+ report ['serial_references' ].append (result ); checkpoint ( )
191203 if index % 20 == 0 :
192204 print ({'phase' : args .phase , 'serial_references' : index + 1 , 'expected' : len (refs )}, flush = True )
193205 if digest (selection ) != selection_hash or digest (plan_path ) != plan_hash :
0 commit comments