Exemple #1
0
        private static void RunMatrixMultiplication()
        {
            const int n = 1500 - 1;

            var resultM = new Real[n * n];
            var resultC = new Real[n * n];
            var left    = new Real[n * n];
            var right   = new Real[n * n];

            Benchmark.Run(Loops,
                          () => MatrixMultiplication.Initialise(left, right, n),
                          () => MatrixMultiplication.Initialise(left, right, n),
                          () => AssertAreEqual(resultM, resultC, n, n),
                          () => MatrixMultiplication.Managed(resultM, left, right, n),
                          () => MatrixMultiplication.Cuda(resultC, left, right, n));
        }
Exemple #2
0
        private static void RunMatrixMultiplication(Gpu aleaGpu, CudaAccelerator ilGpu)
        {
            const int n = 1500 - 1;

            var resultM = new Real[n * n];
            var resultC = new Real[n * n];
            var left    = new Real[n * n];
            var right   = new Real[n * n];

            Benchmark.Run(Loops,
                          () => MatrixMultiplication.Initialise(left, right, n),
                          () => MatrixMultiplication.Initialise(left, right, n),
                          () => AssertAreEqual(resultM, resultC, n, n),
                          () => MatrixMultiplication.Managed(resultM, left, right, n),
                          () => MatrixMultiplication.Alea(aleaGpu, resultC, left, right, n),
                          () => MatrixMultiplication.IlGpu(ilGpu, resultC, left, right, n));
        }