Beispiel #1
0
        public static void TransMatrix(int sizeN, int sizeM)
        {
            AMP.set_device();
            Console.WriteLine("TransMatrix");
            Console.WriteLine("=========================");
            Console.WriteLine("Preparing data...");
            var matrix = Tools.RandomMatrix(sizeN, sizeM);

            Tools.ShowTime("GPU", () => GPU.TransMatrix(matrix, sizeN, sizeM));
            Tools.ShowTime("CPU(seq)", () => CPU.TransMatrix_Seq(matrix, sizeN, sizeM));
            Tools.ShowTime("CPU(par)", () => CPU.TransMatrix_Par(matrix, sizeN, sizeM));
            Console.WriteLine();
        }
Beispiel #2
0
        public static void ProductMatrix(int oneSizeN, int oneSizeM, int twoSizeN, int twoSizeM)
        {
            AMP.set_device();
            Console.WriteLine("ProductMatrix");
            Console.WriteLine("=========================");
            Console.WriteLine("Preparing data...");
            var one = Tools.RandomMatrix(oneSizeN, oneSizeM);
            var two = Tools.RandomMatrix(twoSizeN, twoSizeM);

            Console.WriteLine("=========================");
            Tools.ShowTime("GPU", () => GPU.MatrixesMultipy(one, two));
            Tools.ShowTime("CPU(seq)", () => CPU.MatrixesMultipy_Seq(one, two));
            Tools.ShowTime("CPU(par)", () => CPU.MatrixesMultipy_Par(one, two));
            Console.WriteLine();
        }
Beispiel #3
0
        public static void SumVectors(int size)
        {
            AMP.set_device();
            Console.WriteLine("Sum Vectors");
            Console.WriteLine("=========================");
            Console.WriteLine("Preparing data...");
            var one = Tools.RandomVector(size);
            var two = Tools.RandomVector(size);

            Console.WriteLine("=========================");

            Tools.ShowTime("GPU", () => GPU.SumVectors(one, two, size));
            Tools.ShowTime("CPU(seq)", () => CPU.SumVectors_Seq(one, two, size));
            Tools.ShowTime("GPU(par)", () => CPU.SumVectors_Par(one, two, size));
            Console.WriteLine();
        }
Beispiel #4
0
        public static void MultipyMatrixNumber(int sizeN, int sizeM)
        {
            AMP.set_device();

            Console.WriteLine("Multiply Matrix by number");
            Console.WriteLine("=========================");
            Console.WriteLine("Preparing data...");
            var matrix = Tools.RandomMatrix(sizeN, sizeM);

            Console.WriteLine("=========================");


            Tools.ShowTime("GPU", () => GPU.MultiplyMatrixByNumber(matrix, 5));
            Tools.ShowTime("CPU(seq)", () => CPU.MultiplyMatrixByNumber_Seq(matrix, 5));
            Tools.ShowTime("GPU(par)", () => CPU.MultiplyMatrixByNumber_Par(matrix, 5));
            Console.WriteLine();
        }