Hi,

Did you call m5.instantiate before calling m5.simulate? (I don’t see it from 
the code snippet you posted)
Kind Regards

Giacomo

From: Tran, Huy Dinh via gem5-users <gem5-users@gem5.org>
Date: Thursday, 2 November 2023 at 20:33
To: gem5-users@gem5.org <gem5-users@gem5.org>
Cc: Tran, Huy Dinh <huydinht...@ku.edu>
Subject: [gem5-users] m5.switchCpus for ARM starter_fs.py config
Hi gem5 team,

I'm currently using QPoints<https://github.com/bgodala/QPoints/> which helps 
create checkpoints for QEMU and these checkpoints can be later used for 
simulation in gem5. QPoints uses the starter_fs.py script from 
configs/example/arm/starter_fs.py which doesn't use stdlib and very old way of 
setting up the system for gem5. QPoints also uses a gem5 version that was 2 
years ago. There has been a great amount of modifications to gem5 to make it 
compatible with QEMU checkpoints.

My task is to implement switching CPUs for this starter_fs.py script which I'm 
facing a lot of issues. I tried using the SimpleSwitchableProcessor() but I 
don't know how to connect that processor to the system. I also tried to use 
m5.switchCpus() and faced an error shown here:

build/ARM/sim/simulate.cc:107: info: Entering event queue @ 9943912964000.  
Starting simulation...
switching cpus
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "build/ARM/python/m5/main.py", line 455, in main
  File "/qpoints/gem5/configs/example/arm/my_fs.py", line 309, in <module>
    main()
  File "/qpoints/gem5/configs/example/arm/my_fs.py", line 297, in main
    m5.switchCpus(root.system, switch_cpu_list)
  File "build/ARM/python/m5/simulate.py", line 280, in switchCpus
  File "build/ARM/python/m5/SimObject.py", line 1416, in __getattr__
AttributeError: object 'TimingSimpleCPU' has no attribute 'switchedOut'
  (C++ object is not yet constructed, so wrapped C++ methods are unavailable.)




Here is my code for implementing m5.switchCpus:



    switch_cpus = O3CPU(switched_out=True)
    switch_cpus_1 = TimingSimpleCPU(switched_out=False)
    switch_cpus.system = root.system
    switch_cpus_1.system = root.system
    switch_cpus.clk_domain = root.system.clk_domain
    switch_cpus_1.clk_domain = root.system.clk_domain
    switch_cpus.voltage_domain = root.system.voltage_domain
    switch_cpus_1.voltage_domain = root.system.voltage_domain

    while True:
        exit_event = m5.simulate(100000000)
        exit_cause = exit_event.getCause()
   switch_cpu_list = [(switch_cpus, switch_cpus_1) ]
   m5.switchCpus(root.system, switch_cpu_list)
        exit_event = m5.simulate(100000000)
        exit_cause = exit_event.getCause()
        break
    print(exit_event.getCause())





This old version of gem5 doesn't have stdlib for ArmBoard so implementing it in 
the simple modern way is not possible. Plus, the author of QPoints made a great 
effort to modify gem5 and the script to work with QEMU checkpoints so I feel 
like I have to use the modified starter_fs.py script that was provided.

Any guidance would be greatly appreciated!

Thanks,
Huy

IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium. Thank you.
_______________________________________________
gem5-users mailing list -- gem5-users@gem5.org
To unsubscribe send an email to gem5-users-le...@gem5.org

Reply via email to