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.

deig.R 1.0 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #!/usr/bin/Rscript
  2. argv <- commandArgs(trailingOnly = TRUE)
  3. nfrom = 128
  4. nto = 2048
  5. nstep = 128
  6. loops = 1
  7. if ( length(argv) > 0 ) {
  8. for ( z in 1:length(argv) ) {
  9. if ( z == 1 ) {
  10. nfrom <- as.numeric(argv[z])
  11. } else if ( z==2 ) {
  12. nto <- as.numeric(argv[z])
  13. } else if ( z==3 ) {
  14. nstep <- as.numeric(argv[z])
  15. } else if ( z==4 ) {
  16. loops <- as.numeric(argv[z])
  17. }
  18. }
  19. }
  20. p=Sys.getenv("OPENBLAS_LOOPS")
  21. if ( p != "" ) {
  22. loops <- as.numeric(p)
  23. }
  24. cat(sprintf("From %.0f To %.0f Step=%.0f Loops=%.0f\n",nfrom, nto, nstep, loops))
  25. cat(sprintf(" SIZE Flops Time\n"))
  26. n = nfrom
  27. while ( n <= nto ) {
  28. A <- matrix(runif(n*n), ncol = n, nrow = n, byrow = TRUE)
  29. l = 1
  30. start <- proc.time()[3]
  31. while ( l <= loops ) {
  32. ev <- eigen(A)
  33. l = l + 1
  34. }
  35. end <- proc.time()[3]
  36. timeg = end - start
  37. mflops = (26.66 *n*n*n ) * loops / ( timeg * 1.0e6 )
  38. st = sprintf("%.0fx%.0f :",n , n)
  39. cat(sprintf("%20s %10.2f MFlops %10.6f sec\n", st, mflops, timeg))
  40. n = n + nstep
  41. }