openGPMP
Open Source Mathematics Package
modules
linalg
gpu
_gpu_kernel_mtx_add.c
Go to the documentation of this file.
1
4
__kernel
void
add_vec_gpu
(__global
const
int
*a,
5
__global
const
int
*b,
6
__global
int
*
res
,
7
const
int
len) {
8
// current worker, each worker adds a element from A & B
9
const
int
idx = get_global_id(0);
10
// ensure number of workers created doesnt exceed elements of array
11
// by checking its bounds
12
if
(idx < len) {
13
res
[idx] = a[idx] + b[idx];
14
}
15
}
add_vec_gpu
__kernel void add_vec_gpu(__global const int *a, __global const int *b, __global int *res, const int len)
Definition:
_gpu_kernel_mtx_add.c:4
python.linalg.res
res
Definition:
linalg.py:29
Generated by
1.9.1