void run_solver_matrix(MatrixT1 const & matrix1, MatrixT2 const & matrix2,MatrixT3 & result, SolverTag) { std::cout << "------- Solver tag: " <<SolverTag::name()<<" ----------" << std::endl; result = viennacl::linalg::solve(matrix1, matrix2, SolverTag()); Timer timer; viennacl::backend::finish(); timer.start(); for (int runs=0; runs<BENCHMARK_RUNS; ++runs) result = viennacl::linalg::solve(matrix1, matrix2, SolverTag()); double exec_time = timer.get(); viennacl::backend::finish(); std::cout << "GPU: ";printOps(double(matrix1.size1() * matrix1.size1() * matrix2.size2()),(static_cast<double>(exec_time) / static_cast<double>(BENCHMARK_RUNS))); std::cout << "GPU: " << double(matrix1.size1() * matrix1.size1() * matrix2.size2() * sizeof(NumericT)) / (static_cast<double>(exec_time) / static_cast<double>(BENCHMARK_RUNS)) / 1e9 << " GB/sec" << std::endl; std::cout << "Execution time: " << exec_time/BENCHMARK_RUNS << std::endl; std::cout << "------- Finnished: " << SolverTag::name() << " ----------" << std::endl; }
int main() { int i, j; fillPatterns(); fillPerms(); tests(); for (i = 0; i < 65536; i++) ALL_RESULTS[i].opCount = 0; if (EQUIVALENCE_CLASSES_TOGGLE) calculateCannonicalIndex(); if (LATEX_TOGGLE) { system("cat prelude.tex"); } MAX_EXPONENT = 0; for (i = 1; i < MAX; i++) { for (j = 1; j < MAX; j++) { if ((i + j < MAX) || j == 2 || i == 2) { if (MAX_EXPONENT < i * j) MAX_EXPONENT = i * j; } } } PATTERN_MASK = 0; do { for (i = 1; i < MAX; i++) { for (j = 1; j < MAX; j++) { if (i * j <= MAX_EXPONENT) { dfs(i, j); } else { if (i < MAX && j < MAX) ALL_RESULTS[PATTERN_MASK].counts[i][j] = 0; } } } if (PRINT_MASKS_TOGGLE) printPatternMask(stderr); else if (PRINT_COUNTS_TOGGLE) printf("\n"); } while (nextSubset()); /*for(i=0;i<16;i++) print2x2MatrixInLatex(i);*/ if (LATEX_TOGGLE) { toMinTranspose(); int wilfClass = 0; qsort(ALL_RESULTS, 65536, sizeof(struct MatrixSums), cmpfunc); printMatrixSumsInLatex(ALL_RESULTS[0]); printf("\\\\\n"); printf("Wilf Class %d\\\\\n", wilfClass++); printf("%d %d ", CANNONICAL_INDEX[0], 0); if (ALL_RESULTS[0].isTranspose) printf("Transpose "); PATTERN_MASK = ALL_RESULTS[0].pattern_mask; printPatternMask(stdout); printf("\n"); // printPatternMaskInLatex(ALL_RESULTS[0].pattern_mask); int lastCannon = 0; int differentFromCannon = 0; int classSize = 1; int forbCount = 16; for (i = 1; i < 65536; i++) { if (cmpMats(ALL_RESULTS[i].counts, ALL_RESULTS[i - 1].counts) != 0) { printf("\n[ClassSize %d][ForbCount %d] ", classSize, forbCount); if (differentFromCannon) printf("[Special class]"); printf("\n"); printf("\\\\\n"); printf("\\\\\n"); printMatrixSumsInLatex(ALL_RESULTS[i]); printf("Wilf Class %d\\\\\n", wilfClass++); lastCannon = ALL_RESULTS[i].cannon_index; differentFromCannon = 0; classSize = 0; forbCount = 16 - ALL_RESULTS[i].counts[2][2]; } if (ALL_RESULTS[i].cannon_index != lastCannon) differentFromCannon++; classSize++; printf("\\\\\n"); PATTERN_MASK = ALL_RESULTS[i].pattern_mask; printf("%d %d ", ALL_RESULTS[i].cannon_index, PATTERN_MASK); if (ALL_RESULTS[i].isTranspose) printf("Transpose "); printPatternMask(stdout); printOps(stdout, ALL_RESULTS[i]); printf("\n"); // printPatternMaskInLatex(ALL_RESULTS[i].pattern_mask); } printf("\\end{document}"); } return 0; }