Exemple #1
0
func main() {

	nsol := 500
	tf := 1000
	time := []float64{
		223.42398255, // 1
		82.864179318, // 2
		50.945049948, // 3
		29.547849719, // 4
		20.741909766, // 5
		17.188611472, // 6
		15.937424833, // 7
		13.919150335, // 8
		12.589523593, // 9
		12.078978314, // 10
		11.034417259, // 11
		9.542071936,  // 12
		9.298965819,  // 13
		9.182769212,  // 14
		8.610938487,  // 15
		8.482685187,  // 16
	}

	ncpu := utl.LinSpace(1, 16, 16)

	speedup := make([]float64, 16)
	speedup[0] = 1
	for i := 1; i < 16; i++ {
		speedup[i] = time[0] / time[i] // Told / Tnew
	}

	io.Pforan("ncpu = %v\n", ncpu)

	plt.SetForEps(0.75, 250)
	plt.Plot(ncpu, speedup, io.Sf("'b-',marker='.', label='speedup: $N_{sol}=%d,\\,t_f=%d$', clip_on=0, zorder=100", nsol, tf))
	plt.Plot([]float64{1, 16}, []float64{1, 16}, "'k--',zorder=50")
	plt.Gll("$N_{cpu}:\\;$ number of groups", "speedup", "")
	plt.DoubleYscale("$T_{sys}:\\;$ system time [s]")
	plt.Plot(ncpu, time, "'k-',color='gray', clip_on=0")
	plt.SaveD("/tmp/goga", "topology-speedup.eps")
}
Exemple #2
0
// main function
func main() {

	// flags
	benchmark := false
	ncpuMax := 16

	// benchmarking
	if benchmark {
		var nsol, tf int
		var et time.Duration
		X := make([]float64, ncpuMax)
		T := make([]float64, ncpuMax)
		S := make([]float64, ncpuMax) // speedup
		S[0] = 1
		for i := 0; i < ncpuMax; i++ {
			io.Pf("\n\n")
			nsol, tf, et = runone(i + 1)
			io.PfYel("elaspsedTime = %v\n", et)
			X[i] = float64(i + 1)
			T[i] = et.Seconds()
			if i > 0 {
				S[i] = T[0] / T[i] // Told / Tnew
			}
		}

		plt.SetForEps(0.75, 250)
		plt.Plot(X, S, io.Sf("'b-',marker='.', label='speedup: $N_{sol}=%d,\\,t_f=%d$', clip_on=0, zorder=100", nsol, tf))
		plt.Plot([]float64{1, 16}, []float64{1, 16}, "'k--',zorder=50")
		plt.Gll("$N_{cpu}:\\;$ number of groups", "speedup", "leg_out=1")
		plt.DoubleYscale("$T_{sys}:\\;$ system time [s]")
		plt.Plot(X, T, "'k-',color='gray', clip_on=0")
		plt.SaveD("/tmp/goga", "topology-speedup.eps")
		return
	}

	// normal run
	runone(-1)
}