Plotting and Interpreting Results

From HPC Wiki
Benchmarking & Scaling Tutorial/Results /
Revision as of 10:02, 11 March 2022 by Sebastian-potthoff-3c73@uni-muenster.de (talk | contribs) (Created page with "{{DISPLAYTITLE:Plotting and Interpreting Results}}<nowiki /> {{Syllabus Benchmarking & Scaling}}<nowiki /> __TOC__ == Plotting results == We can write a simple Python script...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Tutorial
Title: Benchmarking & Scaling
Provider: HPC.NRW

Contact: tutorials@hpc.nrw
Type: Online
Topic Area: Performance Analysis
License: CC-BY-SA
Syllabus

1. Introduction & Theory
2. Interactive Manual Benchmarking
3. Automated Benchmarking using a Job Script
4. Automated Benchmarking using JUBE
5. Plotting & Interpreting Results

Plotting results

We can write a simple Python script to process and plot the resulting data. For this purpose we are making use of the numpy and matplotlib Python libraries.

#!/usr/bin/env python3

import numpy as np
import matplotlib.pyplot as plt

data = np.loadtxt("results_weak_scaling.dat")

# Different set every 10 data points (5 serial + 5 parallel)
wat05 = data[0:10]
wat10 = data[10:20]
wat15 = data[20:30]

wat = [wat05, wat10, wat15]

# Calculate the mean times for every set
stimes = []
ptimes = []
for d in wat:
    stimes.append(np.mean(d[0:5], axis=0))
    ptimes.append(np.mean(d[5:10], axis=0))

# Re-transform to numpy array
stimes = np.asarray(stimes)
ptimes = np.asarray(ptimes)

# Calculate speedup
speedup = stimes[:,1]/ptimes[:,1]

# Get the No of processors
nprocs = ptimes[:,0]

# Plot
fig = plt.figure()
ax  = fig.add_subplot(111)
ax.plot(nprocs, speedup, '--o', label="speedup")
ax.plot(nprocs, nprocs, '--', color='gray', label="ideal")
ax.legend()
ax.set_xlabel("processors")
ax.set_ylabel("speedup")
ax.set_title("weak scaling")
for x,y,label in zip(nprocs, speedup,["5NM","10NM","15NM"]):
    ax.annotate(label, xy=(x,y), textcoords="offset points", xytext=(-12,10))



Previous: Automated Benchmarking using a Job Script