Skip to content

Instantly share code, notes, and snippets.

@papousek
Created April 3, 2011 10:40
Show Gist options
  • Save papousek/900349 to your computer and use it in GitHub Desktop.
Save papousek/900349 to your computer and use it in GitHub Desktop.
extern "C" __global__
void add_vec( const float* A, const float* B, const int length float* result) {
int x = blockIdx.x * blockDim.x + threadIdx.x;
if (x < length) {
result[x] = A[x] + B[x];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment