12 lines
331 B
C++
12 lines
331 B
C++
#include "./VectorOperations.h"
|
|
|
|
// CUDA kernel. Each thread takes care of one element of c
|
|
__global__ void vecAdd(double *a, double *b, double *c, int n)
|
|
{
|
|
// Get our global thread ID
|
|
int id = blockIdx.x*blockDim.x+threadIdx.x;
|
|
|
|
// Make sure we do not go out of bounds
|
|
if (id < n)
|
|
c[id] = a[id] + b[id];
|
|
} |