You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

sgemm.m 879 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #!/usr/bin/octave --silent
  2. nfrom = 128 ;
  3. nto = 2048;
  4. nstep = 128;
  5. loops = 1;
  6. arg_list = argv();
  7. for i = 1:nargin
  8. switch(i)
  9. case 1
  10. nfrom = str2num(arg_list{i});
  11. case 2
  12. nto = str2num(arg_list{i});
  13. case 3
  14. nstep = str2num(arg_list{i});
  15. case 4
  16. loops = str2num(arg_list{i});
  17. endswitch
  18. endfor
  19. p = getenv("OPENBLAS_LOOPS");
  20. if p
  21. loops = str2num(p);
  22. endif
  23. printf("From %d To %d Step=%d Loops=%d\n",nfrom, nto, nstep, loops);
  24. printf(" SIZE FLOPS TIME\n");
  25. n = nfrom;
  26. while n <= nto
  27. A = single(rand(n,n));
  28. B = single(rand(n,n));
  29. start = clock();
  30. l=0;
  31. while l < loops
  32. C = A * B;
  33. l = l + 1;
  34. endwhile
  35. timeg = etime(clock(), start);
  36. mflops = ( 2.0*n*n*n *loops ) / ( timeg * 1.0e6 );
  37. st1 = sprintf("%dx%d : ", n,n);
  38. printf("%20s %10.2f MFlops %10.6f sec\n", st1, mflops, timeg);
  39. n = n + nstep;
  40. endwhile