Skip to content

Commit

Permalink
Update vectAdd kernel from idx to col
Browse files Browse the repository at this point in the history
  • Loading branch information
linjames0 committed Sep 24, 2023
1 parent bfb0a12 commit d032783
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions vectAdd.cu
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
#include <stdlib.h>

__global__ void addVectors(float *d_a, float *d_b, float *d_c, int N) {
int i = threadIdx.x;
int col = blockIdx.x * blockDim.x + threadIdx.x;

if(i < N) {
d_c[i] = d_a[i] + d_b[i];
if(col < N) {
d_c[col] = d_a[col] + d_b[col];
}
}

Expand Down

0 comments on commit d032783

Please sign in to comment.