Fixed benchmark checking

このコミットが含まれているのは:
Sergio Pedri committed 2019-08-18 23:00:06 +02:00
1 親 009e6d618e
コミット be9de0bf8b
2ファイル変更
+14 -3

検索条件に一致するファイルはありません

+13 -2
ファイルの表示
@@ -149,9 +149,20 @@ namespace ComputeSharp.Benchmark
// Compare the two results
ref float r_cpu = ref y_cpu[0];
ref float r_gpu = ref Y[0];
for (int i = 0; i < Y.Length; i++)
if (MathF.Abs(Unsafe.Add(ref r_cpu, i) - Unsafe.Add(ref r_gpu, i)) > 0.0001f)
for (int i = 0; i < y_cpu.Length; i++)
{
float x_cpu = Unsafe.Add(ref r_cpu, i);
float x_gpu = Unsafe.Add(ref r_gpu, i);
float absolute = MathF.Abs(x_cpu - x_gpu);
float relative = 1e-1f * MathF.Max(MathF.Abs(x_cpu), MathF.Abs(x_gpu));
if (absolute >= 1e-2f &&
absolute > MathF.Max(1e-2f, relative))
{
return false;
}
}
return true;
}
+1 -1
ファイルの表示
@@ -10,7 +10,7 @@ namespace ComputeSharp.Benchmark
using var benchmark = new FullyConnectedLayerBenchmark();
Console.WriteLine("======== WARMUP ========");
if (benchmark.EnsureImplementationsMatch()) throw new InvalidOperationException("CPU and GPU code don't match");
if (!benchmark.EnsureImplementationsMatch()) throw new InvalidOperationException("CPU and GPU code don't match");
Console.WriteLine();
Console.WriteLine("======== GPU with temporary buffer ========");