コード例 #1
0
ファイル: Program.cs プロジェクト: uzbekdev1/GpuSandbox
        private static void RunAddVector()
        {
            const int m = 24 * 12;
            const int n = 25600 - 1;

            var matrixM = new Real[m * n];
            var matrixC = new Real[m * n];
            var vector  = new Real[n];

            Benchmark.Run(Loops,
                          () => AddVector.Initialise(matrixM, vector, m, n),
                          () => AddVector.Initialise(matrixC, vector, m, n),
                          () => AssertAreEqual(matrixM, matrixC, m, n),
                          () => AddVector.Managed(matrixM, vector, m, n),
                          () => AddVector.Cuda(matrixC, vector, m, n));
        }
コード例 #2
0
        private static void RunAddVector(Gpu aleaGpu, CudaAccelerator ilGpu)
        {
            const int m = 2 * 24 * 12;
            const int n = 2 * 25600 - 1;

            var matrixM = new Real[m * n];
            var matrixC = new Real[m * n];
            var vector  = new Real[n];

            Benchmark.Run(Loops,
                          () => AddVector.Initialise(matrixM, vector, m, n),
                          () => AddVector.Initialise(matrixC, vector, m, n),
                          () => AssertAreEqual(matrixM, matrixC, m, n),
                          () => AddVector.Managed(matrixM, vector, m, n),
#if USE_ALEA
                          () => AddVector.Alea(aleaGpu, matrixC, vector, m, n),
#endif
                          () => AddVector.IlGpu(ilGpu, matrixC, vector, m, n));
        }