예제 #1
0
def create_system(linux_kernel_path, disk_image_path, detailed_cpu_model):
    # create the system we are going to simulate
    system = MySystem(
        kernel=linux_kernel_path,
        disk=disk_image_path,
        num_cpus=1,  # run the benchmark in a single thread
        no_kvm=False,
        TimingCPUModel=detailed_cpu_model)

    # For workitems to work correctly
    # This will cause the simulator to exit simulation when the first work
    # item is reached and when the first work item is finished.
    system.work_begin_exit_count = 1
    system.work_end_exit_count = 1

    # 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

    return root, system
예제 #2
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()))
예제 #3
0
        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
    m5.disableAllListeners()

    # instantiate all of the objects we've created above
    m5.instantiate()

    globalStart = time.time()

    print("Running the simulation")
    print("Using cpu: {}".format(cpu))