public static double measureSOR(int N, double min_time, Random R) { double[][] G = kernel.RandomMatrix(N, N, R); Stopwatch stopwatch = new Stopwatch(); int num_iterations = 40000; stopwatch.start(); SOR.execute(1.25, G, num_iterations); stopwatch.stop(); return(SOR.num_flops(N, N, num_iterations) / stopwatch.read() * 1E-06); }
public static double measureSOR(int N, double min_time, Random R) { double[][] G = RandomMatrix(N, N, R); Stopwatch Q = new Stopwatch(); int cycles = 1; while (true) { Q.start(); SOR.execute(1.25, G, cycles); Q.stop(); if (Q.read() >= min_time) { break; } cycles *= 2; } // approx Mflops return(SOR.num_flops(N, N, cycles) / Q.read() * 1.0e-6); }
public static double measureSOR(int N, double min_time, Random R) { double[][] G = RandomMatrix(N, N, R); Stopwatch clock = new Stopwatch(); int cycles = 1; while (true) { clock.Start(); SOR.execute(1.25, G, cycles); clock.Stop(); if (clock.Elapsed.TotalSeconds >= min_time) { break; } cycles *= 2; } // approx Mflops return(SOR.num_flops(N, N, cycles) / clock.Elapsed.TotalMilliseconds * 1.0e-3); }