@@ -180,7 +180,11 @@ def measure_performance(model_call, args, synchronizer_func, profile=False):
180180 duration_box = test_compiler_util .DurationBox (- 1 )
181181 with test_compiler_util .naive_timer (duration_box , synchronizer_func ):
182182 model_call ()
183- print (f"Trial { i + 1 } : e2e={ duration_box .value :.4f} ms" )
183+ print (
184+ f"Trial { i + 1 } : e2e={ duration_box .value :.4f} ms" ,
185+ file = sys .stderr ,
186+ flush = True ,
187+ )
184188 e2e_times .append (duration_box .value )
185189 stats ["e2e" ] = test_compiler_util .get_timing_stats (e2e_times )
186190
@@ -256,26 +260,34 @@ def test_single_model(args):
256260 # Run on eager mode
257261 eager_success = False
258262 try :
259- print ("Run model in eager mode." )
263+ print ("Run model in eager mode." , file = sys . stderr , flush = True )
260264 static_model = get_static_model (args , model )
261265 expected_out , eager_time_stats = measure_performance (
262266 lambda : static_model (** input_dict ), args , synchronizer_func , profile = False
263267 )
264268 eager_success = True
265269 except Exception as e :
266- print (f"Run model in eager mode failed: { str (e )} \n { traceback .format_exc ()} " )
270+ print (
271+ f"Run model in eager mode failed: { str (e )} \n { traceback .format_exc ()} " ,
272+ file = sys .stderr ,
273+ flush = True ,
274+ )
267275
268276 # Run on compiling mode
269277 compiled_success = False
270278 try :
271- print ("Run model in compiled mode." )
279+ print ("Run model in compiled mode." , file = sys . stderr , flush = True )
272280 compiled_model = get_compiled_model (args , model )
273281 compiled_out , compiled_time_stats = measure_performance (
274282 lambda : compiled_model (** input_dict ), args , synchronizer_func , profile = False
275283 )
276284 compiled_success = True
277285 except Exception as e :
278- print (f"Run model in compiled mode failed: { str (e )} \n { traceback .format_exc ()} " )
286+ print (
287+ f"Run model in compiled mode failed: { str (e )} \n { traceback .format_exc ()} " ,
288+ file = sys .stderr ,
289+ flush = True ,
290+ )
279291
280292 test_compiler_util .print_running_status (args , eager_success , compiled_success )
281293 if eager_success and compiled_success :
@@ -358,7 +370,7 @@ def test_multi_models(args):
358370 if args .verified_samples_list_path is not None :
359371 assert os .path .isfile (args .verified_samples_list_path )
360372 graphnet_root = path_utils .get_graphnet_root ()
361- print (f"graphnet_root: { graphnet_root } " )
373+ print (f"graphnet_root: { graphnet_root } " , file = sys . stderr , flush = True )
362374 verified_samples = []
363375 with open (args .verified_samples_list_path , "r" ) as f :
364376 for line in f .readlines ():
@@ -368,7 +380,11 @@ def test_multi_models(args):
368380 failed_samples = []
369381 for model_path in path_utils .get_recursively_model_path (args .model_path ):
370382 if verified_samples is None or os .path .abspath (model_path ) in verified_samples :
371- print (f"[{ sample_idx } ] test_compiler, model_path: { model_path } " )
383+ print (
384+ f"[{ sample_idx } ] test_compiler, model_path: { model_path } " ,
385+ file = sys .stderr ,
386+ flush = True ,
387+ )
372388 cmd = " " .join (
373389 [
374390 sys .executable ,
@@ -388,10 +404,12 @@ def test_multi_models(args):
388404 sample_idx += 1
389405
390406 print (
391- f"Totally { sample_idx } verified samples, failed { len (failed_samples )} samples."
407+ f"Totally { sample_idx } verified samples, failed { len (failed_samples )} samples." ,
408+ file = sys .stderr ,
409+ flush = True ,
392410 )
393411 for model_path in failed_samples :
394- print (f"- { model_path } " )
412+ print (f"- { model_path } " , file = sys . stderr , flush = True )
395413
396414
397415def main (args ):
0 commit comments