Created
July 4, 2017 05:03
-
-
Save FindHao/394b2f069788e5a4c80a069638a47e1c to your computer and use it in GitHub Desktop.
向量加法,cuda版本
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__global__ void add_vectors( | |
const int* a, | |
const int* b, | |
int *c, | |
const int n) | |
{ | |
const int idx = blockIdx.x * blockDim.x + threadIdx.x; | |
if (idx >= n) return; | |
c[idx] = a[idx] + b[idx]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment