Hi,

I want to build a heterogeneous system using gem5. I am having 2 cpus (cpuA and 
cpuB) and one workload. What I want to do first is to run the benchmark on the 
one and leave the other inactive.

My cores parapmeter are the following:

...
mainCpu.switched_out=fastfwd
mainCpu.workload = process
mainCpu.cpu_id = 0
l2cache = ARML2Cache()

secondmainCpu.switched_out=True
secondmainCpu.workload = process
secondmainCpu.cpu_id = 1

I want secondmainCpu to be inactive so I have set its switched_out to True.

for the fast-fwd I am using atomicCpus and then I am switching to the mainCpu 
and the secondmainCpu mentioned above.

# Choose the CPU to use initially.
if fastfwd:
    startCpu = funcCpu
    secondCpu =secondfuncCpu
    print "CPU configuation for fast-fwd"
else:
    startCpu = mainCpu
    secondCpu = secondmainCpu
    print "CPU for main simulation"

if fastfwd:
    exitEvent = m5.simulate()
    if exitEvent.getCause() == "all threads reached the max instruction count":
        print "Finished fast-forwarding, switching CPUs"
        m5.drain(system)
        m5.changeToTiming(system)
        m5.switchCpus([(system.mediumcpu, system.secondmainCpu),(system.cpu, 
system.mainCpu)])
        m5.resume(system)
    else:
        fatal("Error fast-forwarding: " + exitEvent.getCause())

The problem is that in the main simulation,  no matter which core I set active, 
it is like my benchmark runs only on secondmainCpu since in the stats always 
secondmainCpu.numcycles is different to zero and maincpu.numCycles is 0.

I have also added my own instruction that sets switch_out to True. So code for 
my simulation is this:

...
m5.setswitchTrue(system.secondmainCpu)
...

# Repeatedly simulate and dump stats.
numIntervals = 0
while options.max_intervals == 0 or numIntervals < options.max_intervals:
    exitEvent = m5.simulate()
    if exitEvent.getCause() == "all threads reached the max instruction count":
        print "Finished interval", numIntervals, "so dumping stats"
        m5.stats.dump()
        m5.stats.reset()
        maxInsts += options.interval_length
        system.mainCpu.setMaxInstsAllThreads(maxInsts)
        system.secondmainCpu.setMaxInstsAllThreads(maxInsts)
        numIntervals += 1
    elif exitEvent.getCause() == "target called exit":
        break
    else:
        fatal("Error simulating: " + exitEvent.getCause())

where setSwitchTrue is being used for setting switced_out to True and here is 
its code (in the base.cc):

void
BaseCPU::setswitchTrue()
{
    _switchedOut=true;
}

At first I want to run all of the intervals on the one core, without any 
switching. Just to simulate with one core active and the other one inactive, 
and then vice versa.
Any hints?

Thanks,
Ignatios

                                          
_______________________________________________
gem5-users mailing list
gem5-users@gem5.org
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users

Reply via email to