Gem5: No workload specified

140 views Asked by At

I am having some trouble running the simulation in gem5. I keep getting

no workload specified

# Set the workload and benchmark
    process = Process()
    process.cmd = ['gzip', '-k', 'test.txt']
    system.cpu.workload = process
    system.cpu.createThreads()
# Set the workload
    print("set workload")
    m5.command_line.set_workload('mcf')
    print("workload Set")

I tried to print the workload portion but received the same error

# Set the workload
    print("set workload")
    m5.command_line.set_workload('mcf')
    print("workload Set")
1

There are 1 answers

0
Prefetcher Shatnawi On

If none of the below code works with you, leave a comment and I will share more a complete gem5 project to run SPEC17 and SEC06 besides executable bins.

Here is an example to run one of the SEC17 benchmarks:

bwaves_s = Process()
bwaves_s_dir = '603.bwaves_s/'
bwaves_s_run_dir = bwaves_s_dir + refspeed_run_dir
bwaves_s.executable = bench_dir + bwaves_s_run_dir + 'speed_bwaves' + 
exe_suffix
bwaves_s_data = 'bwaves_1.in'
bwaves_s.cmd = [bwaves_s.executable]
bwaves_s.output = 'bwaves_s.out'
bwaves_s.input = bench_dir + bwaves_s_run_dir + bwaves_s_data
system.cpu[0].workload = spec_process "OR"  system.cpu.workload = 
spec_process

Another example to run a binary

from gem5.components.boards.simple_board import SimpleBoard
from gem5.components.memory.single_channel import SingleChannelDDR3_1600
from gem5.components.processors.simple_processor import SimpleProcessor
from gem5.components.processors.cpu_types import CPUTypes
from gem5.resources.resource import CustomResource
from gem5.simulate.simulator import Simulator

from unique_cache_hierarchy.unique_cache_hierarchy_complete import UniqueCacheHierarchy

Obtain the components.

cache_hierarchy = UniqueCacheHierarchy()

memory = SingleChannelDDR3_1600("1GiB")
processor = SimpleProcessor(cpu_type=CPUTypes.ATOMIC, num_cores=1)

Add them to the board.

board = SimpleBoard(
    clk_freq="3GHz", processor=processor, memory=memory, cache_hierarchy=cache_hierarchy
)

Set the workload.

binary = CustomResource(
    "materials/using-gem5/02-stdlib/m5-exit-example/m5-exit-example"
)

board.set_se_binary_workload(binary)

Setup the Simulator and run the simulation.

simulator = Simulator(board=board)
simulator.run()