@@ -212,16 +212,26 @@ def __init__(self) -> None:
212
212
self .old_os_path = os .environ ["PATH" ]
213
213
self .prev_sys_path = list (sys .path )
214
214
self .real_prefix = sys .prefix
215
+ self .version = self .get_version ()
216
+
217
+ def get_version (self ):
218
+ version = ""
219
+ try :
220
+ version_file = os .path .join (str (BYTE_MLPERF_ROOT ), "../VERSION" )
221
+ with open (version_file ) as f :
222
+ _version = f .read ().splitlines ()
223
+ version = '.' .join (v .split ('=' )[1 ] for v in _version )
224
+ except Exception as e :
225
+ traceback .print_exc ()
226
+ log .warning (f"get bytemlperf version failed, error msg: { e } " )
227
+ return version
215
228
216
229
def get_cpu_name (self ):
217
230
command = "lscpu | grep 'Model name' | awk -F: '{print $2}'"
218
231
cpu_name = subprocess .check_output (command , shell = True )
219
232
return cpu_name .decode ().strip ()
220
233
221
-
222
-
223
234
def start_engine (self ) -> None :
224
-
225
235
if self .args .activate_venv :
226
236
self .activate_venv (self .backend_type )
227
237
@@ -270,7 +280,6 @@ def start_engine(self) -> None:
270
280
for shape in shape_list :
271
281
test_list .append (ConfigInstance (dtype , shape , case_index ))
272
282
case_index = case_index + 1
273
-
274
283
275
284
try :
276
285
mp .set_start_method ("spawn" , force = True )
@@ -287,10 +296,6 @@ def start_engine(self) -> None:
287
296
if self .workload ["operator" ] in ["device2host" , "host2device" ]:
288
297
instance_num = 1
289
298
290
-
291
-
292
-
293
-
294
299
input_queues = mp .Queue ()
295
300
output_queues = mp .Queue (maxsize = 1 )
296
301
@@ -308,16 +313,13 @@ def start_engine(self) -> None:
308
313
assert "ready" == output_queues .get ()
309
314
log .info ("all ranks are ready and listening, init done" )
310
315
311
-
312
-
313
316
if group == 1 :
314
317
for test_instance in test_list :
315
318
input_queues .put (test_instance , True )
316
319
317
320
for _ in range (instance_num ):
318
321
input_queues .put ("end" , True )
319
322
320
-
321
323
for process in _subprocesses .processes :
322
324
process .join ()
323
325
@@ -330,9 +332,6 @@ def start_engine(self) -> None:
330
332
if self .args .activate_venv :
331
333
self .deactivate_venv ()
332
334
333
-
334
-
335
-
336
335
def perf_func (self , rank : int , * args ):
337
336
backend_instance = self .backend_class (self .workload , self .args .vendor_path )
338
337
op_name = self .workload ["operator" ]
@@ -342,7 +341,6 @@ def perf_func(self, rank: int, *args):
342
341
# set device accroding to local_rank
343
342
set_device_func = getattr (backend_instance , "set_device" )
344
343
set_device_func (rank )
345
-
346
344
347
345
if world_size > 1 :
348
346
init_ccl_func = getattr (backend_instance , "initialize_ccl" )
@@ -354,7 +352,6 @@ def perf_func(self, rank: int, *args):
354
352
else :
355
353
raise ValueError (f"Unknown operation: { op_name .lower ()} " )
356
354
357
-
358
355
output_queues .put ("ready" )
359
356
360
357
result_list = []
@@ -396,7 +393,6 @@ def perf_func(self, rank: int, *args):
396
393
397
394
result_list = sorted (output_result_list , key = lambda x : x .config .index )
398
395
399
-
400
396
elif group_size > 1 :
401
397
for i , test_instance in enumerate (test_list ):
402
398
if rank == 0 :
@@ -421,7 +417,6 @@ def perf_func(self, rank: int, *args):
421
417
422
418
result_list .append (ResultItem (test_instance , reports ))
423
419
424
-
425
420
if rank == 0 :
426
421
print (f"{ len (result_list )} tasks finished." )
427
422
@@ -439,9 +434,11 @@ def perf_func(self, rank: int, *args):
439
434
"Backend" : self .backend_type ,
440
435
"Host Info" : self .get_cpu_name (),
441
436
"Device Info" : getattr (self .backend , "get_device_name" )(),
437
+ "Version" : self .version ,
438
+ "Execution Date" : time .strftime ("%Y-%m-%d %H:%M:%S" ),
442
439
"Performance" : [result .report for result in dtype_results_mapping [dtype ]]
443
440
}
444
-
441
+
445
442
filename = (
446
443
f"result-{ str (dtype )} "
447
444
+ (
@@ -460,8 +457,6 @@ def perf_func(self, rank: int, *args):
460
457
destroy_group_func ()
461
458
462
459
return True
463
-
464
-
465
460
466
461
def activate_venv (self , hardware_type : str ) -> bool :
467
462
if os .path .exists ("backends/" + hardware_type + "/requirements.txt" ):
0 commit comments