Skip to content

Commit

Permalink
opencl.cl: Add add, multiply and divide
Browse files Browse the repository at this point in the history
  • Loading branch information
tfarago committed Jan 28, 2021
1 parent b480263 commit cf4d5c4
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/kernels/opencl.cl
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,30 @@ diff (global float *x,
const size_t idx = get_global_id (1) * get_global_size (0) + get_global_id (0);
output[idx] = x[idx] - y[idx];
}

kernel void
add (global float *x,
global float *y,
global float *output)
{
const size_t idx = get_global_id (1) * get_global_size (0) + get_global_id (0);
output[idx] = x[idx] + y[idx];
}

kernel void
multiply (global float *x,
global float *y,
global float *output)
{
const size_t idx = get_global_id (1) * get_global_size (0) + get_global_id (0);
output[idx] = x[idx] * y[idx];
}

kernel void
divide (global float *x,
global float *y,
global float *output)
{
const size_t idx = get_global_id (1) * get_global_size (0) + get_global_id (0);
output[idx] = x[idx] / y[idx];
}

0 comments on commit cf4d5c4

Please sign in to comment.