summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIru Cai <mytbk920423@gmail.com>2019-03-26 09:50:08 +0800
committerIru Cai <mytbk920423@gmail.com>2019-03-26 09:50:08 +0800
commita012519d3e2c151a86d599c308f07e0fd3b5922a (patch)
treef08b41f983da02be600e55019edf7ac0fc12a5d3
parentd4513c7a334f102c601b02de2ffcdf8efc096700 (diff)
downloadgem5-a012519d3e2c151a86d599c308f07e0fd3b5922a.tar.xz
try to make out some experiment scripts for me
-rw-r--r--configs/example/spec06_config.py117
-rwxr-xr-xexp_script/run_spec_from_ckpt.sh10
-rwxr-xr-xexp_script/spec_checkpoint.sh225
3 files changed, 289 insertions, 63 deletions
diff --git a/configs/example/spec06_config.py b/configs/example/spec06_config.py
index 46781aa5a..0715909f4 100644
--- a/configs/example/spec06_config.py
+++ b/configs/example/spec06_config.py
@@ -137,121 +137,122 @@ if '--ruby' in sys.argv:
(options, args) = parser.parse_args()
if args:
- print "Error: script doesn't take any positional arguments"
+ print("Error: script doesn't take any positional arguments")
sys.exit(1)
#multiprocesses = []
numThreads = 1
if options.benchmark:
- print 'Selected SPEC_CPU2006 benchmark'
+ print('Selected SPEC_CPU2006 benchmark')
if options.benchmark == 'perlbench':
- print '--> perlbench'
+ print('--> perlbench')
process = spec06_benchmarks.perlbench
elif options.benchmark == 'bzip2':
- print '--> bzip2'
+ print('--> bzip2')
process = spec06_benchmarks.bzip2
elif options.benchmark == 'gcc':
- print '--> gcc'
+ print('--> gcc')
process = spec06_benchmarks.gcc
elif options.benchmark == 'bwaves':
- print '--> bwaves'
+ print('--> bwaves')
process = spec06_benchmarks.bwaves
elif options.benchmark == 'gamess':
- print '--> gamess'
+ print('--> gamess')
process = spec06_benchmarks.gamess
elif options.benchmark == 'mcf':
- print '--> mcf'
+ print('--> mcf')
process = spec06_benchmarks.mcf
elif options.benchmark == 'milc':
- print '--> milc'
+ print('--> milc')
process = spec06_benchmarks.milc
elif options.benchmark == 'zeusmp':
- print '--> zeusmp'
+ print('--> zeusmp')
process = spec06_benchmarks.zeusmp
elif options.benchmark == 'gromacs':
- print '--> gromacs'
+ print('--> gromacs')
process = spec06_benchmarks.gromacs
elif options.benchmark == 'cactusADM':
- print '--> cactusADM'
+ print('--> cactusADM')
process = spec06_benchmarks.cactusADM
elif options.benchmark == 'leslie3d':
- print '--> leslie3d'
+ print('--> leslie3d')
process = spec06_benchmarks.leslie3d
elif options.benchmark == 'namd':
- print '--> namd'
+ print('--> namd')
process = spec06_benchmarks.namd
elif options.benchmark == 'gobmk':
- print '--> gobmk'
+ print('--> gobmk')
process = spec06_benchmarks.gobmk
elif options.benchmark == 'dealII':
- print '--> dealII'
+ print('--> dealII')
process = spec06_benchmarks.dealII
elif options.benchmark == 'soplex':
- print '--> soplex'
+ print('--> soplex')
process = spec06_benchmarks.soplex
elif options.benchmark == 'povray':
- print '--> povray'
+ print('--> povray')
process = spec06_benchmarks.povray
elif options.benchmark == 'calculix':
- print '--> calculix'
+ print('--> calculix')
process = spec06_benchmarks.calculix
elif options.benchmark == 'hmmer':
- print '--> hmmer'
+ print('--> hmmer')
process = spec06_benchmarks.hmmer
elif options.benchmark == 'sjeng':
- print '--> sjeng'
+ print('--> sjeng')
process = spec06_benchmarks.sjeng
elif options.benchmark == 'GemsFDTD':
- print '--> GemsFDTD'
+ print('--> GemsFDTD')
process = spec06_benchmarks.GemsFDTD
elif options.benchmark == 'libquantum':
- print '--> libquantum'
+ print('--> libquantum')
process = spec06_benchmarks.libquantum
elif options.benchmark == 'h264ref':
- print '--> h264ref'
+ print('--> h264ref')
process = spec06_benchmarks.h264ref
elif options.benchmark == 'tonto':
- print '--> tonto'
+ print('--> tonto')
process = spec06_benchmarks.tonto
elif options.benchmark == 'lbm':
- print '--> lbm'
+ print('--> lbm')
process = spec06_benchmarks.lbm
elif options.benchmark == 'omnetpp':
- print '--> omnetpp'
+ print('--> omnetpp')
process = spec06_benchmarks.omnetpp
elif options.benchmark == 'astar':
- print '--> astar'
+ print('--> astar')
process = spec06_benchmarks.astar
elif options.benchmark == 'wrf':
- print '--> wrf'
+ print('--> wrf')
process = spec06_benchmarks.wrf
elif options.benchmark == 'sphinx3':
- print '--> sphinx3'
+ print('--> sphinx3')
process = spec06_benchmarks.sphinx3
elif options.benchmark == 'xalancbmk':
- print '--> xalancbmk'
+ print('--> xalancbmk')
process = spec06_benchmarks.xalancbmk
elif options.benchmark == 'specrand_i':
- print '--> specrand_i'
+ print('--> specrand_i')
process = spec06_benchmarks.specrand_i
elif options.benchmark == 'specrand_f':
- print '--> specrand_f'
+ print('--> specrand_f')
process = spec06_benchmarks.specrand_f
else:
- print "No recognized SPEC2006 benchmark selected! Exiting."
+ print("No recognized SPEC2006 benchmark selected! Exiting.")
sys.exit(1)
else:
- print >> sys.stderr, "Need --benchmark switch to specify SPEC CPU2006 workload. Exiting!\n"
+ print("Need --benchmark switch to specify SPEC CPU2006 workload. Exiting!\n",
+ file=sys.stderr)
sys.exit(1)
# Set process stdout/stderr
if options.benchmark_stdout:
process.output = options.benchmark_stdout
- print "Process stdout file: " + process.output
+ print("Process stdout file: " + process.output)
if options.benchmark_stderr:
process.errout = options.benchmark_stderr
- print "Process stderr file: " + process.errout
+ print("Process stderr file: " + process.errout)
#if options.bench:
# apps = options.bench.split("-")
@@ -333,22 +334,22 @@ if is_kvm_cpu(CPUClass) or is_kvm_cpu(FutureClass):
fatal("KvmCPU can only be used in SE mode with x86")
# Sanity check
-if options.fastmem:
- if CPUClass != AtomicSimpleCPU:
- fatal("Fastmem can only be used with atomic CPU!")
- if (options.caches or options.l2cache):
- fatal("You cannot use fastmem in combination with caches!")
-
-if options.simpoint_profile:
- if not options.fastmem:
- # Atomic CPU checked with fastmem option already
- fatal("SimPoint generation should be done with atomic cpu and fastmem")
- if np > 1:
- fatal("SimPoint generation not supported with more than one CPUs")
+#if options.fastmem:
+# if CPUClass != AtomicSimpleCPU:
+# fatal("Fastmem can only be used with atomic CPU!")
+# if (options.caches or options.l2cache):
+# fatal("You cannot use fastmem in combination with caches!")
+#
+#if options.simpoint_profile:
+# if not options.fastmem:
+# # Atomic CPU checked with fastmem option already
+# fatal("SimPoint generation should be done with atomic cpu and fastmem")
+# if np > 1:
+# fatal("SimPoint generation not supported with more than one CPUs")
for i in xrange(np):
system.cpu[i].workload = process
- print process.cmd
+ print(process.cmd)
#if options.smt:
# system.cpu[i].workload = multiprocesses
@@ -357,14 +358,14 @@ for i in xrange(np):
#else:
# system.cpu[i].workload = multiprocesses[i]
- if options.fastmem:
- system.cpu[i].fastmem = True
-
- if options.simpoint_profile:
- system.cpu[i].addSimPointProbe(options.simpoint_interval)
-
- if options.checker:
- system.cpu[i].addCheckerCpu()
+# if options.fastmem:
+# system.cpu[i].fastmem = True
+#
+# if options.simpoint_profile:
+# system.cpu[i].addSimPointProbe(options.simpoint_interval)
+#
+# if options.checker:
+# system.cpu[i].addCheckerCpu()
system.cpu[i].createThreads()
diff --git a/exp_script/run_spec_from_ckpt.sh b/exp_script/run_spec_from_ckpt.sh
index dcb40da36..2de83702f 100755
--- a/exp_script/run_spec_from_ckpt.sh
+++ b/exp_script/run_spec_from_ckpt.sh
@@ -195,7 +195,7 @@ then
fi
mkdir -p $OUTPUT_DIR
-RUN_DIR=$SPEC_PATH/benchspec/CPU2006/$BENCHMARK_CODE/run/run_base_ref_x86_64.0000
+RUN_DIR=$SPEC_PATH/benchspec/CPU2006/$BENCHMARK_CODE/run/run_base_ref_x86_64.0001
#run_base_ref\_my-alpha.0000
# Run directory for the selected SPEC benchmark
SCRIPT_OUT=$OUTPUT_DIR/runscript.log
@@ -234,8 +234,8 @@ $GEM5_PATH/build/X86_MESI_Two_Level/gem5.fast \
--num-cpus=1 --mem-size=4GB \
--checkpoint-dir=$CKPT_OUT_DIR \
--checkpoint-restore=10000000000 --at-instruction \
- --l1d_assoc=8 --l2_assoc=16 --l1i_assoc=4 \
- --cpu-type=DerivO3CPU --needsTSO=0 --scheme=$SCHEME \
- --num-dirs=1 --ruby --maxinsts=2000000000 \
- --network=simple --topology=Mesh_XY --mesh-rows=1 | tee -a $SCRIPT_OUT
+ --l1d_assoc=8 --l2_assoc=16 --l1i_assoc=4 \
+ --cpu-type=DerivO3CPU --needsTSO=1 --scheme=$SCHEME \
+ --num-dirs=1 --ruby --maxinsts=1000000000 \
+ --network=simple --topology=Mesh_XY --mesh-rows=1
diff --git a/exp_script/spec_checkpoint.sh b/exp_script/spec_checkpoint.sh
new file mode 100755
index 000000000..ad4a94b49
--- /dev/null
+++ b/exp_script/spec_checkpoint.sh
@@ -0,0 +1,225 @@
+#!/bin/bash
+
+############ DIRECTORY VARIABLES: MODIFY ACCORDINGLY #############
+#Need to export GEM5_PATH
+if [ -z ${GEM5_PATH+x} ];
+then
+ echo "GEM5_PATH is unset";
+ exit
+else
+ echo "GEM5_PATH is set to '$GEM5_PATH'";
+fi
+
+
+#Need to export SPEC_PATH
+# [mengjia] on my desktop, it is /home/mengjia/workspace/benchmarks/cpu2006
+if [ -z ${SPEC_PATH+x} ];
+then
+ echo "SPEC_PATH is unset";
+ exit
+else
+ echo "SPEC_PATH is set to '$SPEC_PATH'";
+fi
+
+##################################################################
+
+ARGC=$# # Get number of arguments excluding arg0 (the script itself). Check for help message condition.
+if [[ "$ARGC" != 1 ]]; then # Bad number of arguments.
+ echo "run_gem5_alpha_spec06_benchmark.sh Copyright (C) 2014 Mark Gottscho"
+ echo "This program comes with ABSOLUTELY NO WARRANTY; for details see <http://www.gnu.org/licenses/>."
+ echo "This is free software, and you are welcome to redistribute it under certain conditions; see <http://www.gnu.org/licenses/> for details."
+ echo ""
+ echo "Author: Mark Gottscho"
+ echo "mgottscho@ucla.edu"
+ echo ""
+ echo "This script runs a single gem5 simulation of a single SPEC CPU2006 benchmark for Alpha ISA."
+ echo ""
+ echo "USAGE: run_gem5_alpha_spec06_benchmark.sh <BENCHMARK>"
+ echo "EXAMPLE: ./run_gem5_alpha_spec06_benchmark.sh bzip2 UnsafeBaseline"
+ echo ""
+ echo "A single --help help or -h argument will bring this message back."
+ exit
+fi
+
+# Get command line input. We will need to check these.
+BENCHMARK=$1 # Benchmark name, e.g. bzip2
+######################### BENCHMARK CODENAMES ####################
+PERLBENCH_CODE=400.perlbench
+BZIP2_CODE=401.bzip2
+GCC_CODE=403.gcc
+BWAVES_CODE=410.bwaves
+GAMESS_CODE=416.gamess
+MCF_CODE=429.mcf
+MILC_CODE=433.milc
+ZEUSMP_CODE=434.zeusmp
+GROMACS_CODE=435.gromacs
+CACTUSADM_CODE=436.cactusADM
+LESLIE3D_CODE=437.leslie3d
+NAMD_CODE=444.namd
+GOBMK_CODE=445.gobmk
+DEALII_CODE=447.dealII
+SOPLEX_CODE=450.soplex
+POVRAY_CODE=453.povray
+CALCULIX_CODE=454.calculix
+HMMER_CODE=456.hmmer
+SJENG_CODE=458.sjeng
+GEMSFDTD_CODE=459.GemsFDTD
+LIBQUANTUM_CODE=462.libquantum
+H264REF_CODE=464.h264ref
+TONTO_CODE=465.tonto
+LBM_CODE=470.lbm
+OMNETPP_CODE=471.omnetpp
+ASTAR_CODE=473.astar
+WRF_CODE=481.wrf
+SPHINX3_CODE=482.sphinx3
+XALANCBMK_CODE=483.xalancbmk
+SPECRAND_INT_CODE=998.specrand
+SPECRAND_FLOAT_CODE=999.specrand
+##################################################################
+
+# Check BENCHMARK input
+#################### BENCHMARK CODE MAPPING ######################
+BENCHMARK_CODE="none"
+
+if [[ "$BENCHMARK" == "perlbench" ]]; then
+ BENCHMARK_CODE=$PERLBENCH_CODE
+fi
+if [[ "$BENCHMARK" == "bzip2" ]]; then
+ BENCHMARK_CODE=$BZIP2_CODE
+fi
+if [[ "$BENCHMARK" == "gcc" ]]; then
+ BENCHMARK_CODE=$GCC_CODE
+fi
+if [[ "$BENCHMARK" == "bwaves" ]]; then
+ BENCHMARK_CODE=$BWAVES_CODE
+fi
+if [[ "$BENCHMARK" == "gamess" ]]; then
+ BENCHMARK_CODE=$GAMESS_CODE
+fi
+if [[ "$BENCHMARK" == "mcf" ]]; then
+ BENCHMARK_CODE=$MCF_CODE
+fi
+if [[ "$BENCHMARK" == "milc" ]]; then
+ BENCHMARK_CODE=$MILC_CODE
+fi
+if [[ "$BENCHMARK" == "zeusmp" ]]; then
+ BENCHMARK_CODE=$ZEUSMP_CODE
+fi
+if [[ "$BENCHMARK" == "gromacs" ]]; then
+ BENCHMARK_CODE=$GROMACS_CODE
+fi
+if [[ "$BENCHMARK" == "cactusADM" ]]; then
+ BENCHMARK_CODE=$CACTUSADM_CODE
+fi
+if [[ "$BENCHMARK" == "leslie3d" ]]; then
+ BENCHMARK_CODE=$LESLIE3D_CODE
+fi
+if [[ "$BENCHMARK" == "namd" ]]; then
+ BENCHMARK_CODE=$NAMD_CODE
+fi
+if [[ "$BENCHMARK" == "gobmk" ]]; then
+ BENCHMARK_CODE=$GOBMK_CODE
+fi
+if [[ "$BENCHMARK" == "dealII" ]]; then # DOES NOT WORK
+ BENCHMARK_CODE=$DEALII_CODE
+fi
+if [[ "$BENCHMARK" == "soplex" ]]; then
+ BENCHMARK_CODE=$SOPLEX_CODE
+fi
+if [[ "$BENCHMARK" == "povray" ]]; then
+ BENCHMARK_CODE=$POVRAY_CODE
+fi
+if [[ "$BENCHMARK" == "calculix" ]]; then
+ BENCHMARK_CODE=$CALCULIX_CODE
+fi
+if [[ "$BENCHMARK" == "hmmer" ]]; then
+ BENCHMARK_CODE=$HMMER_CODE
+fi
+if [[ "$BENCHMARK" == "sjeng" ]]; then
+ BENCHMARK_CODE=$SJENG_CODE
+fi
+if [[ "$BENCHMARK" == "GemsFDTD" ]]; then
+ BENCHMARK_CODE=$GEMSFDTD_CODE
+fi
+if [[ "$BENCHMARK" == "libquantum" ]]; then
+ BENCHMARK_CODE=$LIBQUANTUM_CODE
+fi
+if [[ "$BENCHMARK" == "h264ref" ]]; then
+ BENCHMARK_CODE=$H264REF_CODE
+fi
+if [[ "$BENCHMARK" == "tonto" ]]; then
+ BENCHMARK_CODE=$TONTO_CODE
+fi
+if [[ "$BENCHMARK" == "lbm" ]]; then
+ BENCHMARK_CODE=$LBM_CODE
+fi
+if [[ "$BENCHMARK" == "omnetpp" ]]; then
+ BENCHMARK_CODE=$OMNETPP_CODE
+fi
+if [[ "$BENCHMARK" == "astar" ]]; then
+ BENCHMARK_CODE=$ASTAR_CODE
+fi
+if [[ "$BENCHMARK" == "wrf" ]]; then
+ BENCHMARK_CODE=$WRF_CODE
+fi
+if [[ "$BENCHMARK" == "sphinx3" ]]; then
+ BENCHMARK_CODE=$SPHINX3_CODE
+fi
+if [[ "$BENCHMARK" == "xalancbmk" ]]; then # DOES NOT WORK
+ BENCHMARK_CODE=$XALANCBMK_CODE
+fi
+if [[ "$BENCHMARK" == "specrand_i" ]]; then
+ BENCHMARK_CODE=$SPECRAND_INT_CODE
+fi
+if [[ "$BENCHMARK" == "specrand_f" ]]; then
+ BENCHMARK_CODE=$SPECRAND_FLOAT_CODE
+fi
+
+# Sanity check
+if [[ "$BENCHMARK_CODE" == "none" ]]; then
+ echo "Input benchmark selection $BENCHMARK did not match any known SPEC CPU2006 benchmarks! Exiting."
+ exit 1
+fi
+##################################################################
+
+CKPT_OUT_DIR=$GEM5_PATH/../gem5_ckpt/$BENCHMARK-1-ref-x86
+
+install -d "$CKPT_OUT_DIR"
+
+echo "checkpoint direcotory: " $CKPT_OUT_DIR
+
+RUN_DIR=$SPEC_PATH/benchspec/CPU2006/$BENCHMARK_CODE/run/run_base_ref_x86_64.0001
+# File log for this script's stdout henceforth
+
+################## REPORT SCRIPT CONFIGURATION ###################
+
+echo "Command line:" | tee $SCRIPT_OUT
+echo "$0 $*" | tee -a $SCRIPT_OUT
+echo "================= Hardcoded directories ==================" | tee -a $SCRIPT_OUT
+echo "GEM5_PATH: $GEM5_PATH" | tee -a $SCRIPT_OUT
+echo "SPEC_PATH: $SPEC_PATH" | tee -a $SCRIPT_OUT
+echo "==================== Script inputs =======================" | tee -a $SCRIPT_OUT
+echo "BENCHMARK: $BENCHMARK" | tee -a $SCRIPT_OUT
+echo "==========================================================" | tee -a $SCRIPT_OUT
+##################################################################
+
+
+#################### LAUNCH GEM5 SIMULATION ######################
+echo ""
+echo "Changing to SPEC benchmark runtime directory: $RUN_DIR" | tee -a $SCRIPT_OUT
+cd $RUN_DIR
+
+echo "" | tee -a $SCRIPT_OUT
+echo "" | tee -a $SCRIPT_OUT
+echo "--------- Here goes nothing! Starting gem5! ------------" | tee -a $SCRIPT_OUT
+echo "" | tee -a $SCRIPT_OUT
+echo "" | tee -a $SCRIPT_OUT
+
+# Actually launch gem5!
+$GEM5_PATH/build/X86_MESI_Two_Level/gem5.fast \
+ --outdir=$CKPT_OUT_DIR $GEM5_PATH/configs/example/spec06_config.py \
+ --benchmark=$BENCHMARK --benchmark_stdout=$CKPT_OUT_DIR/$BENCHMARK.out \
+ --benchmark_stderr=$CKPT_OUT_DIR/$BENCHMARK.err \
+ --num-cpus=1 --mem-size=4GB \
+ --take-checkpoints=10000000000 --at-instruction
+