public void BigTest(BaseConfig cfg) { var a = RandMatrix(302, 434); var b = RandMatrix(434, 408); var rc = ReferenceMul(a, b); var kc = KernelMul(cfg, a, b); AssertAreTheSame(rc, kc); }
public void MediumTest(BaseConfig cfg) { var a = RandMatrix(17, 19); var b = RandMatrix(19, 18); var rc = ReferenceMul(a, b); var kc = KernelMul(cfg, a, b); AssertAreTheSame(rc, kc); }
public void SmallTest(BaseConfig cfg) { var a = RandMatrix(6, 15); var b = RandMatrix(15, 9); var rc = ReferenceMul(a, b); var kc = KernelMul(cfg, a, b); AssertAreTheSame(rc, kc); }
protected override float[,] KernelMul(BaseConfig cfg, float[,] a, float[,] b) { var sw = new Stopwatch(); try { sw.Start(); var result = cfg.Configure<MatMulKernel>().Execute(a, b); Log.WriteLine("Kernel has completed in " + sw.Elapsed); return result; } catch (Exception) { Log.WriteLine("Kernel has crashed in " + sw.Elapsed); throw; } }
protected abstract float[,] KernelMul(BaseConfig cfg, float[,] a, float[,] b);