plot_overhead.py (1572B)
1 #!/usr/bin/env python 2 # File : plot_overhead.py 3 # Description: Plot OpenMP micro bench results 4 # Copyright 2022 Harvard University. All Rights Reserved. 5 import matplotlib as mpl 6 mpl.use('Agg') 7 import matplotlib.pyplot as plt 8 import numpy as np 9 10 def plot(): 11 fig, ax = plt.subplots() 12 13 d = np.loadtxt('proc_bind_false.dat') 14 # ax.grid(which='both') 15 ax.set_xlabel(r'Number of threads') 16 ax.set_ylabel(r'Overhead [$\mu s$]') 17 # yapf: disable 18 ax.errorbar(d[:, 0], d[:, 19], yerr=d[:, 20], marker='P', lw=1.4, ms=5, label=r'\texttt{reduction}') 19 ax.errorbar(d[:, 0], d[:, 1], yerr=d[:, 2], marker='o', lw=1.4, ms=5, label=r'\texttt{parallel}') 20 ax.errorbar(d[:, 0], d[:, 3], yerr=d[:, 4], marker='s', lw=1.4, ms=5, label=r'\texttt{for}') 21 ax.errorbar(d[:, 0], d[:, 5], yerr=d[:, 6], marker='^', lw=1.4, ms=5, label=r'\texttt{parallel for}') 22 ax.errorbar(d[:, 0], d[:, 7], yerr=d[:, 8], marker='*', lw=1.4, ms=5, label=r'\texttt{barrier}') 23 ax.errorbar(d[:, 0], d[:, 9], yerr=d[:, 10], marker='>', lw=1.4, ms=5, label=r'\texttt{single}') 24 ax.errorbar(d[:, 0], d[:, 11], yerr=d[:, 12], marker='x', lw=1.4, ms=5, label=r'\texttt{critical}') 25 ax.errorbar(d[:, 0], d[:, 13], yerr=d[:, 14], marker='<', lw=1.4, ms=5, label=r'\texttt{lock/unlock}') 26 ax.errorbar(d[:, 0], d[:, 17], yerr=d[:, 18], marker='d', lw=1.4, ms=5, label=r'\texttt{atomic}') 27 # yapf: enable 28 ax.legend(loc='upper left') 29 fig.savefig('openmp_overhead.svg', bbox_inches='tight') 30 31 def main(): 32 plot() 33 34 if __name__ == "__main__": 35 main()