openGPMP
Open Source Mathematics Package
Functions
_gpu_kernel_mtx_add.c File Reference

Go to the source code of this file.

Functions

__kernel void add_vec_gpu (__global const int *a, __global const int *b, __global int *res, const int len)
 

Function Documentation

◆ add_vec_gpu()

__kernel void add_vec_gpu ( __global const int *  a,
__global const int *  b,
__global int *  res,
const int  len 
)

add vectors using GPU

Definition at line 4 of file _gpu_kernel_mtx_add.c.

7  {
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 }

References python.linalg::res.