Skip to content

Instantly share code, notes, and snippets.

@rbonvall
Created February 3, 2012 17:53
Show Gist options
  • Save rbonvall/1731392 to your computer and use it in GitHub Desktop.
Save rbonvall/1731392 to your computer and use it in GitHub Desktop.
c ← a + b in CUDA
__global__ void sum(float *a, float *b, float *c) {
int i = threadIdx.x + blockDim.x * blockIdx.x;
c[i] = a[i] + b[i];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment