static NDarray <float> GemmABfloat(NDarray <float> a, NDarray <float> b, NDarray <float> c = null) { if (Utils.Backend == Backend.Default) { return(NDsharp.GemmAB(a, b, c)); } return(NDmkl.GemmAB(a, b, c)); }
static NDarray <double> GemmABdouble(NDarray <double> a, NDarray <double> b, NDarray <double> c = null) { if (Utils.Backend == Backend.Default) { return(NDsharp.GemmAB(a, b, c)); } return(NDmkl.GemmAB(a, b, c)); }
static void BenchGemmMKL(int R, int L, int M, int K, int N) { Utils.Random = new Random(123); for (int r = 0; r < R; ++r) { var x = ND.Uniform(1, 10, M, K).Cast <float>(); var y = ND.Uniform(1, 10, K, N).Cast <float>(); var sw = Stopwatch.StartNew(); float sum = 0; for (int l = 0; l < L; ++l) { var z = NDmkl.GemmAB(x, y); //sum += z.Data.Sum(); } Console.WriteLine($"BenchGemmMKL Time:{sw.ElapsedMilliseconds,5} ms sum:{sum}"); } Console.WriteLine(); }