cpp: void init_array(int nr, int nq, int np,\nDATA_TYPE POLYBENCH_3D(A,NR,NQ,NP,nr,nq,np),\nDATA_TYPE POLYBENCH_2D(C4,NP,NP,np,np))\n{\nint i, j, k;\n\nfor (i = 0; i < nr; i++)\nfor (j = 0; j < nq; j++)\nfor (k = 0; k < np; k++)\nA[i][j][k] = ((DATA_TYPE) i*j + k) / np;\nfor (i = 0; i < np; i++)\nfor (j = 0; j < np; j++)\nC4[i][j] = ((DATA_TYPE) i*j) / np;\n}
fortran: subroutine init_array(nr, nq, np, a, cFour)\nimplicit none\n\nDATA_TYPE, dimension(np, nq, nr) :: a\nDATA_TYPE, dimension(np, np) :: cFour\ninteger :: nr, nq, np\ninteger :: i, j, k\n\ndo i = 1, nr\ndo j = 1, nq\ndo k = 1, np\na(k, j, i) = ((DBLE(i - 1) * DBLE(j - 1)) + DBLE(k - 1)) / &\nDBLE(np)\nend do\nend do\nend do\ndo i = 1, np\ndo j = 1, np\ncFour(j, i) = (DBLE(i - 1) * DBLE(j - 1)) / np\nend do\nend do\nend subroutine