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]; } }
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); }
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); }
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]); }
public static void SomeKernel(GThread thread, uint[] a) { int id = thread.get_global_id(0); a[id] = a[id] * 42; }