388def Parse_Benchmark(Input_Filename, PROC_BENCHMARK, Num_Core_Per_Socket, Num_Sock_Per_Node):
389
390
391 Num_Core_Per_Node = Num_Core_Per_Socket * Num_Sock_Per_Node
392
393
394 Check = [4, 8, 16, 32]
395
396
397 Check_Node = False
398 Check_Socket = False
399
400
401 for i in range(0, len(Check)):
402 if (Num_Core_Per_Socket % Check[i] != 0):
403 Check_Socket = True
404
405 if (Num_Core_Per_Node % Check[i] != 0):
406 Check_Node = True
407
408
409 if (Check_Node is True and Check_Socket is True):
410 PROC_PER_GROUP = Check[i]
411 break
412
413
414 Check_Node = False
415 Check_Socket = False
416
417
418 Num_Groups = PROC_BENCHMARK/PROC_PER_GROUP
419
420
421 concerned_node_groups = []
422 concerned_socket_groups = []
423 concerned_core_groups = []
424
425
426 Groups = []
427
428
429 count = 0
430
431
432 Check_Node = False
433 Check_Socket = False
434
435
436 for i in range(0, Num_Groups):
437 Groups.append([])
438
439 for j in range(0, PROC_PER_GROUP):
440 Groups[i].append(count)
441 count += 1
442
443 for j in range(1, PROC_PER_GROUP - 1):
444 if (Groups[i][j] % Num_Core_Per_Node == 0):
445 concerned_node_groups.append(i)
446 Check_Node = True
447 continue
448
449 if (Groups[i][j] % Num_Core_Per_Socket == 0 and Check_Node is False):
450 concerned_socket_groups.append(i)
451 Check_Socket = True
452 continue
453
454 if (Check_Node is False and Check_Socket is False):
455 concerned_core_groups.append(i)
456
457 Check_Node = False
458 Check_Socket = False
459
460
461 f = open(Input_Filename, "r")
462
463
464 data = []
465
466
467 count = -1
468 Finder_0 = False
469 Finder_1 = False
470 Finder_2 = False
471 Finder_3 = False
472
473
474
475 for line in f:
476 pharsed = line.split()
477 if (pharsed == ['#', 'Benchmarking', 'Multi-Exchange']):
478 Finder_0 = True
479 continue
480
481 if (pharsed == ['#', '(', str(Num_Groups), 'groups', 'of', str(PROC_PER_GROUP), 'processes', 'each', 'running', 'simultaneous', ')'] and Finder_0 is True):
482 Finder_1 = True
483 continue
484
485 if (pharsed == ['Group', '#bytes', '#repetitions', 't_min[usec]', 't_max[usec]', 't_avg[usec]', 'Mbytes/sec'] and Finder_1 is True):
486 Finder_2 = True
487 continue
488
489 if (Finder_1 is True and Finder_2 is True):
490 if (pharsed == []):
491 count += 1
492 data.append([[],[],[],[],[],[],[]])
493 continue
494 if (pharsed == ['#------------------------------------------------------------------------------------------']):
495 break
496
497 data[count][5].append(float(pharsed[5]))
498 data[count][6].append(float(pharsed[6]))
499
500
501 count_lat_node = 0.0
502 count_lat_socket = 0.0
503 count_lat_core = 0.0
504
505 for i in range(0, len(concerned_node_groups)):
506 index = concerned_node_groups[i]
507 count_lat_node += data[0][5][index]
508
509 LAT_Node_To_Node = (count_lat_node/len(concerned_node_groups)) * 1e-06
510
511 for i in range(0, len(concerned_socket_groups)):
512 index = concerned_socket_groups[i]
513 count_lat_socket += data[0][5][index]
514 LAT_Socket_To_Socket = (count_lat_socket/len(concerned_socket_groups)) * 1e-06
515
516
517 for i in range(0, len(concerned_core_groups)):
518 index = concerned_core_groups[i]
519 count_lat_core += data[0][5][index]
520
521 LAT_Core_To_Core = (count_lat_core/len(concerned_core_groups)) * 1e-06
522
523
524
525 count_band_node = 0.0
526 count_band_socket = 0.0
527 count_band_core = 0.0
528
529 for i in range(0, len(concerned_node_groups)):
530 index = concerned_node_groups[i]
531 count_band_node += data[count - 3][6][index]
532
533 BW_Node_To_Node = (count_band_node/len(concerned_node_groups)) * 1e06
534
535 for i in range(0, len(concerned_socket_groups)):
536 index = concerned_socket_groups[i]
537 count_band_socket += data[count - 3][6][index]
538
539 BW_Socket_To_Socket = (count_band_socket/len(concerned_socket_groups)) * 1e06
540
541
542 for i in range(0, len(concerned_core_groups)):
543 index = concerned_core_groups[i]
544 count_band_core += data[count - 3][6][index]
545
546 BW_Core_To_Core = (count_band_core/len(concerned_core_groups)) * 1e06
547
548
549 return(BW_Node_To_Node, LAT_Node_To_Node, BW_Socket_To_Socket, LAT_Socket_To_Socket, BW_Core_To_Core, LAT_Core_To_Core)
550
551
552
553
554
555
def Parse_Benchmark(Input_Filename, PROC_BENCHMARK, Num_Core_Per_Socket, Num_Sock_Per_Node)