Skip to content

Instantly share code, notes, and snippets.

@johnwalley
Created August 10, 2014 19:24
Show Gist options
  • Save johnwalley/99f26d1f677a1dc6d834 to your computer and use it in GitHub Desktop.
Save johnwalley/99f26d1f677a1dc6d834 to your computer and use it in GitHub Desktop.
Simple matrix-vector multiplication kernel
__global__ void multiplyKernel(float *c, const float *a, const float *b, const int size) {
int index = threadIdx.x + blockIdx.x * blockDim.x;
c[index] = 0;
for (int j = 0; j < size; ++j)
c[index] += a[index * size + j] * b[index];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment