int main(int argc, char ** argv) { std::string filename_a = argv[1]; std::string filename_b = argv[2]; std::string filename_c = argv[3]; double * data = 0; int m_rows, m_cols = 0; // Read the file Matrix A = util::read_hdf(filename_a); // std::cout << A.ptr() << std::endl; Matrix B = util::read_hdf(filename_b); Matrix C(A.rows(),B.cols()); multiply_naive(A,B,C); // std::cout << A << std::endl; // std::cout << B << std::endl; // std::cout << C << std::endl; // Write the file util::write_hdf(filename_c, C); return 0; }
int main(int argc, char** argv) { if(argc != 7) { printf("useage %s dim a b c d e\n", argv[0]); exit(-1); } int dim = atoi(argv[1]); int a = atoi(argv[2]); int b = atoi(argv[3]); int c = atoi(argv[4]); int d = atoi(argv[5]); int e = atoi(argv[6]); csr_matrix_t* m = create_csr_matrix(dim,dim,a,b,c,d,e); float* v = create_vector(dim); float* r1 = (float*)calloc(dim, sizeof(float)); float* r2 = (float*)calloc(dim, sizeof(float)); struct timeval start, end; gettimeofday(&start, NULL); multiply_naive(m,v,r1); gettimeofday(&end, NULL); print_time(start, end); s_matrix_t* s = convert_to_s_matrix(m); gettimeofday(&start, NULL); multiply(s,v,r2, dim, a, b, c, d, e); gettimeofday(&end, NULL); print_time(start, end); compare(r1,r2,dim); }