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 992 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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(
  25. "From %.0f To %.0f Step=%.0f Loops=%.0f\n",
  26. nfrom,
  27. nto,
  28. nstep,
  29. loops
  30. ))
  31. cat(sprintf(" SIZE Flops Time\n"))
  32. n <- nfrom
  33. while (n <= nto) {
  34. A <- matrix(rnorm(n * n), ncol = n, nrow = n)
  35. ev <- 0
  36. z <- system.time(for (l in 1:loops) {
  37. ev <- eigen(A)
  38. })
  39. mflops <- (26.66 * n * n * n) * loops / (z[3] * 1.0e6)
  40. st <- sprintf("%.0fx%.0f :", n, n)
  41. cat(sprintf("%20s %10.2f MFlops %10.6f sec\n", st, mflops, z[3]))
  42. n <- n + nstep
  43. }