Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

82 wiersze
2.0KB

  1. #!/usr/bin/env python2
  2. """
  3. Run the simulator and record statistics.
  4. """
  5. import sys, os, os.path, glob
  6. frameDir = os.environ['PREFETCHER_FRAMEWORK']
  7. homeDir = os.path.realpath(os.path.dirname(os.path.realpath(__file__))+ '/..')
  8. sys.path.append(frameDir)
  9. from lib.run_util import *
  10. import lib.stats as stats
  11. # Uncomment this to print commands instead of executing them.
  12. #dry_run()
  13. # Set paths
  14. m5_path(homeDir + '/build/ALPHA_SE/m5.opt')
  15. se_path(frameDir + '/m5/configs/example/se.py')
  16. # Check that M5 is compiled
  17. if not os.path.exists(homeDir + '/build/ALPHA_SE/m5.opt'):
  18. print >>sys.stderr, "Could not find the M5 binary, run compile.sh to compile with your prefetcher."
  19. sys.exit(1)
  20. print "Remember to recompile after making changes."
  21. # Set output directory
  22. global_prefix(homeDir + '/output/')
  23. # Configure
  24. global_args(
  25. '--checkpoint-dir=' + frameDir + '/lib/cp',
  26. '--checkpoint-restore=%d' % 1e9, '--at-instruction',
  27. '--caches', '--l2cache',
  28. '--standard-switch', '--warmup-insts=%d' % 1e7,
  29. '--max-inst=%d' % 1e7,
  30. '--l2size=1MB',
  31. '--membus-width=8', '--membus-clock=400MHz', '--mem-latency=30ns',
  32. )
  33. # Prefetchers to run
  34. prefetchers = Config('user', ['--prefetcher=on_access=true:policy=proxy'])
  35. # Tests to run
  36. tests = spec_configs
  37. #tests = spec_configs[:2]
  38. configs = cross(tests, prefetchers)
  39. # Run tests
  40. os.chdir(homeDir)
  41. os.environ['M5_CPU2000'] = homeDir + '/data/cpu2000'
  42. run_configs(configs)
  43. # Read statistics
  44. stats.BASELINE_PF = 'none'
  45. pf_stats = stats.read_stats(*glob.glob(frameDir + '/lib/stats/*_1e7'))
  46. pf_stats.update(stats.build_stats(homeDir + '/output'))
  47. # Write statistics
  48. stats_file = open(homeDir + '/stats.txt', 'w')
  49. def save_stats(pf, test, echo):
  50. table = stats.format_stats(pf_stats, pf, test)
  51. stats_file.write(table)
  52. if echo:
  53. print table
  54. # Prefetcher comparison for each test
  55. for test in sorted(pf_stats['user']):
  56. save_stats('all', test, False)
  57. # User prefetcher results.
  58. save_stats('user', 'all', True)
  59. # Summary
  60. save_stats('all', 'all', True)
  61. stats_file.close()