Swapnil Haria has uploaded this change for review. ( https://gem5-review.googlesource.com/5586

Change subject: Swapnils simulation config
......................................................................

Swapnils simulation config

Change-Id: I4c627d594eb55ebbbef389b49b28687527f2b67e
---
M configs/boot/atlas-queue-nvm.rcS
M configs/boot/atlas-queue.rcS
M configs/common/FSConfig.py
M configs/common/Options.py
M configs/common/Simulation.py
M configs/example/fs.py
M run-queue.sh
7 files changed, 148 insertions(+), 10 deletions(-)



diff --git a/configs/boot/atlas-queue-nvm.rcS b/configs/boot/atlas-queue-nvm.rcS
index cafac52..2e6a0b9 100644
--- a/configs/boot/atlas-queue-nvm.rcS
+++ b/configs/boot/atlas-queue-nvm.rcS
@@ -1,10 +1,9 @@
 #!/bin/sh
 echo "Hello World"
-#/sbin/m5 checkpoint # To change CPUs
+/sbin/m5 checkpoint # To change CPUs
 cd /home/swapnilh/atlas/runtime/build/tests/data_structures/
 ./queue_nvm
 sync
-sleep 5
 print 'DONE'
 print 'OKAY BYE NOW'
 /sbin/m5 exit
diff --git a/configs/boot/atlas-queue.rcS b/configs/boot/atlas-queue.rcS
index e710254..9557115 100644
--- a/configs/boot/atlas-queue.rcS
+++ b/configs/boot/atlas-queue.rcS
@@ -4,4 +4,6 @@
 cd /home/swapnilh/atlas/runtime/build/tests/data_structures/
 ./queue
 sync
+print 'DONE'
+print 'OKAY BYE NOW'
 /sbin/m5 exit
diff --git a/configs/common/FSConfig.py b/configs/common/FSConfig.py
index c08353a..8e49368 100644
--- a/configs/common/FSConfig.py
+++ b/configs/common/FSConfig.py
@@ -556,7 +556,8 @@
     disk0 = CowIdeDisk(driveID='master')
     disk2 = CowIdeDisk(driveID='master')
     disk0.childImage(mdesc.disk())
-    disk2.childImage(disk('linux-bigswap2.img'))
+    disk2.childImage(disk('/p/multifacet/users/swapnilh/disk_images/' +\
+                            'linux-bigswap2.img'))
     self.pc.south_bridge.ide.disks = [disk0, disk2]

     # Add in a Bios information structure.
@@ -674,7 +675,7 @@
     if not cmdline:
cmdline = 'earlyprintk=ttyS0 console=ttyS0 lpj=7999923 root=/dev/hda1'
     self.boot_osflags = fillInCmdline(mdesc, cmdline)
-    self.kernel = binary('x86_64-vmlinux-2.6.22.9')
+ self.kernel = binary('/nobackup/swapnilh/pm-studies/gem5/vmlinux-4.14-rc6')
     return self


diff --git a/configs/common/Options.py b/configs/common/Options.py
index ea7c75b..3b22dfd 100644
--- a/configs/common/Options.py
+++ b/configs/common/Options.py
@@ -315,6 +315,8 @@
     # Simulation options
     parser.add_option("--timesync", action="store_true",
             help="Prevent simulated time from getting ahead of real time")
+    parser.add_option("--swapnil", action="store_true",
+ help="Run simulation and switching as per Swapnil's configuration")

     # System options
     parser.add_option("--kernel", action="store", type="string")
diff --git a/configs/common/Simulation.py b/configs/common/Simulation.py
index c4d5c96..74d8f0d 100644
--- a/configs/common/Simulation.py
+++ b/configs/common/Simulation.py
@@ -421,6 +421,117 @@
             exit_event = m5.simulate(maxtick - m5.curTick())
             return exit_event

+# Restores using timingSimpleCPU till work_begin
+# Then warms up with timingSimpleCPu for X instructions/cycles
+# Runs with detailedO3 till work_end
+def run_swapnil(options, root, testsys, cpu_class):
+    if options.checkpoint_dir:
+        cptdir = options.checkpoint_dir
+    elif m5.options.outdir:
+        cptdir = m5.options.outdir
+    else:
+        cptdir = getcwd()
+
+    np = options.num_cpus
+    switch_cpus = None
+
+    timingCpus = [TimingSimpleCPU(switched_out=True, cpu_id=(i))
+                   for i in xrange(np)]
+    detailedCpus = [DerivO3CPU(switched_out=True, cpu_id=(i))
+                       for i in xrange(np)]
+    for i in xrange(np):
+        timingCpus[i].system = testsys
+        timingCpus[i].workload = testsys.cpu[i].workload
+        timingCpus[i].clk_domain = testsys.cpu[i].clk_domain
+        detailedCpus[i].system = testsys
+        detailedCpus[i].workload = testsys.cpu[i].workload
+        detailedCpus[i].clk_domain = testsys.cpu[i].clk_domain
+        # warmup period
+        testsys.cpu[i].max_insts_any_thread = 10000000 # TODO FIXME
+
+    testsys.timingCpus = timingCpus
+    testsys.detailedCpus = detailedCpus
+
+    checkpoint_dir = None
+    cpt_starttick, checkpoint_dir = findCptDir(options, cptdir, testsys)
+    m5.instantiate(checkpoint_dir)
+
+    # Handle the max tick settings now that tick frequency was resolved
+    # during system instantiation
+    # NOTE: the maxtick variable here is in absolute ticks, so it must
+    # include any simulated ticks before a checkpoint
+    explicit_maxticks = 0
+    maxtick_from_abs = m5.MaxTick
+    maxtick_from_rel = m5.MaxTick
+    maxtick_from_maxtime = m5.MaxTick
+ maxtick = min([maxtick_from_abs, maxtick_from_rel, maxtick_from_maxtime])
+
+    if options.checkpoint_restore != None and maxtick < cpt_starttick:
+        fatal("Bad maxtick (%d) specified: " \
+ "Checkpoint starts starts from tick: %d", maxtick, cpt_starttick)
+
+    # Simulating with what CPU?
+
+    print "Beginning simulation!"
+
+    # While there is still something to do in the guest keep executing.
+    # This is needed since we exit for the ROI begin/end
+    foundROI = False
+    warmup = False
+    end_tick = 0
+    start_tick = 0
+    exit_event = m5.simulate()
+
+    print "Restore using timingSimpleCpus"
+    testsys.mem_mode = 'timing'
+    m5.switchCpus(testsys, zip(testsys.cpu, timingCpus))
+    while exit_event.getCause() != "m5_exit instruction encountered":
+        print "Exited because", exit_event.getCause()
+ # 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
+        elif exit_event.getCause() == "exiting with last active thread" +\
+                                      " context":
+            if not foundROI:
+                print "Program exited prematurely"
+                import sys
+                sys.exit()
+            else:
+                break
+
+        if exit_event.getCause() == "work started count reach"\
+            or exit_event.getCause() == "checkpoint":
+            print "ROI found"
+            print "Warmup begins!"
+            testsys.mem_mode = 'timing'
+            m5.memWriteback(testsys)
+            m5.memInvalidate(testsys)
+            m5.stats.reset()
+            foundROI = True
+            warmup = True
+        elif exit_event.getCause() == "work items exit count reached":
+            os.remove(os.path.join(m5.options.outdir, 'running.txt'))
+            end_tick = m5.curTick()
+            break
+ elif exit_event.getCause() == "simulate() limit reached" and warmup:
+            print "Warmup Complete!"
+            print "Actual Simulation Begins"
+            print "Switching to derivO3 CPUS @ tick %s" % (m5.curTick())
+            m5.switchCpus(testsys, zip(testsys.cpu, detailedCpus))
+            start_tick = m5.curTick()
+            m5.stats.reset()
+            warmup = False
+        elif exit_event.getCause() == "simulate() limit reached":
+            os.remove(os.path.join(m5.options.outdir, 'running.txt'))
+            end_tick = m5.curTick()
+            break
+
+        print "Continuing after", exit_event.getCause()
+        exit_event = m5.simulate()
+
+    print "ROI:", end_tick - start_tick, "ticks"
+
 def run(options, root, testsys, cpu_class):
     if options.checkpoint_dir:
         cptdir = options.checkpoint_dir
@@ -706,3 +817,5 @@

     if not m5.options.interactive:
         sys.exit(exit_event.getCode())
+
+
diff --git a/configs/example/fs.py b/configs/example/fs.py
index 6507937..75db478 100644
--- a/configs/example/fs.py
+++ b/configs/example/fs.py
@@ -148,10 +148,10 @@

     if options.ruby:
# Check for timing mode because ruby does not support atomic accesses
-        if not (options.cpu_type == "DerivO3CPU" or
-                options.cpu_type == "TimingSimpleCPU"):
-            print >> sys.stderr, "Ruby requires TimingSimpleCPU or O3CPU!!"
-            sys.exit(1)
+#        if not (options.cpu_type == "DerivO3CPU" or
+#                options.cpu_type == "TimingSimpleCPU"):
+# print >> sys.stderr, "Ruby requires TimingSimpleCPU or O3CPU!!"
+#            sys.exit(1)

         Ruby.create_system(options, True, test_sys, test_sys.iobus,
                            test_sys._dma_ports)
@@ -369,4 +369,7 @@
     VncServer.frame_capture = True

 Simulation.setWorkCountOptions(test_sys, options)
-Simulation.run(options, root, test_sys, FutureClass)
+if options.swapnil:
+    Simulation.run_swapnil(options, root, test_sys, FutureClass)
+else:
+    Simulation.run(options, root, test_sys, FutureClass)
diff --git a/run-queue.sh b/run-queue.sh
index 7115881..c2cb64c 100644
--- a/run-queue.sh
+++ b/run-queue.sh
@@ -1,3 +1,21 @@
+#Create Checkpoint for nvm-aware queue
+./build/X86_FLUSHOPT/gem5.opt -d logs/clflushopt_atlas_queue_nvm_ckpt configs/example/fs.py --disk-image=/nobackup/swapnilh/pm-studies/gem5/ubuntu.img --cpu-type=X86KvmCPU --mem-size=8GB --script=configs/boot/atlas-queue-nvm.rcS &
+
+#Create Checkpoint for non nvm-aware queue
+./build/X86_FLUSHOPT/gem5.opt -d logs/clflushopt_atlas_queue_ckpt configs/example/fs.py --disk-image=/nobackup/swapnilh/pm-studies/gem5/ubuntu.img --cpu-type=X86KvmCPU --mem-size=8GB --script=configs/boot/atlas-queue.rcS &
+
+wait
+
+#Run using CLFLUSHOPT, CLWB, and NO FLUSH
+./build/X86_FLUSHOPT/gem5.opt -d logs/clflushopt_atlas_queue configs/example/fs.py --disk-image=/nobackup/swapnilh/pm-studies/gem5/ubuntu.img --cpu-type=TimingSimpleCPU --restore-with-cpu=TimingSimpleCPU --checkpoint-dir=logs/clflushopt_atlas_queue_nvm_ckpt -r 1 --mem-size=8GB --caches --ruby & +./build/X86_CLWB/gem5.opt -d logs/clwb_atlas_queue configs/example/fs.py --disk-image=/nobackup/swapnilh/pm-studies/gem5/ubuntu.img --cpu-type=TimingSimpleCPU --restore-with-cpu=TimingSimpleCPU --checkpoint-dir=logs/clflushopt_atlas_queue_nvm_ckpt -r 1 --mem-size=8GB --caches --ruby & +./build/X86/gem5.opt -d logs/noflush_atlas_queue configs/example/fs.py --disk-image=/nobackup/swapnilh/pm-studies/gem5/ubuntu.img --cpu-type=TimingSimpleCPU --restore-with-cpu=TimingSimpleCPU --checkpoint-dir=logs/clflushopt_atlas_queue_nvm_ckpt -r 1 --mem-size=8GB --caches --ruby &
+
+# Run no flush using non nvm-aware queue
+./build/X86/gem5.opt -d logs/noflush_baseline_atlas_queue configs/example/fs.py --disk-image=/nobackup/swapnilh/pm-studies/gem5/ubuntu.img --cpu-type=TimingSimpleCPU --restore-with-cpu=TimingSimpleCPU --checkpoint-dir=logs/clflushopt_atlas_queue_ckpt -r 1 --mem-size=8GB --caches --ruby &
+
+#./build/X86_FLUSHOPT/gem5.opt -d clflushopt_atlas_queue_nvm configs/system/run-cpu-fs.py --script=configs/boot/atlas-queue-nvm.rcS +#./build/X86/gem5.opt -d base_atlas_queue_nvm configs/system/run-cpu-fs.py --script=configs/boot/atlas-queue-nvm.rcS #./build/X86_FLUSHOPT/gem5.opt -d clflushopt_atlas_queue configs/system/run-cpu-fs.py --script=configs/boot/atlas-queue.rcS -./build/X86_FLUSHOPT/gem5.opt -d clflushopt_atlas_queue_nvm configs/system/run-cpu-fs.py --script=configs/boot/atlas-queue-nvm.rcS #./build/X86_CLWB/gem5.opt -d clwb_atlas_queue_nvm configs/system/run-cpu-fs.py --script=configs/boot/atlas-queue-nvm.rcS
+

--
To view, visit https://gem5-review.googlesource.com/5586
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4c627d594eb55ebbbef389b49b28687527f2b67e
Gerrit-Change-Number: 5586
Gerrit-PatchSet: 1
Gerrit-Owner: Swapnil Haria <[email protected]>
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to