def get_processes(options): """Interprets provided options and returns a list of processes""" multiprocesses = [] inputs = [] outputs = [] errouts = [] pargs = [] workloads = options.cmd.split(';') if options.input != "": inputs = options.input.split(';') if options.output != "": outputs = options.output.split(';') if options.errout != "": errouts = options.errout.split(';') if options.options != "": pargs = options.options.split(';') idx = 0 for wrkld in workloads: process = Process(pid=100 + idx) process.executable = wrkld process.cwd = os.getcwd() if options.env: with open(options.env, 'r') as f: process.env = [line.rstrip() for line in f] if len(pargs) > idx: process.cmd = [wrkld] + pargs[idx].split() else: process.cmd = [wrkld] if len(inputs) > idx: process.input = inputs[idx] if len(outputs) > idx: process.output = outputs[idx] if len(errouts) > idx: process.errout = errouts[idx] multiprocesses.append(process) idx += 1 if options.smt: assert (options.cpu_type == "DerivO3CPU") return multiprocesses, idx else: return multiprocesses, 1
def set_se_binary_workload(self, binary: AbstractResource) -> None: """Set up the system to run a specific binary. **Limitations** * Only supports single threaded applications * Dynamically linked executables are partially supported when the host ISA and the simulated ISA are the same. :param binary: The resource encapsulating the binary to be run. """ self.workload = SEWorkload.init_compatible(binary.get_local_path()) process = Process() process.cmd = [binary.get_local_path()] self.get_processor().get_cores()[0].set_workload(process)
def set_workload(self, binary: str) -> None: """Set up the system to run a specific binary. **Limitations** * Only supports single threaded applications * Dynamically linked executables are partially supported when the host ISA and the simulated ISA are the same. :param binary: The path on the *host* to the binary to run in gem5. """ self.workload = SEWorkload.init_compatible(binary) process = Process() process.cmd = [binary] self.get_processor().get_cores()[0].set_workload(process)
def makeProcess(self, **kwargs): process_args = self.makeProcessArgs(**kwargs) # figure out working directory: use m5's outdir unless # overridden by Process's cwd param cwd = process_args.get('cwd') if not cwd: from m5 import options cwd = options.outdir process_args['cwd'] = cwd if not isdir(cwd): os.makedirs(cwd) # copy input files to working directory for d in self.inputs_dir: copyfiles(d, cwd) # generate Process object from m5.objects import Process return Process(**process_args)
def makeProcess(self, **kwargs): process_args = self.makeProcessArgs(**kwargs) # figure out working directory: use m5's outdir unless # overridden by Process's cwd param cwd = process_args.get('cwd') if not cwd: from m5 import options cwd = options.outdir process_args['cwd'] = cwd if not isdir(cwd): os.makedirs(cwd) # copy all run files to current working directory os.system("cp -rf %s/* %s/." % (self.run_dir, cwd)) # generate Process object from m5.objects import Process return Process(**process_args)
#Mybench.py import m5 from m5.objects import Process m5.util.addToPath('../common') binary_dir = '/home/cc/spec2006_1/benchspec/CPU2006/' data_dir = '/home/cc/spec2006_1/benchspec/CPU2006/' #==================== #400.perlbench perlbench = Process() perlbench.executable = binary_dir + '400.perlbench/exe/perlbench_base.amd64-m64-gcc43-nn' #data=data_dir+'400.perlbench/data/ref/input/checkspam.pl' #input='-I./lib' perlbench.cmd = [perlbench.executable] + ['-I./lib', 'attrs.pl'] #perlbench.output = 'attrs.out' #401.bzip2 bzip2 = Process() bzip2.executable = binary_dir + '401.bzip2/exe/bzip2_base.amd64-m64-gcc43-nn' data = data_dir + '401.bzip2/data/ref/input/liberty.jpg' bzip2.cmd = [bzip2.executable] + [data, '30'] #bzip2.output = 'liberty.out' #==================== #403.gcc gcc = Process() gcc.executable = binary_dir + '403.gcc/exe/gcc_base.amd64-m64-gcc43-nn' data = data_dir + '403.gcc/data/ref/input/166.i' output = '166.s'
def generate_process(process_id, benchmark): # you need to change these variables. binary_dir = '/home/kyuyeonpooh/SPEC2006/SPECCPU2006_binary/' data_dir = '/home/kyuyeonpooh/SPEC2006/SPECCPU2006_input/benchspec/CPU2006/' process = Process(pid=process_id) if benchmark == 'bzip2': process.executable = binary_dir + 'bzip2/bzip2' data = binary_dir + 'bzip2/input.program' process.cmd = [process.executable] + [data, '1'] process.output = 'input.program.out' elif benchmark == 'mcf': process.executable = binary_dir + 'mcf/mcf' data = data_dir + '429.mcf/data/test/input/inp.in' process.cmd = [process.executable] + [data] process.output = 'inp.out' elif benchmark == 'soplex': process.executable = binary_dir + 'soplex/soplex' data = data_dir + '450.soplex/data/test/input/test.mps' process.cmd = [process.executable] + ['-m10000', data] process.output = 'test.out' elif benchmark == 'hmmer': process.executable = binary_dir + 'hmmer/hmmer' data = data_dir + '456.hmmer/data/test/input/bombesin.hmm' process.cmd = [process.executable] + [ '--fixed', '0', '--mean', '325', '--num', '5000', '--sd', '200', '--seed', '0', data ] process.output = 'bombesin.out' elif benchmark == 'sjeng': process.executable = binary_dir + 'sjeng/sjeng' data = data_dir + '458.sjeng/data/test/input/test.txt' process.cmd = [process.executable] + [data] process.output = 'test.out' elif benchmark == 'libquantum': process.executable = binary_dir + 'libquantum/libquantum' process.cmd = [process.executable], '33', '5' process.output = 'test.out' elif benchmark == 'lbm': process.executable = binary_dir + 'lbm/lbm' data = data_dir + '470.lbm/data/test/input/100_100_130_cf_a.of' process.cmd = [process.executable ] + ['20', 'reference.dat', '0', '1', data] process.output = 'lbm.out' else: fatal('Wrong workload name') return process
import m5 from m5.objects import Process import os #Assumes current directory is in cpu/[BENCH]/run/run*/ suffix = "_base.mytest-m64" #500.perlbench_r perlbench_r = Process() perlbench_r.executable = './perlbench_r' + suffix perlbench_r.cmd = [ perlbench_r.executable ] + '-I./lib checkspam.pl 2500 5 25 11 150 1 1 1 1'.split(' ') #502.gcc_r gcc_r = Process() gcc_r.executable = 'cpugcc_r' + suffix gcc_r.cmd = [ gcc_r.executable ] + 'gcc-pp.c -O3 -finline-limit=0 -fif-conversion -fif-conversion2 -o gcc-pp.opts-O3_-finline-limit_0_-fif-conversion_-fif-conversion2.s'.split( ' ') #503.bwaves_r bwaves_r = Process() bwaves_r.executable = 'bwaves_r' + suffix bwaves_r.cmd = [bwaves_r.executable] + '< bwaves_1.in'.split(' ') #505.mcf_r mcf_r = Process() mcf_r.executable = 'mcf_r' + suffix mcf_r.cmd = [mcf_r.executable] + 'inp.in'.split(' ')