예제 #1
0
def runFullSystem():
    (opts, args) = SimpleOpts.parse_args()
    kernel, disk, cpu, benchmark, num_cpus = args

    # Don't init GPU stuff in Ruby if no GPU is specified
    if opts.dgpu or opts.apu:
        opts.cpu_only_mode = False
    else:
        opts.cpu_only_mode = True

    # create the system we are going to simulate
    system = MySystem(kernel, disk, int(num_cpus), opts, no_kvm=False)

    # Exit from guest on workbegin/workend
    system.exit_on_work_items = True

    # Set up the root SimObject and start the simulation
    root = Root(full_system=True, system=system)

    if system.getHostParallel():
        # Required for running kvm on multiple host cores.
        # Uses gem5's parallel event queue feature
        # Note: The simulator is quite picky about this number!
        root.sim_quantum = int(1e9)  # 1 ms

    # Instantiate all of the objects
    if opts.checkpoint_restore:
        m5.instantiate(opts.checkpoint_dir)
    else:
        m5.instantiate()

    globalStart = time.time()

    print("Running the simulation")
    print("Using cpu: {}".format(cpu))
    exit_event = m5.simulate(opts.abs_max_tick)

    # While there is still something to do in the guest keep executing.
    while exit_event.getCause() != "m5_exit instruction encountered":
        # If the user pressed ctrl-c on the host, then we really should exit
        if exit_event.getCause() == "user interrupt received":
            print("User interrupt. Exiting")
            break

        if exit_event.getCause() == "simulate() limit reached":
            break
        elif "checkpoint" in exit_event.getCause():
            m5.checkpoint(opts.checkpoint_dir)
            break
        elif "switchcpu" in exit_event.getCause():
            system.switchCpus(system.cpu, system.warmupCpu)
        else:
            break

    print('Exiting @ tick %i because %s' %
          (m5.curTick(), exit_event.getCause()))
예제 #2
0
    bench_file.write('sleep 5 \n')
    bench_file.write('m5 exit \n')
    bench_file.close()
    return file_name
if __name__ == "__m5_main__":
    (opts, args) = SimpleOpts.parse_args()
    kernel, disk, cpu, benchmark, size, num_cpus = args

    if not cpu in ['timing', 'kvm']:
        m5.fatal("cpu not supported")

    # create the system we are going to simulate
    system = MySystem(kernel, disk, int(num_cpus), opts, no_kvm=False)

    # Exit from guest on workbegin/workend
    system.exit_on_work_items = True

    # Create and pass a script to the simulated system to run the reuired
    # benchmark
    system.readfile = writeBenchScript(m5.options.outdir, benchmark, size)

    # set up the root SimObject and start the simulation
    root = Root(full_system = True, system = system)

    if system.getHostParallel():
        # Required for running kvm on multiple host cores.
        # Uses gem5's parallel event queue feature
        # Note: The simulator is quite picky about this number!
        root.sim_quantum = int(1e9) # 1 ms

    #needed for long running jobs