mirror of
https://github.com/RustyRaptor/parallel-programming.git
synced 2026-12-03 15:55:15 -07:00
added vector_add function kernel thing
This commit is contained in:
1 parent
c6cbaa67e0
commit
920758326f
1 file changed
+9
@@ -36,6 +36,15 @@ __global__ void reduce(int *g_idata, int *g_odata)
|
||||
g_odata[blockIdx.x] = sdata[0];
|
||||
}
|
||||
|
||||
__global__ void vector_add(int *a, int *b, int *c, int N)
|
||||
{
|
||||
int i = blockIdx.x * blockDim.x + threadIdx.x;
|
||||
if (i < N)
|
||||
{
|
||||
c[i] = a[i] + b[i];
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char const *argv[])
|
||||
{
|
||||
// size of the vector
|
||||
|
||||
Reference in new issue
Block a user