nunoxic

Untitled

Mar 23rd, 2012
206
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <mkl.h>
  3. #include <mkl_cblas.h>
  4. void matrix_generator(double *,double *, double*, int);
  5.  
  6. int main()
  7. {
  8. int i, j,n,n2;
  9. n=15000;
  10. n2=200;
  11. double* m = (double*)malloc( n*n*sizeof(double));
  12. double* x = (double*)malloc( n*sizeof(double));
  13. double* y = (double*)malloc( n*sizeof(double));
  14. mkl_set_dynamic(0);
  15. mkl_set_num_threads(4);
  16.  
  17. matrix_generator(m,x,y,n);
  18.  
  19.  
  20. for(i=0;i<n2;i++)
  21.   cblas_dgemv(CblasRowMajor, CblasNoTrans, n, n, 1.0, m, n,x, 1, 0.0, y, 1);
  22.  
  23.   return 0;
  24. }
  25.  
  26. void matrix_generator(double *m,double *x, double *y,int n)
  27. {
  28. int i,j;
  29. for(i=0;i<n;i++)
  30. {
  31. x[i] = (i+1)*(i+1)*1.00;
  32. y[i] = 0;
  33. for(j=0;j<n;j++)
  34. m[i*n+j] = (i+j+2)*(j+1)*1.00;
  35. }
  36. }
RAW Paste Data