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.

dsolve.m 948 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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 = double(rand(n,n));
  28. B = double(rand(n,n));
  29. start = clock();
  30. l=0;
  31. while l < loops
  32. x = linsolve(A,B);
  33. #x = A / B;
  34. l = l + 1;
  35. endwhile
  36. timeg = etime(clock(), start);
  37. #r = norm(A*x - B)/norm(B)
  38. mflops = ( 2.0/3.0 *n*n*n + 2.0*n*n*n ) *loops / ( timeg * 1.0e6 );
  39. st1 = sprintf("%dx%d : ", n,n);
  40. printf("%20s %10.2f MFlops %10.6f sec\n", st1, mflops, timeg );
  41. n = n + nstep;
  42. endwhile