Esempio n. 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            CLCalc.InitCL();


            double[] a = new double[] { 2, 147483647, 2, 7 };
            double[] b = new double[] { 1, 2, 7, 4 };
            double[] c = new double[4];

            CLCalc.Program.Variable v1 = new CLCalc.Program.Variable(a);
            CLCalc.Program.Variable v2 = new CLCalc.Program.Variable(b);
            CLCalc.Program.Variable v3 = new CLCalc.Program.Variable(c);

            CLCalc.CLPrograms.VectorSum VecSum = new CLCalc.CLPrograms.VectorSum();
            CLCalc.CLPrograms.MinDifs   Mdifs  = new CLCalc.CLPrograms.MinDifs();

            //string[] s = new string[] { VecSum.intVectorSum, VecSum.floatVectorSum };
            string[] s = new string[] { VecSum.doubleVectorSum };


            CLCalc.Program.Compile(s);

            CLCalc.Program.Kernel k = new CLCalc.Program.Kernel("doubleVectorSum");
            //CLCalc.Program.Kernel k2 = new CLCalc.Program.Kernel("intVectorSum");
            //CLCalc.Program.Kernel k = new CLCalc.Program.Kernel("floatMinDifs");

            CLCalc.Program.Variable[] vv = new CLCalc.Program.Variable[3] {
                v1, v2, v3
            };

            int[] max = new int[1] {
                a.Length
            };

            k.Execute(vv, max);

            CLCalc.Program.Sync();

            v3.ReadFromDeviceTo(c);

            CLCalc.FinishCL();
        }