Skip to content

Instantly share code, notes, and snippets.

@ChrisLane
Created February 25, 2018 01:27
Show Gist options
  • Save ChrisLane/a4dd51f9470e3494f371578dbde51c83 to your computer and use it in GitHub Desktop.
Save ChrisLane/a4dd51f9470e3494f371578dbde51c83 to your computer and use it in GitHub Desktop.
__global__ void addToBlocks(int *d_Output, int *d_Addition, int len) {
int thid = blockIdx.x * blockDim.x + threadIdx.x;
if ((thid) < len) {
printf("%d:%d + %d:%d\n", thid, d_Output[thid], blockIdx.x, d_Addition[blockIdx.x]);
d_Output[thid] += d_Addition[blockIdx.x];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment