예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
 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;
     }
 }
예제 #5
0
 protected abstract float[,] KernelMul(BaseConfig cfg, float[,] a, float[,] b);