public static void adder(GThread thread, int[] a, int[] b, int[] c)
        {
            int tid = thread.get_global_id(0);

            //int tid = thread.blockIdx.x;
            if (tid < N)
            {
                c[tid] = a[tid] + b[tid];
            }
        }
Example #2
0
        public static void CalculateMandelbrot(
            GThread thread,
            float minX,
            float maxY,
            float stepX,
            float stepY,
            int[,] result)
        {
            var y = thread.get_global_id(0);
            var x = thread.get_global_id(1);

            if (x >= result.GetLength(1) || y >= result.GetLength(0))
            {
                return;
            }
            float real      = minX + x * stepX;
            float imaginary = maxY - y * stepY;

            result[y, x] = GetMandelbrotIterationsFor(real, imaginary);
        }
Example #3
0
 public static void CalculateMandelbrot(
     GThread thread,
     float minX,
     float maxY,
     float stepX,
     float stepY,
     int[,] result)
 {
     var y = thread.get_global_id(0);
     var x = thread.get_global_id(1);
     if (x >= result.GetLength(1) || y >= result.GetLength(0))
         return;
     float real = minX + x * stepX;
     float imaginary = maxY - y * stepY;
     result[y, x] = GetMandelbrotIterationsFor(real, imaginary);
 }
Example #4
0
        private static void SIMDFunctionTest(GThread thread, uint[] a, uint[] b, uint[] c)
        {
            int i = thread.get_global_id(0);

            c[i] = thread.vadd2(a[i], b[i]);
        }
Example #5
0
 public static void SomeKernel(GThread thread, uint[] a)
 {
     int id = thread.get_global_id(0);
     a[id] = a[id] * 42;
 }
Example #6
0
        public static void SomeKernel(GThread thread, uint[] a)
        {
            int id = thread.get_global_id(0);

            a[id] = a[id] * 42;
        }
Example #7
0
 private static void SIMDFunctionTest(GThread thread, uint[] a, uint[] b, uint[] c)
 {
     int i = thread.get_global_id(0);
     c[i] = thread.vadd2(a[i], b[i]);
 }