loopTimeDict[128] = [k / 2. for k in loopTimeDict[64]] loopTimeDict[256] = [k / 4. for k in loopTimeDict[64]] loopTimeDict[512] = [k / 8. for k in loopTimeDict[64]] ''' for r in sorted(loopTimeDict): nodeNeeded = r // 64 minT = np.min(loopTimeDict[r]) print("Min Time %s node(s) = %s" % (nodeNeeded, minT)) totalTimeArray = np.zeros(maxSimulationNumber) for i in xArray: totalTimeArray[i - 1] = minT * (1 + (i * nodeNeeded - 1) // maxAvailableNode) ax.plot(xArray, totalTimeArray, '-', label="Batch Size %s" % (r // 64)) parser.outputCurve("ergodicity_scaling-%s.dat" % (r // 64), xArray, totalTimeArray) ''' minSize = int(np.sqrt(np.min(syncTimeDict.keys()))) maxSize = int(np.sqrt(np.max(syncTimeDict.keys()))) nodeNumber = (caseSize[0] * caseSize[1] / (maxSize * maxSize)) ''' plt.title('%sx%s batch time with %s node(s) available at the same time.' % (caseSize[0], caseSize[1], maxAvailableNode)) plt.xlabel('Total number of simulation to run') plt.ylabel('Loop Time') plt.legend() ''' bx = fig.add_subplot(212) bx.set_xscale('log', basex=2)
if not parser.args.nolog: ax.set_xscale('log', basex=2) ax.set_yscale('log') if len(sddWithoutHTStrongDict) > 0: firstValueSDD = [np.min(v) for k, v in sorted(sddWithoutHTStrongDict.items())][0] else: firstValueSDD = 0. #ax.plot(sorted(sddStrongDict), [firstValueSDD / k for k in sorted(sddStrongDict.keys())], 'b--', label="SDD ideal") #ax.plot(sorted(sddStrongDict), [np.min(v) / k for k, v in sorted(sddStrongDict.items())], 'bo-', label="SDD scaling") ax.plot(sorted(sddWithoutHTStrongDict), [np.min(v) / k for k, v in sorted(sddWithoutHTStrongDict.items())], 'b-', label="best SDD scaling w/o HT") ax.plot(sorted(sddWithoutHTStrongDict), [np.max(v) / k for k, v in sorted(sddWithoutHTStrongDict.items())], 'r-', label="worst SDD scaling w/o HT") parser.outputCurve("plot/shape_scaling_looptime_min-%sx%s.dat" % (caseSize[0], caseSize[1]), sorted(sddWithoutHTStrongDict), [np.min(v) / k for k, v in sorted(sddWithoutHTStrongDict.items())]) parser.outputCurve("plot/shape_scaling_looptime_max-%sx%s.dat" % (caseSize[0], caseSize[1]), sorted(sddWithoutHTStrongDict), [np.max(v) / k for k, v in sorted(sddWithoutHTStrongDict.items())]) # Transform into np array. data = np.array(scatterWithoutHT) labels = ['(%s x %s)' % (int(p[0]), int(p[1])) for p in data] ax.scatter(data[:, 0] * data[:, 1], data[:, 2] / (data[:, 0] * data[:, 1]), marker='D', c='b', cmap=plt.get_cmap('Spectral')) output_min = [] output_max = [] for label, x, y, in zip(labels, data[:, 0] * data[:, 1], data[:, 2] / (data[:, 0] * data[:, 1])): if y <= np.min(sddWithoutHTStrongDict[x]) / x: output_min.append((x, y, label)) plt.annotate(label, xy=(x,y) ,xytext=(-20, -20) ,textcoords='offset pixels'
for k in runWithoutHTDict: ax.plot(np.ones(len(runWithoutHTDict[k])) * k, runWithoutHTDict[k], 'gx') for k in runWithHTDict: ax.plot(np.ones(len(runWithHTDict[k])) * k, runWithHTDict[k], 'go') plt.title('Run Scaling of %s x %s on %s cores' % (caseSize[0], caseSize[1], res)) plt.xlabel('Run number') plt.ylabel('std-deviation(%) / (Cell x Iteration)') plt.legend() parser.outputCurve( "plot/run_scaling_wo_HT-%sx%s.dat" % (caseSize[0], caseSize[1]), sorted(runWithoutHTDict), [ np.max(v) for k, v in sorted(runWithoutHTDict.items(), key=operator.itemgetter(0)) ]) parser.outputCurve( "plot/run_scaling_HT-%sx%s.dat" % (caseSize[0], caseSize[1]), sorted(runWithHTDict), [ np.max(v) for k, v in sorted(runWithHTDict.items(), key=operator.itemgetter(0)) ]) parser.outputPoint( "plot/run_scaling_wo_HT_dot-%sx%s.dat" % (caseSize[0], caseSize[1]), runWithoutHTDict) parser.outputPoint( "plot/run_scaling_HT_dot-%sx%s.dat" % (caseSize[0], caseSize[1]), runWithHTDict)
# ax.plot(np.ones(len(loopTimeWoHTDict[k])) * k, loopTimeWoHTDict[k], 'b*') for k in loopTimeDict: ax.plot(np.ones(len(loopTimeDict[k])) * k, loopTimeDict[k], 'b+') nodeNumber = (caseSize[0] * caseSize[1] / (maxSubdomain[0] * maxSubdomain[1])) plt.title('Times from %sx%s to %sx%s subdomain sizes on %sx%s on %s node(s)' % (minSubdomain[0], minSubdomain[1], maxSubdomain[0], maxSubdomain[1], caseSize[0], caseSize[1], nodeNumber)) plt.xlabel('Number of cells in subdomain') plt.ylabel('Time / iteration') plt.legend() # Output parser.outputCurve( "plot/split_scaling_looptime-%sx%s.dat" % (caseSize[0], caseSize[1]), sorted(loopTimeDict), [np.min(v) for k, v in sorted(loopTimeDict.items())]) parser.outputCurve( "plot/split_scaling_synctime-%sx%s.dat" % (caseSize[0], caseSize[1]), sorted(syncTimeDict), [v for k, v in sorted(syncTimeDict.items())]) parser.outputCurve( "plot/split_scaling_comptime-%sx%s.dat" % (caseSize[0], caseSize[1]), sorted(maxComputeSumTimeDict), [v for k, v in sorted(maxComputeSumTimeDict.items())]) parser.outputCurve( "plot/split_scaling_ideal_comptime-%sx%s.dat" % (caseSize[0], caseSize[1]), sorted(maxComputeSumTimeDict), [firstValueMaxComputeTime for k in sorted(maxComputeSumTimeDict.keys())]) parser.outputPoint( "plot/split_scaling_dot-%sx%s.dat" % (caseSize[0], caseSize[1]), loopTimeDict)
label="Min. time per ratio") for k in sdsRatioDict: ax.plot(np.ones(len(sdsRatioDict[k])) * k, sdsRatioDict[k], 'g+') for k in sdsRatioWithoutHTDict: ax.plot( np.ones(len(sdsRatioWithoutHTDict[k])) * k, sdsRatioWithoutHTDict[k], 'gx') plt.title('SDS Ratio Scaling of %s x %s' % (caseSize[0], caseSize[1])) plt.xlabel('SDS ratio(s)') plt.ylabel('Loop Time / (cell x Iteration)') plt.legend() parser.outputCurve( "plot/sds_scaling_wo_HT-%sx%s.dat" % (caseSize[0], caseSize[1]), sorted(sdsRatioWithoutHTDict), [ np.min(v) for k, v in sorted(sdsRatioWithoutHTDict.items(), key=operator.itemgetter(0)) ]) parser.outputCurve( "plot/sds_scaling_HT-%sx%s.dat" % (caseSize[0], caseSize[1]), sorted(sdsRatioDict), [ np.min(v) for k, v in sorted(sdsRatioDict.items(), key=operator.itemgetter(0)) ]) parser.outputPoint( "plot/sds_scaling_wo_HT_dot-%sx%s.dat" % (caseSize[0], caseSize[1]), sdsRatioWithoutHTDict) parser.outputPoint( "plot/sds_scaling_HT_dot-%sx%s.dat" % (caseSize[0], caseSize[1]), sdsRatioDict)
label="SDD ideal") ax.plot(sorted(sdsWeakDict), [firstValueSDS / normalizeDict[k] for k in sorted(sdsWeakDict.keys())], 'g--', label="SDS ideal") for k in sdsWeakDict: ax.plot( np.ones(len(sdsWeakDict[k])) * k, [i for i in sdsWeakDict[k]], 'g+') for k in sddWeakDict: ax.plot( np.ones(len(sddWeakDict[k])) * k, [i for i in sddWeakDict[k]], 'b+') parser.outputCurve( "plot/weak_scaling_sds_HT-%s.dat" % initSize, sorted(sdsWeakDict), [ np.min(v) for k, v in sorted(sdsWeakDict.items(), key=operator.itemgetter(0)) ]) parser.outputCurve("plot/weak_scaling_sds_wo_HT-%s.dat" % initSize, sorted(sdsWithoutHTWeakDict), [ np.min(v) for k, v in sorted(sdsWithoutHTWeakDict.items(), key=operator.itemgetter(0)) ]) parser.outputCurve( "plot/weak_scaling_sdd_HT-%s.dat" % initSize, sorted(sddWeakDict), [ np.min(v) for k, v in sorted(sddWeakDict.items(), key=operator.itemgetter(0)) ]) parser.outputCurve("plot/weak_scaling_sdd_wo_HT-%s.dat" % initSize, sorted(sddWithoutHTWeakDict), [
[firstValueSDD / k for k in sorted(sddStrongDict.keys())], 'b--', label="SDD ideal") for k in sdsStrongDict: ax.plot( np.ones(len(sdsStrongDict[k])) * k, [i / k for i in sdsStrongDict[k]], 'g+') for k in sddStrongDict: ax.plot( np.ones(len(sddStrongDict[k])) * k, [i / k for i in sddStrongDict[k]], 'b+') parser.outputCurve( "plot/strong_scaling_sds_HT-%sx%s.dat" % (caseSize[0], caseSize[1]), sorted(sdsStrongDict), [ np.min(v) / k for k, v in sorted(sdsStrongDict.items(), key=operator.itemgetter(0)) ]) parser.outputCurve( "plot/strong_scaling_sds_wo_HT-%sx%s.dat" % (caseSize[0], caseSize[1]), sorted(sdsWithoutHTStrongDict), [ np.min(v) / k for k, v in sorted(sdsWithoutHTStrongDict.items(), key=operator.itemgetter(0)) ]) parser.outputCurve( "plot/strong_scaling_sdd_HT-%sx%s.dat" % (caseSize[0], caseSize[1]), sorted(sddStrongDict), [ np.min(v) / k for k, v in sorted(sddStrongDict.items(), key=operator.itemgetter(0)) ]) parser.outputCurve(
key=operator.itemgetter(0)) ], 'y+-', label="Random geom. scaling w/o HT") ax.plot(sorted(sdsRandomDict), [firstValueRandom / k for k in sorted(sdsRandomDict.keys())], 'y--', label="Random geom. ideal") for k in sdsRandomDict: ax.plot( np.ones(len(sdsRandomDict[k])) * k, [i for i in sdsRandomDict[k]], 'y+') parser.outputCurve( "plot/geom_scaling_line-%sx%s.dat" % (caseSize[0], caseSize[1]), sorted(sdsWithoutHTLineDict), [ np.min(v) for k, v in sorted(sdsWithoutHTLineDict.items(), key=operator.itemgetter(0)) ]) parser.outputCurve( "plot/geom_scaling_line_ideal-%sx%s.dat" % (caseSize[0], caseSize[1]), sorted(sdsWithoutHTLineDict), [firstValueLine / k for k in sorted(sdsLineDict.keys())]) parser.outputCurve( "plot/geom_scaling_random-%sx%s.dat" % (caseSize[0], caseSize[1]), sorted(sdsWithoutHTRandomDict), [ np.min(v) for k, v in sorted(sdsWithoutHTRandomDict.items(), key=operator.itemgetter(0)) ]) parser.outputCurve( "plot/geom_scaling_random_ideal-%sx%s.dat" % (caseSize[0], caseSize[1]),
for k in sddCaseDict: bx.plot( np.ones(len(sddCaseDict[k])) * k, [i for i in sddCaseDict[k]], 'b+') #for k in sddHTCaseDict: # bx.plot(np.ones(len(sddHTCaseDict[k])) * k, [i for i in sddHTCaseDict[k]], 'r+') plt.title('Case Scaling from %sx%s to %sx%s with %s core(s)' % (minCase[0], minCase[1], maxCase[0], maxCase[1], resource)) plt.xlabel('Cell Number') plt.ylabel('Loop Time / (cell x iteration)') plt.legend() parser.outputCurve( "plot/case_scaling_sds_HT-%s.dat" % initSize, sorted(sdsCaseDict), [ np.min(v) for k, v in sorted(sdsCaseDict.items(), key=operator.itemgetter(0)) ]) parser.outputCurve("plot/case_scaling_sds_wo_HT-%s.dat" % initSize, sorted(sdsCaseWithoutHTDict), [ np.min(v) for k, v in sorted(sdsCaseWithoutHTDict.items(), key=operator.itemgetter(0)) ]) parser.outputCurve( "plot/case_scaling_sdd_wo_HT-%s.dat" % initSize, sorted(sddCaseDict), [ np.min(v) for k, v in sorted(sddCaseDict.items(), key=operator.itemgetter(0)) ]) parser.outputCurve( "plot/case_scaling_hybrid-%s.dat" % initSize, sorted(hybridCaseDict), [
# And now, we must plot that fig = plt.figure(0, figsize=(9, 6)) ax = fig.add_subplot(111) ax.plot(sorted(threadRatioDict), [ np.min(v) for k, v in sorted(threadRatioDict.items(), key=operator.itemgetter(0)) ], 'go-', label="HT Scaling") for k in threadRatioDict: ax.plot(np.ones(len(threadRatioDict[k])) * k, threadRatioDict[k], 'g+') plt.title('Hyperthread Scaling of %s x %s on %s core(s)' % (caseSize[0], caseSize[1], res)) plt.xlabel('Thread ratio') plt.ylabel('Loop Time / (cell x Iteration)') plt.legend() parser.outputCurve( "plot/thread_scaling-%sx%s.dat" % (caseSize[0], caseSize[1]), sorted(threadRatioDict), [np.min(v) for k, v in sorted(threadRatioDict.items())]) parser.outputPoint( "plot/thread_scaling_dot-%sx%s.dat" % (caseSize[0], caseSize[1]), threadRatioDict) plt.show()