Created
March 13, 2013 02:34
-
-
Save benmanns/5148946 to your computer and use it in GitHub Desktop.
An OpenCL kernel for computing the dot product of two matrices.
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
__kernel void matdot(__global double * outputC, int widthA, int heightA, int widthB, int heightB, __global double* inputA, __global double* inputB) { | |
int column = get_global_id(0); | |
int row = get_global_id(1); | |
double sum = 0.0; | |
for (int i = 0; i < widthA; i++) { | |
sum += inputA[row * widthA + i] * inputB[i * widthB + column]; | |
} | |
outputC[row * widthB + column] = sum; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment