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.R 1.1 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. B <- matrix(runif(n*n), ncol = n, nrow = n, byrow = TRUE)
  30. l = 1
  31. start <- proc.time()[3]
  32. while ( l <= loops ) {
  33. solve(A,B)
  34. l = l + 1
  35. }
  36. end <- proc.time()[3]
  37. timeg = end - start
  38. mflops = (2.0/3.0 *n*n*n + 2.0 *n*n*n ) * loops / ( timeg * 1.0e6 )
  39. st = sprintf("%.0fx%.0f :",n , n)
  40. cat(sprintf("%20s %10.2f MFlops %10.6f sec\n", st, mflops, timeg))
  41. n = n + nstep
  42. }