Commit 44656931 authored by Brewer, Wes's avatar Brewer, Wes
Browse files

Merge branch 'analyze-telemetry' into 'main'

Analyze telemetry

See merge request !60
parents 848f0635 4916083c
Loading
Loading
Loading
Loading
+51 −2
Original line number Diff line number Diff line
@@ -15,8 +15,7 @@ if __name__ == "__main__":
    parser.add_argument('-f', '--replay', nargs='+', type=str, 
                        help='Either: path/to/joblive path/to/jobprofile' + \
                             ' -or- filename.npz (overrides --workload option)')
    parser.add_argument('-p', '--plot', nargs='+', choices=['power', 'loss', 'pue', 'temp'],
                        help='Specify one or more types of plots to generate: power, loss, pue, temp')
    parser.add_argument('-p', '--plot', action='store_true', help='Output plots') 
    parser.add_argument('--system', type=str, default='frontier', help='System config to use')
    parser.add_argument('-v', '--verbose', action='store_true', help='Enable verbose output')
    args = parser.parse_args()
@@ -73,6 +72,7 @@ if __name__ == "__main__":
    dt_list = []
    wt_list = []
    nr_list = []
    submit_times = []
    last = 0
    for job_vector in jobs:
        job = Job(job_vector, 0)
@@ -82,6 +82,7 @@ if __name__ == "__main__":
            dt = job.submit_time - last
            dt_list.append(dt)
            last = job.submit_time
            submit_times.append(job.submit_time)
        if args.verbose: print(job)

    print(f'Simulation will run for {timesteps} seconds')
@@ -90,3 +91,51 @@ if __name__ == "__main__":
    print(f'Nodes required (avg): {np.mean(nr_list):.2f}')
    print(f'Nodes required (max): {np.max(nr_list)}')
    print(f'Nodes required (std): {np.std(nr_list):.2f}')


    if args.plot:

        import matplotlib.pyplot as plt

        print("plotting nodes required histogram...")
        # Define the number of bins you want
        num_bins = 25
        data = nr_list
        # Create logarithmically spaced bins
        bins = np.logspace(np.log2(min(data)), np.log2(max(data)), num=num_bins, base=2)
        # Set up the figure 
        plt.figure(figsize=(10, 3))
        # Create the histogram
        plt.hist(nr_list, bins=bins, edgecolor='black')
        # Add a title and labels
        plt.xlabel('Number of Nodes')
        plt.ylabel('Frequency')
        # Set the axes to logarithmic scale
        plt.xscale('log', base=2)
        plt.yscale('log')
        # Customize the x-ticks: Choose the positions (1, 8, 64, etc.)
        ticks = [2**i for i in range(0, 14)]
        plt.xticks(ticks, labels=[str(tick) for tick in ticks])
        # Set min-max axis bounds
        plt.xlim(1, max(data))
        # Save the histogram to a file
        plt.savefig('histogram.png', dpi=300, bbox_inches='tight')

        print("plotting submit times...")
        # Plot number of nodes over time
        plt.clf()
        plt.figure(figsize=(10, 2))
        # Create a bar chart
        plt.bar(submit_times, nr_list, width=10.0, color='blue', edgecolor='black', alpha=0.7)
        # Add labels and title
        plt.xlabel('Submit Time (s)')
        plt.ylabel('Number of Nodes')
        # Set min-max axix bounds
        plt.xlim(1, max(submit_times))
        # Set the y-axis to logarithmic scale with base 2
        plt.yscale('log', base=2)
        y_ticks = [2**i for i in range(0, 14)]
        plt.yticks(y_ticks, labels=[str(tick) for tick in y_ticks])
        # Save the plot to a file
        plt.savefig('nodes_time.png', dpi=300, bbox_inches='tight')