implement benchmark selection code
authorAli Saidi <saidi@eecs.umich.edu>
Tue, 15 Aug 2006 23:12:19 +0000 (19:12 -0400)
committerAli Saidi <saidi@eecs.umich.edu>
Tue, 15 Aug 2006 23:12:19 +0000 (19:12 -0400)
--HG--
extra : convert_revision : 84632fdad7019e177e61c56ae30ea2f3fdbc0995

configs/common/Benchmarks.py [new file with mode: 0644]
configs/common/FSConfig.py
configs/test/fs.py

diff --git a/configs/common/Benchmarks.py b/configs/common/Benchmarks.py
new file mode 100644 (file)
index 0000000..2993efa
--- /dev/null
@@ -0,0 +1,103 @@
+# Copyright (c) 2006 The Regents of The University of Michigan
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met: redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer;
+# redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution;
+# neither the name of the copyright holders nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# Authors: Ali Saidi
+
+from SysPaths import *
+
+class Machine:
+    def __init__(self, script=None, mem=None, disk=None):
+        self.scriptname = script
+        self.diskname = disk
+        self.memsize = mem
+
+    def script(self):
+        if self.scriptname:
+            return script(self.scriptname)
+        else:
+            return ''
+
+    def mem(self):
+        if self.memsize:
+            return self.memsize
+        else:
+            return '128MB'
+
+    def disk(self):
+        if self.diskname:
+            return disk(self.diskname)
+        else:
+            return env.get('LINUX_IMAGE', disk('linux-latest.img'))
+
+#Benchmarks are defined as a key in a dict which is a list of Machines
+# The first defined machine is the test system, the others are driving systems
+# Currently there is only support for 1 or 2 machines
+
+Benchmarks = {}
+Benchmarks['PovrayBench']       = [Machine('povray-bench.rcS', '512MB', 'povray.img')]
+Benchmarks['PovrayAutumn']      = [Machine('povray-autumn.rcS', '512MB', 'povray.img')]
+Benchmarks['NetperfStream']     = [Machine('netperf-stream-client.rcS'),
+                                   Machine('netperf-server.rcS')]
+Benchmarks['NetperfStreamNT']   = [Machine('netperf-stream-nt-client.rcS'),
+                                   Machine('netperf-server.rcS')]
+Benchmarks['NetperfMaerts']     = [Machine('netperf-maerts-client.rcS'),
+                                   Machine('netperf-server.rcS')]
+Benchmarks['SurgeStandard']     = [Machine('surge-server.rcS', '512MB'),
+                                   Machine('surge-client.rcS', '256MB')]
+Benchmarks['SurgeSpecweb']      = [Machine('spec-surge-server.rcS', '512MB'),
+                                   Machine('spec-surge-client.rcS', '256MB')]
+Benchmarks['Nhfsstone']         = [Machine('nfs-server-nhfsstone.rcS', '512MB'),
+                                   Machine('nfs-client-nhfsstone.rcS')]
+Benchmarks['Nfs']               = [Machine('nfs-server.rcS', '900MB'),
+                                   Machine('nfs-client-dbench.rcS')]
+Benchmarks['NfsTcp']            = [Machine('nfs-server.rcS', '900MB'),
+                                   Machine('nfs-client-tcp.rcS')]
+Benchmarks['IScsiInitiator']    = [Machine('iscsi-client.rcS', '512MB'),
+                                   Machine('iscsi-server.rcS', '512MB')]
+Benchmarks['IScsiTarget']       = [Machine('iscsi-server.rcS', '512MB'),
+                                   Machine('iscsi-client.rcS', '512MB')]
+Benchmarks['Validation']        = [Machine('iscsi-server.rcS', '512MB'),
+                                   Machine('iscsi-client.rcS', '512MB')]
+Benchmarks['Ping']              = [Machine('ping-server.rcS',),
+                                   Machine('ping-client.rcS')]
+
+
+Benchmarks['ValAccDelay']      = [Machine('devtime.rcS', '512MB')]
+Benchmarks['ValAccDelay2']     = [Machine('devtimewmr.rcS', '512MB')]
+Benchmarks['ValMemLat']         = [Machine('micro_memlat.rcS', '512MB')]
+Benchmarks['ValMemLat2MB']     = [Machine('micro_memlat2mb.rcS', '512MB')]
+Benchmarks['ValMemLat8MB']     = [Machine('micro_memlat8mb.rcS', '512MB')]
+Benchmarks['ValMemLat']         = [Machine('micro_memlat8.rcS', '512MB')]
+Benchmarks['ValTlbLat']         = [Machine('micro_tlblat.rcS', '512MB')]
+Benchmarks['ValSysLat']         = [Machine('micro_syscall.rcS', '512MB')]
+Benchmarks['ValCtxLat']         = [Machine('micro_ctx.rcS', '512MB')]
+Benchmarks['ValStream']         = [Machine('micro_stream.rcS', '512MB')]
+Benchmarks['ValStreamScale']   = [Machine('micro_streamscale.rcS', '512MB')]
+Benchmarks['ValStreamCopy']    = [Machine('micro_streamcopy.rcS', '512MB')]
+
+benchs = Benchmarks.keys()
+benchs.sort()
+DefinedBenchmarks = ", ".join(benchs)
index d17a354af390f7f9b996a012853f37f5be59dbff..c6ad8ce484af021f07f4b186bcaa10ac9a4b9570 100644 (file)
 import m5
 from m5 import makeList
 from m5.objects import *
+from Benchmarks import *
 from FullO3Config import *
-from SysPaths import *
 from Util import *
 
-script.dir =  '/z/saidi/work/m5.newmem/configs/boot'
-linux_image = env.get('LINUX_IMAGE', disk('linux-latest.img'))
-
 class CowIdeDisk(IdeDisk):
     image = CowDiskImage(child=RawDiskImage(read_only=True),
                          read_only=False)
@@ -50,18 +47,19 @@ class BaseTsunami(Tsunami):
     ide = IdeController(disks=[Parent.disk0, Parent.disk2],
                         pci_func=0, pci_dev=0, pci_bus=0)
 
-def makeLinuxAlphaSystem(cpu, mem_mode, linux_image, icache=None, dcache=None, l2cache=None):
+def makeLinuxAlphaSystem(cpu, mem_mode, mdesc, icache=None, dcache=None, l2cache=None):
     self = LinuxAlphaSystem()
+    self.readfile = mdesc.script()
     self.iobus = Bus(bus_id=0)
     self.membus = Bus(bus_id=1)
     self.bridge = Bridge()
-    self.physmem = PhysicalMemory(range = AddrRange('128MB'))
+    self.physmem = PhysicalMemory(range = AddrRange(mdesc.mem()))
     self.bridge.side_a = self.iobus.port
     self.bridge.side_b = self.membus.port
     self.physmem.port = self.membus.port
     self.disk0 = CowIdeDisk(driveID='master')
     self.disk2 = CowIdeDisk(driveID='master')
-    self.disk0.childImage(linux_image)
+    self.disk0.childImage(mdesc.disk())
     self.disk2.childImage(disk('linux-bigswap2.img'))
     self.tsunami = BaseTsunami()
     self.tsunami.attachIO(self.iobus)
@@ -71,7 +69,7 @@ def makeLinuxAlphaSystem(cpu, mem_mode, linux_image, icache=None, dcache=None, l
     self.tsunami.ethernet.pio = self.iobus.port
     self.tsunami.ethernet.dma = self.iobus.port
     self.tsunami.ethernet.config = self.iobus.port
-    self.simple_disk = SimpleDisk(disk=RawDiskImage(image_file = linux_image,
+    self.simple_disk = SimpleDisk(disk=RawDiskImage(image_file = mdesc.disk(),
                                                read_only = True))
     self.intrctrl = IntrControl()
     self.cpu = cpu
@@ -89,14 +87,14 @@ def makeLinuxAlphaSystem(cpu, mem_mode, linux_image, icache=None, dcache=None, l
 
     return self
 
-def makeDualRoot(clientSystem, serverSystem):
+def makeDualRoot(testSystem, driveSystem):
     self = Root()
-    self.client = clientSystem
-    self.server = serverSystem
+    self.testsys = testSystem
+    self.drivesys = driveSystem
 
     self.etherdump = EtherDump(file='ethertrace')
-    self.etherlink = EtherLink(int1 = Parent.client.tsunami.etherint[0],
-                               int2 = Parent.server.tsunami.etherint[0],
+    self.etherlink = EtherLink(int1 = Parent.testsys.tsunami.etherint[0],
+                               int2 = Parent.drivesys.tsunami.etherint[0],
                                dump = Parent.etherdump)
     self.clock = '1THz'
     return self
index 741ebfe54be5c1944022a05c813e7994a4216b83..8686cdb5b87a8812a62f7d0f97476ac0fc318706 100644 (file)
@@ -6,6 +6,7 @@ m5.AddToPath('../common')
 from FSConfig import *
 from SysPaths import *
 from Util import *
+from Benchmarks import *
 
 parser = optparse.OptionParser()
 
@@ -13,8 +14,12 @@ parser.add_option("-d", "--detailed", action="store_true")
 parser.add_option("-t", "--timing", action="store_true")
 parser.add_option("-m", "--maxtick", type="int")
 parser.add_option("--maxtime", type="float")
-parser.add_option("--dual", help="Run full system using dual systems",
-                  action="store_true")
+parser.add_option("--dual", action="store_true",
+                  help="Simulate two systems attached with an ethernet link")
+parser.add_option("-b", "--benchmark", action="store", type="string",
+                  dest="benchmark",
+                  help="Specify the benchmark to run. Available benchmarks: %s"\
+                          % DefinedBenchmarks)
 
 (options, args) = parser.parse_args()
 
@@ -35,15 +40,34 @@ else:
     cpu2 = AtomicSimpleCPU()
     mem_mode = 'atomic'
 
-if options.dual:
-    root = makeDualRoot(
-        makeLinuxAlphaSystem(cpu, mem_mode, linux_image),
-        makeLinuxAlphaSystem(cpu2, mem_mode, linux_image))
-    root.client.readfile = script('netperf-stream-nt-client.rcS')
-    root.server.readfile = script('netperf-server.rcS')
+
+if options.benchmark:
+    if options.benchmark not in Benchmarks:
+        print "Error benchmark %s has not been defined." % options.benchmark
+        print "Valid benchmarks are: %s" % DefinedBenchmarks
+        sys.exit(1)
+
+    bm = Benchmarks[options.benchmark]
+
+    if len(bm) == 2:
+        root = makeDualRoot(makeLinuxAlphaSystem(cpu, mem_mode, bm[0]),
+                            makeLinuxAlphaSystem(cpu2, mem_mode, bm[1]))
+
+    elif len(bm) == 1:
+        root = Root(clock = '1THz',
+                    system = makeLinuxAlphaSystem(cpu, mem_mode, bm[0]))
+    else:
+        print "Error I don't know how to create more than 2 systems."
+        sys.exit(1)
+
 else:
-    root = Root(clock = '1THz',
-                system = makeLinuxAlphaSystem(cpu, mem_mode, linux_image))
+    if options.dual:
+        root = makeDualRoot(
+            makeLinuxAlphaSystem(cpu, mem_mode, Machine()),
+            makeLinuxAlphaSystem(cpu2, mem_mode, Machine()))
+    else:
+        root = Root(clock = '1THz',
+                    system = makeLinuxAlphaSystem(cpu, mem_mode, Machine()))
 
 m5.instantiate(root)