sim: make Python Root object a singleton
[gem5.git] / configs / splash2 / run.py
index b162e0cc784d71daf7945f9a7626cec4849666c6..24faade17a180f7517d3acaaa99f4729e7e643e2 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (c) 2005-2006 The Regents of The University of Michigan
+# Copyright (c) 2005-2007 The Regents of The University of Michigan
 # All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
 # Splash2 Run Script
 #
 
+import os
+import optparse
+import sys
+
 import m5
 from m5.objects import *
-import os, optparse, sys
-m5.AddToPath('../common')
+
+m5.util.addToPath('../common')
 
 # --------------------
 # Define Command Line Options
@@ -48,19 +52,16 @@ parser.add_option("-n", "--numcpus",
 parser.add_option("-f", "--frequency",
                   default = "1GHz",
                   help="Frequency of each CPU")
-parser.add_option("-p", "--protocol",
-                  default="moesi",
-                  help="The coherence protocol to use for the L1'a (i.e. MOESI, MOSI)")
 parser.add_option("--l1size",
                   default = "32kB")
 parser.add_option("--l1latency",
-                  default = 1)
+                  default = "1ns")
 parser.add_option("--l2size",
                   default = "256kB")
 parser.add_option("--l2latency",
-                  default = 10)
+                  default = "10ns")
 parser.add_option("--rootdir",
-                  help="ROot directory of Splash2",
+                  help="Root directory of Splash2",
                   default="/dist/splash2/codes")
 parser.add_option("-b", "--benchmark",
                   help="Splash 2 benchmark to run")
@@ -79,59 +80,79 @@ if not options.numcpus:
 # Define Splash2 Benchmarks
 # ====================
 class Cholesky(LiveProcess):
-        executable = options.rootdir + '/kernels/cholesky/CHOLESKY'
-        cmd = 'CHOLESKY -p' + str(options.numcpus) + ' '\
-             + options.rootdir + '/kernels/cholesky/inputs/tk23.O'
+    cwd = options.rootdir + '/kernels/cholesky'
+    executable = options.rootdir + '/kernels/cholesky/CHOLESKY'
+    cmd = ['CHOLESKY', '-p' +  str(options.numcpus),
+            options.rootdir + '/kernels/cholesky/inputs/tk23.O']
 
 class FFT(LiveProcess):
-        executable = options.rootdir + '/kernels/fft/FFT'
-        cmd = 'FFT -p' + str(options.numcpus) + ' -m18'
+    cwd = options.rootdir + '/kernels/fft'
+    executable = options.rootdir + '/kernels/fft/FFT'
+    cmd = ['FFT', '-p', str(options.numcpus), '-m18']
 
 class LU_contig(LiveProcess):
-        executable = options.rootdir + '/kernels/lu/contiguous_blocks/LU'
-        cmd = 'LU -p' + str(options.numcpus)
+    executable = options.rootdir + '/kernels/lu/contiguous_blocks/LU'
+    cmd = ['LU', '-p', str(options.numcpus)]
+    cwd = options.rootdir + '/kernels/lu/contiguous_blocks'
 
 class LU_noncontig(LiveProcess):
-        executable = options.rootdir + '/kernels/lu/non_contiguous_blocks/LU'
-        cmd = 'LU -p' + str(options.numcpus)
+    executable = options.rootdir + '/kernels/lu/non_contiguous_blocks/LU'
+    cmd = ['LU', '-p', str(options.numcpus)]
+    cwd = options.rootdir + '/kernels/lu/non_contiguous_blocks'
 
 class Radix(LiveProcess):
-        executable = options.rootdir + '/kernels/radix/RADIX'
-        cmd = 'RADIX -n524288 -p' + str(options.numcpus)
+    executable = options.rootdir + '/kernels/radix/RADIX'
+    cmd = ['RADIX', '-n524288', '-p', str(options.numcpus)]
+    cwd = options.rootdir + '/kernels/radix'
 
 class Barnes(LiveProcess):
-        executable = options.rootdir + '/apps/barnes/BARNES'
-        cmd = 'BARNES'
-        input = options.rootdir + '/apps/barnes/input.p' + str(options.numcpus)
+    executable = options.rootdir + '/apps/barnes/BARNES'
+    cmd = ['BARNES']
+    input = options.rootdir + '/apps/barnes/input.p' + str(options.numcpus)
+    cwd = options.rootdir + '/apps/barnes'
 
 class FMM(LiveProcess):
-        executable = options.rootdir + '/apps/fmm/FMM'
-        cmd = 'FMM'
+    executable = options.rootdir + '/apps/fmm/FMM'
+    cmd = ['FMM']
+    if str(options.numcpus) == '1':
+        input = options.rootdir + '/apps/fmm/inputs/input.2048'
+    else:
         input = options.rootdir + '/apps/fmm/inputs/input.2048.p' + str(options.numcpus)
+    cwd = options.rootdir + '/apps/fmm'
 
 class Ocean_contig(LiveProcess):
-        executable = options.rootdir + '/apps/ocean/contiguous_partitions/OCEAN'
-        cmd = 'OCEAN -p' + str(options.numcpus)
+    executable = options.rootdir + '/apps/ocean/contiguous_partitions/OCEAN'
+    cmd = ['OCEAN', '-p', str(options.numcpus)]
+    cwd = options.rootdir + '/apps/ocean/contiguous_partitions'
 
 class Ocean_noncontig(LiveProcess):
-        executable = options.rootdir + '/apps/ocean/non_contiguous_partitions/OCEAN'
-        cmd = 'OCEAN -p' + str(options.numcpus)
+    executable = options.rootdir + '/apps/ocean/non_contiguous_partitions/OCEAN'
+    cmd = ['OCEAN', '-p', str(options.numcpus)]
+    cwd = options.rootdir + '/apps/ocean/non_contiguous_partitions'
 
 class Raytrace(LiveProcess):
-        executable = options.rootdir + '/apps/raytrace/RAYTRACE'
-        cmd = 'RAYTRACE -p' + str(options.numcpus) + ' ' \
-             + options.rootdir + 'apps/raytrace/inputs/teapot.env'
+    executable = options.rootdir + '/apps/raytrace/RAYTRACE'
+    cmd = ['RAYTRACE', '-p' + str(options.numcpus),
+           options.rootdir + '/apps/raytrace/inputs/teapot.env']
+    cwd = options.rootdir + '/apps/raytrace'
 
 class Water_nsquared(LiveProcess):
-        executable = options.rootdir + '/apps/water-nsquared/WATER-NSQUARED'
-        cmd = 'WATER-NSQUARED'
+    executable = options.rootdir + '/apps/water-nsquared/WATER-NSQUARED'
+    cmd = ['WATER-NSQUARED']
+    if options.numcpus==1:
+        input = options.rootdir + '/apps/water-nsquared/input'
+    else:
         input = options.rootdir + '/apps/water-nsquared/input.p' + str(options.numcpus)
+    cwd = options.rootdir + '/apps/water-nsquared'
 
 class Water_spatial(LiveProcess):
-        executable = options.rootdir + '/apps/water-spatial/WATER-SPATIAL'
-        cmd = 'WATER-SPATIAL'
+    executable = options.rootdir + '/apps/water-spatial/WATER-SPATIAL'
+    cmd = ['WATER-SPATIAL']
+    if options.numcpus==1:
+        input = options.rootdir + '/apps/water-spatial/input'
+    else:
         input = options.rootdir + '/apps/water-spatial/input.p' + str(options.numcpus)
-
+    cwd = options.rootdir + '/apps/water-spatial'
 
 # --------------------
 # Base L1 Cache Definition
@@ -142,7 +163,6 @@ class L1(BaseCache):
     block_size = 64
     mshrs = 12
     tgts_per_mshr = 8
-    protocol = CoherenceProtocol(protocol=options.protocol)
 
 # ----------------------
 # Base L2 Cache Definition
@@ -236,10 +256,10 @@ elif options.benchmark == 'WaterNSquared':
 elif options.benchmark == 'WaterSpatial':
     root.workload = Water_spatial()
 else:
-    panic("The --benchmark environment variable was set to something" \
-          +" improper.\nUse Cholesky, FFT, LUContig, LUNoncontig, Radix" \
-          +", Barnes, FMM, OceanContig,\nOceanNoncontig, Raytrace," \
-          +" WaterNSquared, or WaterSpatial\n")
+    print >> sys.stderr, """The --benchmark environment variable was set to something improper.
+Use Cholesky, FFT, LUContig, LUNoncontig, Radix, Barnes, FMM, OceanContig,
+OceanNoncontig, Raytrace, WaterNSquared, or WaterSpatial"""
+    sys.exit(1)
 
 # --------------------
 # Assign the workload to the cpus
@@ -256,7 +276,7 @@ if options.timing or options.detailed:
     root.system.mem_mode = 'timing'
 
 # instantiate configuration
-m5.instantiate(root)
+m5.instantiate()
 
 # simulate until program terminates
 if options.maxtick: