コード例 #1
0
        private static void RunSquaredDistance(Gpu aleaGpu, CudaAccelerator ilGpu)
        {
            const int c = 20;
            const int x = 2 * 10000;

            var matrixM     = new Real[x * x];
            var matrixC     = new Real[x * x];
            var coordinates = new Real[c * x];

            Benchmark.Run(Loops,
                          () => SquaredDistance.Initialise(matrixM, coordinates, c, x),
                          () => SquaredDistance.Initialise(matrixC, coordinates, c, x),
                          () => AssertAreEqual(matrixM, matrixC, x, x),
                          () => SquaredDistance.Managed(matrixM, coordinates, c, x),
#if USE_ALEA
                          () => SquaredDistance.Alea(aleaGpu, matrixC, coordinates, c, x),
#endif
                          () => SquaredDistance.IlGpu(ilGpu, matrixC, coordinates, c, x),
#if USE_ALEA
                          () => SquaredDistance.AleaSharedMemory(aleaGpu, matrixC, coordinates, c, x),
#endif
                          () => SquaredDistance.IlGpuSharedMemory(ilGpu, matrixC, coordinates, c, x),
#if USE_ALEA
                          () => SquaredDistance.AleaFloat2(aleaGpu, matrixC, coordinates, c, x),
#endif
                          () => SquaredDistance.IlGpuFloat2(ilGpu, matrixC, coordinates, c, x),
#if USE_ALEA
                          () => SquaredDistance.AleaConstants(aleaGpu, matrixC, coordinates, c, x),
#endif
                          () => SquaredDistance.IlGpuConstants(ilGpu, matrixC, coordinates, c, x),
#if USE_ALEA
                          () => SquaredDistance.AleaLocalMemory(aleaGpu, matrixC, coordinates, c, x),
#endif
                          () => SquaredDistance.IlGpuLocalMemory(ilGpu, matrixC, coordinates, c, x));
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: uzbekdev1/GpuSandbox
        private static void RunSquaredDistance()
        {
            const int c = 20;
            const int x = 10000;

            var matrixM     = new Real[x * x];
            var matrixC     = new Real[x * x];
            var coordinates = new Real[c * x];

            Benchmark.Run(Loops,
                          () => SquaredDistance.Initialise(coordinates, c, x),
                          () => SquaredDistance.Initialise(coordinates, c, x),
                          () => AssertAreEqual(matrixM, matrixC, x, x),
                          () => SquaredDistance.Managed(matrixM, coordinates, c, x),
                          () => SquaredDistance.Cuda(matrixC, coordinates, c, x),
                          () => SquaredDistance.CudaSharedMemory(matrixC, coordinates, c, x),
                          () => SquaredDistance.CudaFloat2(matrixC, coordinates, c, x),
                          () => SquaredDistance.CudaConstants(matrixC, coordinates, c, x),
                          () => SquaredDistance.CudaLocalMemory(matrixC, coordinates, c, x));
        }