Single-core multi-thread simulation in gem5 SE mode with O3CPU #1959
-
Is there a way to run the Specifically, I want to only use a single O3CPU core, but want to spawn 4 threads in that core. I may be doing something wrong, but from this line in the unsigned cpus = thread::hardware_concurrency(); the value of Here is my configuration file, which is a slightly modified version from import m5
from m5.objects import *
system = System()
system.clk_domain = SrcClockDomain()
system.clk_domain.clock = "1GHz"
system.clk_domain.voltage_domain = VoltageDomain()
system.mem_mode = "timing"
system.mem_ranges = [AddrRange("16384MiB")]
system.cpu = X86O3CPU() # modified to use O3CPU
system.membus = SystemXBar()
system.cpu.icache_port = system.membus.cpu_side_ports
system.cpu.dcache_port = system.membus.cpu_side_ports
system.cpu.createInterruptController()
system.cpu.interrupts[0].pio = system.membus.mem_side_ports
system.cpu.interrupts[0].int_requestor = system.membus.cpu_side_ports
system.cpu.interrupts[0].int_responder = system.membus.mem_side_ports
system.mem_ctrl = MemCtrl()
system.mem_ctrl.dram = DDR3_1600_8x8()
system.mem_ctrl.dram.range = system.mem_ranges[0]
system.mem_ctrl.port = system.membus.mem_side_ports
system.system_port = system.membus.cpu_side_ports
binary = "threads" # the threads binary, compiled for X86 architecture
system.workload = SEWorkload.init_compatible(binary)
process = Process()
process.cmd = [binary]
system.cpu.workload = process
system.cpu.createThreads()
root = Root(full_system=False, system=system)
m5.instantiate()
print(f"Beginning simulation!")
exit_event = m5.simulate()
print(f"Exiting @ tick {m5.curTick()} because {exit_event.getCause()}") With the original
If I change the number of threads to 4, by setting
Is there a guide or some reference that I can use to run multi-threaded simulations? Thanks in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
The simple answer is "no". There is no operating system to do context switches in SE mode, so there's no way to "overcommit" the number of threads on a smaller number of cores. If you want to do this, you need to run a full OS. Edit: Let me add that you need to have |
Beta Was this translation helpful? Give feedback.
The simple answer is "no". There is no operating system to do context switches in SE mode, so there's no way to "overcommit" the number of threads on a smaller number of cores. If you want to do this, you need to run a full OS.
Edit: Let me add that you need to have
nthreads + 1
cores to get OpenMP to work since OpenMP uses a fork-join parallel model.