cpp: void kernel_2mm(int ni, int nj, int nk, int nl,\nDATA_TYPE alpha,\nDATA_TYPE beta,\nDATA_TYPE POLYBENCH_2D(tmp,NI,NJ,ni,nj),\nDATA_TYPE POLYBENCH_2D(A,NI,NK,ni,nk),\nDATA_TYPE POLYBENCH_2D(B,NK,NJ,nk,nj),\nDATA_TYPE POLYBENCH_2D(C,NL,NJ,nl,nj),\nDATA_TYPE POLYBENCH_2D(D,NI,NL,ni,nl))\n{\nint i, j, k;\n\n#pragma scop\n/* D := alpha*A*B*C + beta*D */\nfor (i = 0; i < _PB_NI; i++)\nfor (j = 0; j < _PB_NJ; j++)\n{\ntmp[i][j] = 0;\nfor (k = 0; k < _PB_NK; ++k)\ntmp[i][j] += alpha * A[i][k] * B[k][j];\n}\nfor (i = 0; i < _PB_NI; i++)\nfor (j = 0; j < _PB_NL; j++)\n{\nD[i][j] *= beta;\nfor (k = 0; k < _PB_NJ; ++k)\nD[i][j] += tmp[i][k] * C[k][j];\n}\n#pragma endscop\n\n}
fortran: subroutine kernel_2mm(alpha, beta, tmp, a, b, c, d,  &\nni, nj, nk, nl)\nimplicit none\n\nDATA_TYPE, dimension(nj, ni) :: tmp\nDATA_TYPE, dimension(nk, ni) :: a\nDATA_TYPE, dimension(nj, nk) :: b\nDATA_TYPE, dimension(nl, nj) :: c\nDATA_TYPE, dimension(nl, ni) :: d\nDATA_TYPE :: alpha, beta\ninteger :: ni, nj, nk, nl\ninteger :: i, j, k\n\n!$pragma scop\ndo i = 1, _PB_NI\ndo j = 1, _PB_NJ\ntmp(j,i) = 0.0\ndo k = 1, _PB_NK\ntmp(j,i) = tmp(j,i) + alpha * a(k,i) * b(j,k)\nend do\nend do\nend do\n\ndo i = 1, _PB_NI\ndo j = 1, _PB_NL\nd(j,i) = d(j,i) * beta\ndo k = 1, _PB_NJ\nd(j,i) = d(j,i) + tmp(k,i) * c(j,k)\nend do\nend do\nend do\n!$pragma endscop\nend subroutine