-
-
Save krk/6436abe676ae2268c8e392dfcfdc77a6 to your computer and use it in GitHub Desktop.
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
__global__ | |
void matMul1( | |
float* d_C, | |
float* d_A, | |
float* d_B, | |
int m, | |
int n, | |
int r) | |
{ | |
int i = blockIdx.x * BLOCK_SIZE + threadIdx.x; // GPU threadinin hesaplayacağı C matrisinin satırı. | |
int k = blockIdx.y * BLOCK_SIZE + threadIdx.y; // GPU threadinin hesaplayacağı C matrisinin sütunu | |
int cIdx = i*m + k; // Hesaplanacak elemanın C indisi. | |
d_C[ cIdx ] = 0; | |
// C matrisinin her bir hücresi için | |
for(int j=0; j<n; j++) | |
{ | |
// her bir eleman için C matrisinin bir elemanı okunur ve yazılır. | |
d_C[ cIdx ] += *loc( d_A, n, i, j ) * *loc( d_B, r, j, k ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment