Advertisement
Guest User

Untitled

a guest
Nov 27th, 2014
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.35 KB | None | 0 0
  1. __global__ void matrixMultiplication(matrixCol *A, matrixCol *B, matrixCol *C, int N)
  2. {
  3.  
  4.     long long row = blockIdx.y*blockDim.y + threadIdx.y;
  5.     long long col = blockIdx.x*blockDim.x + threadIdx.x;
  6.  
  7.     if (row < N && col < N){
  8.         float sum = 0.f;
  9.         for (long long n = 0; n < N; ++n)
  10.             sum += A[row].col[n] * B[n].col[col];
  11.         C[row].col[col] = sum;
  12.     }
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement