Commit 0102951b authored by Brewer, Wes's avatar Brewer, Wes
Browse files

Add plotting of telemetry

parent 0c3bea0c
Loading
Loading
Loading
Loading
+45 −1
Original line number Diff line number Diff line
@@ -15,7 +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'],
    parser.add_argument('-p', '--plot', action='store_true', help='Output plots')
                        help='Specify one or more types of plots to generate: power, loss, pue, temp')
    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')
@@ -90,3 +90,47 @@ 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:

        # Define the number of bins you want
        num_bins = 25
        data = nr_list
        # Create logarithmically spaced bins
        #bins = np.logspace(np.log10(min(data)), np.log10(max(data)), num_bins)
        bins = np.logspace(np.log2(min(data)), np.log2(max(data)), num=num_bins, base=2)
        # Set up the figure with the desired dimensions
        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=10)
        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')
        # 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('Allocation 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')