l2_assoc = 4 # memory mem_type = "DDR4_2400_8x8" mem_channels = 2 mem_ranks = 1 mem_device_size = "1GB" # simulation at_instruction = True # Set the options simpt = CPU2006(options.binary).simpt options.sys_voltage = sys_voltage options.sys_clock = sys_clock options.cpu_clock = cpu_clock options.num_cpus = num_cpus options.cpu_type = cpu_type options.mem_size = mem_size options.cacheline_size = cache_line_size options.caches = caches options.l2cache = l2cache options.l1i_size = l1i_size options.l1i_assoc = l1i_assoc options.l1d_size = l1d_size
i, nbr_mem_ctrls, intlv_bits, intlv_size) mem_ctrl.device_size = "256MB" mem_ctrls.append(mem_ctrl) system.mem_ctrls = mem_ctrls # connect memory with membus for i in range(nbr_mem_ctrls): system.membus.master = system.mem_ctrls[i].port ### Assign processes to cpus multiprocesses = [] multiprocesses = get_processes(CPU2006("433"),nums_cpus) # set the cpu to use the process as its workload and create thread contexts for i in range(nums_cpus): system.cpu[i].workload = multiprocesses[i] system.cpu[i].createThreads() ### Start the simulation # set up the root SimObject root = Root(full_system = False, system = system) # Simulation.run(options, root, system, FutureClass)
home = os.path.expanduser("~/Research/gem5/util/") ### Upgrade checkpoints upgrade = ["python"] merge_script = f"{home}cpt_upgrader.py" upgrade.append(merge_script) args = ['-r', '-v'] upgrade.extend(args) cpt_dir = f"{Path.home()}/Research/outputs/{options.binary}" upgrade.append(cpt_dir) subprocess.run(upgrade) print("Checkpoints upgrade completed.\n") ### Merge checkpoints merge = ["python"] insts = int(1e7 * CPU2006(options.binary).simpt) script = f'{home}checkpoint_aggregator.py' merge.append(script) cpt_dir = f"{Path.home()}/Research/outputs/{options.binary}" outdir = f"{cpt_dir}/mergeCkpts4/cpt.None.{insts}" merge.extend(['-o', outdir]) ckpts = f"{cpt_dir}/cpt.None.{insts}" merge.append('--cpts') # the memory configuration is two channel for _ in range(4): merge.append(ckpts) # the memory capacity preset to 16GB in takeCkpts.py size = int(16 * pow(1024, 3)) merge.extend(['--memory-size', str(size)]) subprocess.run(merge)