Skip to content

@eholk /gist:4362602 forked from anonymous/gist:4362601
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
__kernel void MyAdd_col(const double __global *A,
const double __global *B,
double __global *C,
unsigned long int N)
{
unsigned long int i = get_global_id(0);
for(unsigned long int j = 0; j < N; j++) {
if (j % 2 == 0)
get(C, N, i, j) = get(A, N, i, j) + get(A, N, i, j);
else
get(C, N, i, j) = get(A, N, i, j) - get(A, N, i, j);
}
}
__kernel void MyAdd_2D_col(const double __global *A,
const double __global *B,
double __global *C,
unsigned long int N)
{
unsigned long int i = get_global_id(0);
unsigned long int j = get_global_id(1);
if (j % 2 == 0)
get(C, N, i, j) = get(A, N, i, j) + get(A, N, i, j);
else
get(C, N, i, j) = get(A, N, i, j) - get(A, N, i, j);
}
__kernel void MyAdd_2D_unweave_col(const double __global *A,
const double __global *B,
double __global *C,
unsigned long int N)
{
unsigned long int i = get_global_id(0);
unsigned long int j = get_global_id(1);
if(j < N / 2) {
unsigned long int j = 2 * j;
get(C, N, i, j) = get(A, N, i, j) + get(A, N, i, j);
}
else {
unsigned long int j = 2 * (j - N / 2) + 1;
get(C, N, i, j) = get(A, N, i, j) - get(A, N, i, j);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.