Create a gist now

Instantly share code, notes, and snippets.

@krk /matMul2.cu Secret
Created Jun 27, 2017

What would you like to do?
__global__
void matMul2(
float* d_C,
float* d_A,
float* d_B,
int m,
int n,
int r)
{
int i = blockIdx.x * BLOCK_SIZE + threadIdx.x;
int k = blockIdx.y * BLOCK_SIZE + threadIdx.y;
int cIdx = i*m + k;
float val = 0; // ara toplam değişkeni
// C matrisinin her bir hücresi için
for(int j=0; j<n; j++)
{
val += *loc( d_A, n, i, j ) * *loc( d_B, r, j, k );
}
// C matrisine bir kere yazılır.
d_C[ cIdx ] = val;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment