def plot_timing(charges, tolerance): ixcha = all_charges.index(charges) ixtol = all_tolerances.index(tolerance) # look for the minimal timing minimal_time = None for method in all_methods: methodtimes = timing[method][ixcha,ixtol,:] if all(isnan(methodtimes)): continue i = 0 while (isnan(methodtimes[i])): i += 1 serial_time = all_cores[i] * methodtimes[i] if minimal_time is None or serial_time < minimal_time: minimal_time = serial_time loglog(all_cores, minimal_time/array(all_cores), 'k:') loglog(all_cores, 10.*minimal_time/array(all_cores), 'k:') loglog(all_cores, 100.*minimal_time/array(all_cores), 'k:') for method in all_methods: data = timing[method] if not all(isnan(data[ixcha,ixtol,:])): loglog(all_cores, data[ixcha,ixtol,:], label=method, **benchmarks.fmt(method)) xlim((1, charges/200.)) xscale('log', basex=2) xlabel('\#Cores $P$') ylabel('Time $t$ [s]')
def plot_timing(charges, tolerance): ixcha = all_charges.index(charges) ixtol = all_tolerances.index(tolerance) # look for the minimal timing minimal_time = None for method in all_methods: methodtimes = timing[method][ixcha, ixtol, :] if all(isnan(methodtimes)): continue i = 0 while (isnan(methodtimes[i])): i += 1 serial_time = all_cores[i] * methodtimes[i] if minimal_time is None or serial_time < minimal_time: minimal_time = serial_time loglog(all_cores, minimal_time / array(all_cores), 'k:') loglog(all_cores, 10. * minimal_time / array(all_cores), 'k:') loglog(all_cores, 100. * minimal_time / array(all_cores), 'k:') for method in all_methods: data = timing[method] if not all(isnan(data[ixcha, ixtol, :])): loglog(all_cores, data[ixcha, ixtol, :], label=method, **benchmarks.fmt(method)) xlim((1, charges / 200.)) xscale('log', basex=2) xlabel('\#Cores $P$') ylabel('Time $t$ [s]')
def plot_efficiency(charges, tolerance): ixcha = all_charges.index(charges) ixtol = all_tolerances.index(tolerance) # look for the minimal timing minimal_time = None for method in all_methods: methodtimes = timing[method][ixcha,ixtol,:] if all(isnan(methodtimes)): continue i = 0 while (isnan(methodtimes[i])): i += 1 serial_time = all_cores[i] * methodtimes[i] if minimal_time is None or serial_time < minimal_time: minimal_time = serial_time if minimal_time is None: print "No data for charges={} tolerance={}"\ .format(charges, tolerance) return for method in all_methods: data = timing[method] if not all(isnan(data[ixcha,ixtol,:])): semilogx(all_cores, minimal_time/(data[ixcha,ixtol,:]*all_cores), label=method, **benchmarks.fmt(method)) # legend() xlim((1, charges/200.)) xscale('log', basex=2) xlabel(r'\#Cores $P$') ylabel(r'Relative Parallel Efficiency $e(P)$')
def plot_efficiency(charges, tolerance): ixcha = all_charges.index(charges) ixtol = all_tolerances.index(tolerance) # look for the minimal timing minimal_time = None for method in all_methods: methodtimes = timing[method][ixcha, ixtol, :] if all(isnan(methodtimes)): continue i = 0 while (isnan(methodtimes[i])): i += 1 serial_time = all_cores[i] * methodtimes[i] if minimal_time is None or serial_time < minimal_time: minimal_time = serial_time if minimal_time is None: print "No data for charges={} tolerance={}"\ .format(charges, tolerance) return for method in all_methods: data = timing[method] if not all(isnan(data[ixcha, ixtol, :])): semilogx(all_cores, minimal_time / (data[ixcha, ixtol, :] * all_cores), label=method, **benchmarks.fmt(method)) # legend() xlim((1, charges / 200.)) xscale('log', basex=2) xlabel(r'\#Cores $P$') ylabel(r'Relative Parallel Efficiency $e(P)$')
def plot_efficiency(testcase, charges, tolerance): ixcha = all_charges.index(charges) ixtol = all_tolerances.index(tolerance) methods = timing.keys() methods.sort() minimal_time = None # look for the minimal timing for method in methods: methodtimes = timing[method][ixcha, ixtol, :] if all(isnan(methodtimes)): continue i = 0 while (isnan(methodtimes[i])): i += 1 serial_time = all_cores[i] * methodtimes[i] if minimal_time is None or serial_time < minimal_time: minimal_time = serial_time if minimal_time is None: print "No data for charges={} tolerance={}".format(charges, tolerance) return for method in methods: data = timing[method] if not all(isnan(data[ixcha, ixtol, :])): semilogx(all_cores, minimal_time / (data[ixcha, ixtol, :] * all_cores), label=method, **benchmarks.fmt(method)) xlim((1, charges / 200.)) xlabel('#cores') ylabel('Efficiency')
def plot_efficiency(charges, tolerance): ixcha = all_charges.index(charges) ixtol = all_tolerances.index(tolerance) methods = timing.keys() methods.sort() minimal_time = None # look for the minimal timing for method in methods: methodtimes = timing[method][ixcha,ixtol,:] if all(isnan(methodtimes)): continue i = 0 while (isnan(methodtimes[i])): i += 1 serial_time = all_cores[i] * methodtimes[i] if minimal_time is None or serial_time < minimal_time: minimal_time = serial_time if minimal_time is None: print "No data for charges={} tolerance={}".format(charges, tolerance) return for method in methods: data = timing[method] if not all(isnan(data[ixcha,ixtol,:])): semilogx(all_cores, minimal_time/(data[ixcha,ixtol,:]*all_cores), label=method, **benchmarks.fmt(method)) # legend() xlim((1, charges/200.)) xlabel('#cores') ylabel('Efficiency')
def plot_timing(charges, tolerance): ixcha = all_charges.index(charges) ixtol = all_tolerances.index(tolerance) methods = timing.keys() methods.sort() for method in methods: data = timing[method] if not all(isnan(data[ixcha,ixtol,:])): loglog(all_cores, data[ixcha,ixtol,:], label=method, **benchmarks.fmt(method)) xlim((1, charges/200.)) xlabel('#cores') ylabel('Time [s]')
def plot_timing(charges, tolerance): ixcha = all_charges.index(charges) ixtol = all_tolerances.index(tolerance) methods = timing.keys() methods.sort() for method in methods: data = timing[method] if not all(isnan(data[ixcha,ixtol,:])): plt.loglog(all_cores, data[ixcha,ixtol,:], label=method, **benchmarks.fmt(method)) plt.legend() plt.xlim((1, charges/200.)) plt.xlabel('#cores') plt.ylabel('Time [s]')
all_cores = data['cores'] all_tolerances = data['tolerances'] all_charges = data['charges'] timing = data['timing'] cores = 1 ixcor = all_cores.index(cores) tolerance = 1e-3 ixtol = all_tolerances.index(tolerance) figure('Complexity') for method in data['methods']: time_per_particle = \ timing[method][:, ixtol, ixcor] / all_charges loglog(all_charges, time_per_particle, label=method, **benchmarks.fmt(method)) xlabel(r'\#Charges') ylabel(r'Time $t$/\#Charges [s]') create_legend() savefig('complexity.pdf') #################### # ACCURACY #################### data = benchmarks.read('accuracy.xml') all_methods = data['methods'] all_cores = data['cores'] all_tolerances = data['tolerances'] all_charges = data['charges'] timing = data['timing']
all_charges = data['charges'] timing = data['timing'] cores = 1 ixcor = all_cores.index(cores) tolerance = 1e-3 ixtol = all_tolerances.index(tolerance) figure('Complexity') for method in data['methods']: time_per_particle = \ timing[method][:, ixtol, ixcor] / all_charges loglog(all_charges, time_per_particle, label=method, **benchmarks.fmt(method)) xlabel(r'\#Charges') ylabel(r'Time $t$/\#Charges [s]') create_legend() savefig('complexity.pdf') #################### # ACCURACY #################### data = benchmarks.read('accuracy.xml') all_methods = data['methods'] all_cores = data['cores'] all_tolerances = data['tolerances'] all_charges = data['charges'] timing = data['timing']