void square_dgemm(const int M, const double *A, const double *B, double *C) { const int n_blocks = M / BLOCK1_SIZE + (M%BLOCK1_SIZE? 1 : 0); int bi, bj, bk; for (bi = 0; bi < n_blocks; ++bi) { const int i = bi * BLOCK1_SIZE; for (bj = 0; bj < n_blocks; ++bj) { const int j = bj * BLOCK1_SIZE; for (bk = 0; bk < n_blocks; ++bk) { const int k = bk * BLOCK1_SIZE; do_block1(M, A, B, C, i, j, k); } } } }
int main(int ac, char **av) { FILE *fin; char *cp, *cp_cur; int lc; /* loop counter */ char *msg; /* parse_opts() return message */ if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL) { tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg); } setup(); /* * The following loop checks looping state if -i option given */ for (lc = 0; TEST_LOOPING(lc); lc++) { Tst_count = 0; if ((fin = popen(pwd, "r")) == NULL) { tst_resm(TINFO, "%s: can't run %s", TCID, pwd); tst_brkm(TBROK, cleanup, "%s FAILED", TCID); /*NOTREACHED*/ } while (fgets(pwd_buf, sizeof(pwd_buf), fin) != NULL) { if ((cp = strchr(pwd_buf, '\n')) == (char *)NULL) { tst_brkm(TBROK, cleanup, "pwd output too long"); /*NOTREACHED*/ } *cp = 0; cp_cur = pwd_buf; } pclose(fin); do_block1(); do_block2(); do_block3(); do_block4(); do_block5(); do_block6(); do_block7(); } cleanup(); /*NOTREACHED*/ return(0); }
void dgemm2(const int lda, const int M, const int N, const int K, const double *A, const double *B, double *C) { const int m_blocks = M / BLOCK_SIZE1 + (M%BLOCK_SIZE1? 1 : 0); const int n_blocks = N / BLOCK_SIZE1 + (N%BLOCK_SIZE1? 1 : 0); const int k_blocks = K / BLOCK_SIZE1 + (K%BLOCK_SIZE1? 1 : 0); int bi, bj, bk; for (bi = 0; bi < m_blocks; ++bi) { const int i = bi * BLOCK_SIZE1; for (bj = 0; bj < n_blocks; ++bj) { const int j = bj * BLOCK_SIZE1; for (bk = 0; bk < k_blocks; ++bk) { const int k = bk * BLOCK_SIZE1; //printf("%.0f, %.0f, %.0f\n", A[0], B[0], C[0]); do_block1(lda, M, N, K, A, B, C, i, j, k); } } } }