forked from EA31337/EA31337-classes
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refs EA31337#738. Matrix multiplication via OpenCL. Ready for testing.
- Loading branch information
Showing
5 changed files
with
148 additions
and
98 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,14 @@ | ||
#pragma OPENCL EXTENSION cl_khr_fp64 : enable | ||
|
||
__kernel void matmul( | ||
__global double* A, | ||
__global double* B, | ||
__global double* C, | ||
int rowsA, | ||
int colsA, | ||
int colsB | ||
) | ||
{ | ||
int row = get_global_id(0); | ||
int col = get_global_id(1); | ||
|
||
double sum = 0.0; | ||
|
||
for(int k = 0; k < colsA; ++k) { | ||
sum += A[row * colsA + k] * B[k * colsB + col]; | ||
//sum += col; | ||
__kernel void matmul(__global double* A, __global double* B, __global double* C, int rowsA, int colsA, int colsB) { | ||
int i = get_global_id(0); | ||
int j = get_global_id(1); | ||
|
||
if (i < rowsA && j < colsB) { | ||
float sum = 0.0f; | ||
for (int k = 0; k < colsA; ++k) { | ||
sum += A[i * colsA + k] * B[k * colsB + j]; | ||
} | ||
C[i * colsB + j] = sum; | ||
} | ||
|
||
C[row * colsB + col] = sum; | ||
} |
Oops, something went wrong.