diff options
-rw-r--r-- | arch/alpha/isa_desc | 4 | ||||
-rw-r--r-- | base/random.cc | 26 | ||||
-rw-r--r-- | base/random.hh | 26 | ||||
-rw-r--r-- | base/stats/mysql.cc | 3 | ||||
-rw-r--r-- | build/SConstruct | 12 | ||||
-rw-r--r-- | dev/etherlink.cc | 20 | ||||
-rw-r--r-- | dev/etherlink.hh | 5 | ||||
-rw-r--r-- | python/m5/config.py | 103 | ||||
-rw-r--r-- | python/m5/convert.py | 22 | ||||
-rw-r--r-- | python/m5/objects/Ethernet.py | 1 | ||||
-rw-r--r-- | sim/stat_control.cc | 6 | ||||
-rwxr-xr-x | test/genini.py | 3 | ||||
-rwxr-xr-x | util/pbs/pbs.py | 2 | ||||
-rwxr-xr-x | util/pbs/send.py | 9 | ||||
-rwxr-xr-x | util/qdo | 2 | ||||
-rwxr-xr-x | util/stats/stats.py | 4 |
16 files changed, 166 insertions, 82 deletions
diff --git a/arch/alpha/isa_desc b/arch/alpha/isa_desc index e80da6091..34e86c3a7 100644 --- a/arch/alpha/isa_desc +++ b/arch/alpha/isa_desc @@ -712,7 +712,7 @@ def template FloatingPointExecute {{ Fault %(class_name)s::execute(%(CPU_exec_context)s *xc, Trace::InstRecord *traceData) const { - if (trappingMode != Imprecise) { + if (trappingMode != Imprecise && !warnedOnTrapping) { warn("%s: non-standard trapping mode not supported", generateDisassembly(0, NULL)); warnedOnTrapping = true; @@ -755,7 +755,7 @@ def template FPFixedRoundingExecute {{ Fault %(class_name)s::execute(%(CPU_exec_context)s *xc, Trace::InstRecord *traceData) const { - if (trappingMode != Imprecise) { + if (trappingMode != Imprecise && !warnedOnTrapping) { warn("%s: non-standard trapping mode not supported", generateDisassembly(0, NULL)); warnedOnTrapping = true; diff --git a/base/random.cc b/base/random.cc index a6d9da6c1..cfa94b5e3 100644 --- a/base/random.cc +++ b/base/random.cc @@ -31,6 +31,7 @@ #include "sim/param.hh" #include "base/random.hh" +#include "base/trace.hh" using namespace std; @@ -52,15 +53,32 @@ seed(¶mContext, "seed", "seed to random number generator", 1); void RandomContext::checkParams() { - ::srandom(seed); + ::srand48(seed); } long getLong() { - return random(); + return mrand48(); } +int64_t +getUniform(int64_t maxmin) +{ + double r; + r = (drand48() - 0.500) * 2 * maxmin; + return (int64_t)round(r); +} + +uint64_t +getUniformPos(uint64_t max) +{ + double r; + r = drand48() * 2 * max; + return (uint64_t)round(r); +} + + // idea for generating a double from erand48 double getDouble() @@ -70,8 +88,8 @@ getDouble() uint16_t _short[4]; }; - _long[0] = random(); - _long[1] = random(); + _long[0] = mrand48(); + _long[1] = mrand48(); return ldexp((double) _short[0], -48) + ldexp((double) _short[1], -32) + diff --git a/base/random.hh b/base/random.hh index b4d20a274..eac91a53c 100644 --- a/base/random.hh +++ b/base/random.hh @@ -33,6 +33,8 @@ long getLong(); double getDouble(); +uint64_t getUniformPos(uint64_t max); +int64_t getUniform(int64_t max); template <typename T> struct Random; @@ -41,48 +43,72 @@ template<> struct Random<int8_t> { static int8_t get() { return getLong() & (int8_t)-1; } + + static int8_t uniform(int8_t maxmin) + { return getUniform(maxmin); } }; template<> struct Random<uint8_t> { static uint8_t get() { return getLong() & (uint8_t)-1; } + + static uint8_t uniform(uint8_t max) + { return getUniformPos(max); } }; template<> struct Random<int16_t> { static int16_t get() { return getLong() & (int16_t)-1; } + + static int16_t uniform(int16_t maxmin) + { return getUniform(maxmin); } }; template<> struct Random<uint16_t> { static uint16_t get() { return getLong() & (uint16_t)-1; } + + static uint16_t uniform(uint16_t max) + { return getUniformPos(max); } }; template<> struct Random<int32_t> { static int32_t get() { return (int32_t)getLong(); } + + static int32_t uniform(int32_t maxmin) + { return getUniform(maxmin); } }; template<> struct Random<uint32_t> { static uint32_t get() { return (uint32_t)getLong(); } + + static uint32_t uniform(uint32_t max) + { return getUniformPos(max); } }; template<> struct Random<int64_t> { static int64_t get() { return (int64_t)getLong() << 32 || (uint64_t)getLong(); } + + static int64_t uniform(int64_t maxmin) + { return getUniform(maxmin); } }; template<> struct Random<uint64_t> { static uint64_t get() { return (uint64_t)getLong() << 32 || (uint64_t)getLong(); } + + static uint64_t uniform(uint64_t max) + { return getUniformPos(max); } }; template<> struct Random<float> diff --git a/base/stats/mysql.cc b/base/stats/mysql.cc index 27212b2c2..95aa53241 100644 --- a/base/stats/mysql.cc +++ b/base/stats/mysql.cc @@ -839,6 +839,7 @@ MySql::visit(const VectorData &data) void MySql::visit(const DistData &data) { + return; if (!configured) configure(data); else @@ -848,6 +849,7 @@ MySql::visit(const DistData &data) void MySql::visit(const VectorDistData &data) { + return; if (!configured) configure(data); else @@ -857,6 +859,7 @@ MySql::visit(const VectorDistData &data) void MySql::visit(const Vector2dData &data) { + return; if (!configured) configure(data); else diff --git a/build/SConstruct b/build/SConstruct index 2d5ca0057..45461b0af 100644 --- a/build/SConstruct +++ b/build/SConstruct @@ -202,10 +202,8 @@ if have_mysql: mysql_minor = int(mysql_version[1]) # This version check is probably overly conservative, but it deals # with the versions we have installed. - if mysql_major < 3 or \ - mysql_major == 3 and mysql_minor < 23 or \ - mysql_major == 4 and mysql_minor < 1: - print "Warning: MySQL v3.23 or v4.1 or newer required." + if mysql_major < 4 or (mysql_major == 4 and mysql_minor < 1): + print "Warning: MySQL v4.1 or newer required." have_mysql = False # Set up mysql_config commands. @@ -235,6 +233,9 @@ sticky_opts.AddOptions( BoolOption('SS_COMPATIBLE_FP', 'Make floating-point results compatible with SimpleScalar', False), + BoolOption('USE_SSE2', + 'Compile for SSE2 (-msse2) to get IEEE FP on x86 hosts', + False), BoolOption('STATS_BINNING', 'Bin statistics by CPU mode', have_mysql), BoolOption('USE_MYSQL', 'Use MySQL for stats output', have_mysql), BoolOption('USE_FENV', 'Use <fenv.h> IEEE mode control', have_fenv), @@ -378,6 +379,9 @@ for build_dir in build_dirs: env['CC'] = env['BATCH_CMD'] + ' ' + env['CC'] env['CXX'] = env['BATCH_CMD'] + ' ' + env['CXX'] + if env['USE_SSE2']: + env.Append(CCFLAGS='-msse2') + # The m5/SConscript file sets up the build rules in 'env' according # to the configured options. It returns a list of environments, # one for each variant build (debug, opt, etc.) diff --git a/dev/etherlink.cc b/dev/etherlink.cc index 75360f368..e0f45c3bf 100644 --- a/dev/etherlink.cc +++ b/dev/etherlink.cc @@ -35,6 +35,7 @@ #include <string> #include <vector> +#include "base/random.hh" #include "base/trace.hh" #include "dev/etherdump.hh" #include "dev/etherint.hh" @@ -48,11 +49,11 @@ using namespace std; EtherLink::EtherLink(const string &name, EtherInt *peer0, EtherInt *peer1, - double rate, Tick delay, EtherDump *dump) + double rate, Tick delay, Tick delayVar, EtherDump *dump) : SimObject(name) { - link[0] = new Link(name + ".link0", this, 0, rate, delay, dump); - link[1] = new Link(name + ".link1", this, 1, rate, delay, dump); + link[0] = new Link(name + ".link0", this, 0, rate, delay, delayVar, dump); + link[1] = new Link(name + ".link1", this, 1, rate, delay, delayVar, dump); interface[0] = new Interface(name + ".int0", link[0], link[1]); interface[1] = new Interface(name + ".int1", link[1], link[0]); @@ -80,9 +81,9 @@ EtherLink::Interface::Interface(const string &name, Link *tx, Link *rx) } EtherLink::Link::Link(const string &name, EtherLink *p, int num, - double rate, Tick delay, EtherDump *d) + double rate, Tick delay, Tick delay_var, EtherDump *d) : objName(name), parent(p), number(num), txint(NULL), rxint(NULL), - ticksPerByte(rate), linkDelay(delay), dump(d), + ticksPerByte(rate), linkDelay(delay), delayVar(delay_var), dump(d), doneEvent(this) { } @@ -159,6 +160,10 @@ EtherLink::Link::transmit(PacketPtr pkt) packet = pkt; Tick delay = (Tick)ceil(((double)pkt->length * ticksPerByte) + 1.0); + if (delayVar != 0) { + Random<Tick> var; + delay += var.uniform(delayVar); + } DPRINTF(Ethernet, "scheduling packet: delay=%d, (rate=%f)\n", delay, ticksPerByte); doneEvent.schedule(curTick + delay); @@ -270,6 +275,7 @@ BEGIN_DECLARE_SIM_OBJECT_PARAMS(EtherLink) SimObjectParam<EtherInt *> int2; Param<double> speed; Param<Tick> delay; + Param<Tick> delay_var; SimObjectParam<EtherDump *> dump; END_DECLARE_SIM_OBJECT_PARAMS(EtherLink) @@ -280,13 +286,15 @@ BEGIN_INIT_SIM_OBJECT_PARAMS(EtherLink) INIT_PARAM(int2, "interface 2"), INIT_PARAM(speed, "link speed in bits per second"), INIT_PARAM(delay, "transmit delay of packets in us"), + INIT_PARAM(delay_var, "Difference in amount of time to traverse wire"), INIT_PARAM(dump, "object to dump network packets to") END_INIT_SIM_OBJECT_PARAMS(EtherLink) CREATE_SIM_OBJECT(EtherLink) { - return new EtherLink(getInstanceName(), int1, int2, speed, delay, dump); + return new EtherLink(getInstanceName(), int1, int2, speed, delay, delay_var, + dump); } REGISTER_SIM_OBJECT("EtherLink", EtherLink) diff --git a/dev/etherlink.hh b/dev/etherlink.hh index b9e6047fc..305007d9e 100644 --- a/dev/etherlink.hh +++ b/dev/etherlink.hh @@ -66,6 +66,7 @@ class EtherLink : public SimObject double ticksPerByte; Tick linkDelay; + Tick delayVar; EtherDump *dump; protected: @@ -83,7 +84,7 @@ class EtherLink : public SimObject public: Link(const std::string &name, EtherLink *p, int num, - double rate, Tick delay, EtherDump *dump); + double rate, Tick delay, Tick delay_var, EtherDump *dump); ~Link() {} const std::string name() const { return objName; } @@ -118,7 +119,7 @@ class EtherLink : public SimObject public: EtherLink(const std::string &name, EtherInt *peer0, EtherInt *peer1, - double rate, Tick delay, EtherDump *dump); + double rate, Tick delay, Tick delayVar, EtherDump *dump); virtual ~EtherLink(); virtual void serialize(std::ostream &os); diff --git a/python/m5/config.py b/python/m5/config.py index 3c49421d3..a93fdefeb 100644 --- a/python/m5/config.py +++ b/python/m5/config.py @@ -755,7 +755,7 @@ class ParamDesc(object): class VectorParamValue(list): def ini_str(self): - return ' '.join([str(v) for v in self]) + return ' '.join([v.ini_str() for v in self]) def unproxy(self, base): return [v.unproxy(base) for v in self] @@ -825,6 +825,40 @@ VectorParam = ParamFactory(VectorParamDesc) # ##################################################################### +# superclass for "numeric" parameter values, to emulate math +# operations in a type-safe way. e.g., a Latency times an int returns +# a new Latency object. +class NumericParamValue(ParamValue): + def __str__(self): + return str(self.value) + + def __float__(self): + return float(self.value) + + # hook for bounds checking + def _check(self): + return + + def __mul__(self, other): + newobj = self.__class__(self) + newobj.value *= other + newobj._check() + return newobj + + __rmul__ = __mul__ + + def __div__(self, other): + newobj = self.__class__(self) + newobj.value /= other + newobj._check() + return newobj + + def __sub__(self, other): + newobj = self.__class__(self) + newobj.value -= other + newobj._check() + return newobj + class Range(ParamValue): type = int # default; can be overridden in subclasses def __init__(self, *args, **kwargs): @@ -891,19 +925,20 @@ class CheckedIntType(type): # class is subclassed to generate parameter classes with specific # bounds. Initialization of the min and max bounds is done in the # metaclass CheckedIntType.__init__. -class CheckedInt(long,ParamValue): +class CheckedInt(NumericParamValue): __metaclass__ = CheckedIntType - def __new__(cls, value): - if isinstance(value, str): - value = toInteger(value) - - self = long.__new__(cls, value) - - if not cls.min <= self <= cls.max: + def _check(self): + if not self.min <= self.value <= self.max: raise TypeError, 'Integer param out of bounds %d < %d < %d' % \ - (cls.min, self, cls.max) - return self + (self.min, self.value, self.max) + + def __init__(self, value): + if isinstance(value, str): + self.value = toInteger(value) + elif isinstance(value, (int, long, float)): + self.value = long(value) + self._check() class Int(CheckedInt): size = 32; unsigned = False class Unsigned(CheckedInt): size = 32; unsigned = True @@ -930,19 +965,26 @@ class Float(ParamValue, float): class MemorySize(CheckedInt): size = 64 unsigned = True - def __new__(cls, value): - return super(MemorySize, cls).__new__(cls, toMemorySize(value)) + def __init__(self, value): + if isinstance(value, MemorySize): + self.value = value.value + else: + self.value = toMemorySize(value) + self._check() class Addr(CheckedInt): size = 64 unsigned = True - def __new__(cls, value): - try: - value = long(toMemorySize(value)) - except TypeError: - value = long(value) - return super(Addr, cls).__new__(cls, value) + def __init__(self, value): + if isinstance(value, Addr): + self.value = value.value + else: + try: + self.value = toMemorySize(value) + except TypeError: + self.value = long(value) + self._check() class AddrRange(Range): type = Addr @@ -1123,29 +1165,6 @@ def tick_check(float_ticks): #raise ValueError return int_ticks -# superclass for "numeric" parameter values, to emulate math -# operations in a type-safe way. e.g., a Latency times an int returns -# a new Latency object. -class NumericParamValue(ParamValue): - def __str__(self): - return str(self.value) - - def __float__(self): - return float(self.value) - - def __mul__(self, other): - newobj = self.__class__(self) - newobj.value *= other - return newobj - - __rmul__ = __mul__ - - def __div__(self, other): - newobj = self.__class__(self) - newobj.value /= other - return newobj - - def getLatency(value): if isinstance(value, Latency) or isinstance(value, Clock): return value.value diff --git a/python/m5/convert.py b/python/m5/convert.py index 9d9f4efa7..73181e985 100644 --- a/python/m5/convert.py +++ b/python/m5/convert.py @@ -89,17 +89,9 @@ def toFloat(value): else: return float(value) -def toLong(value): - value = toFloat(value) - result = int(value) - if value != result: - raise ValueError, "cannot convert '%s' to long" % value - - return result - def toInteger(value): value = toFloat(value) - result = int(value) + result = long(value) if value != result: raise ValueError, "cannot convert '%s' to integer" % value @@ -220,16 +212,16 @@ def toMemorySize(value): raise TypeError, "wrong type '%s' should be str" % type(value) if value.endswith('PB'): - return float(value[:-2]) * pebi + return long(value[:-2]) * pebi elif value.endswith('TB'): - return float(value[:-2]) * tebi + return long(value[:-2]) * tebi elif value.endswith('GB'): - return float(value[:-2]) * gibi + return long(value[:-2]) * gibi elif value.endswith('MB'): - return float(value[:-2]) * mebi + return long(value[:-2]) * mebi elif value.endswith('kB'): - return float(value[:-2]) * kibi + return long(value[:-2]) * kibi elif value.endswith('B'): - return float(value[:-1]) + return long(value[:-1]) raise ValueError, "cannot convert '%s' to memory size" % value diff --git a/python/m5/objects/Ethernet.py b/python/m5/objects/Ethernet.py index a97e58bda..a2a8b217f 100644 --- a/python/m5/objects/Ethernet.py +++ b/python/m5/objects/Ethernet.py @@ -12,6 +12,7 @@ class EtherLink(SimObject): int1 = Param.EtherInt("interface 1") int2 = Param.EtherInt("interface 2") delay = Param.Latency('0us', "packet transmit delay") + delay_var = Param.Latency('0ns', "packet transmit delay variability") speed = Param.NetworkBandwidth('1Gbps', "link speed") dump = Param.EtherDump(NULL, "dump object") diff --git a/sim/stat_control.cc b/sim/stat_control.cc index 2f6e56b44..85c405b7f 100644 --- a/sim/stat_control.cc +++ b/sim/stat_control.cc @@ -61,6 +61,7 @@ namespace Stats { Time statTime(true); Tick startTick; +Tick lastDump(0); class SimTicksReset : public Callback { @@ -194,6 +195,11 @@ list<Output *> OutputList; void DumpNow() { + assert(lastDump <= curTick); + if (lastDump == curTick) + return; + lastDump = curTick; + list<Output *>::iterator i = OutputList.begin(); list<Output *>::iterator end = OutputList.end(); for (; i != end; ++i) { diff --git a/test/genini.py b/test/genini.py index ac789e5d6..2af81fe2b 100755 --- a/test/genini.py +++ b/test/genini.py @@ -64,8 +64,7 @@ for path in pathlist: AddToPath(path) for arg in args: - AddToPath(os.path.dirname(arg)) - execfile(arg) + m5execfile(arg, globals()) if globals().has_key('root') and isinstance(root, Root): instantiate(root) diff --git a/util/pbs/pbs.py b/util/pbs/pbs.py index 70a0c6bed..21c2cb89d 100755 --- a/util/pbs/pbs.py +++ b/util/pbs/pbs.py @@ -147,6 +147,8 @@ class qsub: flags.append('e') if len(flags): self.cmd.append('-m ' + flags) + else: + self.cmd.append('-mn') if self.name: self.cmd.append("-N%s" % self.name) diff --git a/util/pbs/send.py b/util/pbs/send.py index d04f9066b..54bba931d 100755 --- a/util/pbs/send.py +++ b/util/pbs/send.py @@ -79,6 +79,8 @@ usage = """\ Usage: %(progname)s [-c] [-e] [-f] [-j <jobfile>] [-q queue] [-v] <regexp> -c clean directory if job can be run + -C submit the checkpointing runs + -d Make jobs be dependent on the completion of the checkpoint runs -e only echo pbs command info, don't actually send the job -f force the job to run regardless of state -q <queue> submit job to the named queue @@ -96,7 +98,7 @@ Usage: try: import getopt - opts, args = getopt.getopt(sys.argv[1:], '-Ccdefhj:lq:Rt:v') + opts, args = getopt.getopt(sys.argv[1:], '-Ccdefhj:lnq:Rt:v') except getopt.GetoptError: sys.exit(usage) @@ -113,6 +115,7 @@ docpts = False doruns = True runflag = False node_type = 'FAST' +update = True for opt,arg in opts: if opt == '-C': @@ -132,6 +135,8 @@ for opt,arg in opts: jfile = arg if opt == '-l': listonly = True + if opt == '-n': + update = False if opt == '-q': queue = arg if opt == '-R': @@ -152,7 +157,7 @@ from job import JobDir, date conf = jobfile.JobFile(jfile) -if not listonly and not onlyecho and isdir(conf.linkdir): +if update and not listonly and not onlyecho and isdir(conf.linkdir): if verbose: print 'Checking for outdated files in Link directory' if not isdir(conf.basedir): @@ -99,7 +99,7 @@ class Shell(pexpect.spawn): self.expect('\$ ', options.qsub_timeout) except pexpect.TIMEOUT: print >>sys.stderr, "%s: qsub timed out." % progname - self.kill(15) + self.kill(9) self.close(wait=True) sys.exit(1) self.do_command('unset PROMPT_COMMAND; PS1="qdo$ "') diff --git a/util/stats/stats.py b/util/stats/stats.py index e481a794c..61f54dede 100755 --- a/util/stats/stats.py +++ b/util/stats/stats.py @@ -179,7 +179,7 @@ def commands(options, command, args): source.method = 'sum' def disp(*args): - print "%-20s %12s %12s %4s %5s %5s %5s %10s" % args + print "%-35s %12s %12s %4s %5s %5s %5s %10s" % args # temporary variable containing a bunch of dashes d = '-' * 100 @@ -189,7 +189,7 @@ def commands(options, command, args): print "%s:" % stat.name disp("run name", "average", "stdev", ">10%", ">1SDV", ">2SDV", "SAMP", "CV") - disp(d[:20], d[:12], d[:12], d[:4], d[:5], d[:5], d[:5], d[:10]) + disp(d[:35], d[:12], d[:12], d[:4], d[:5], d[:5], d[:5], d[:10]) #loop through all the selected runs for run in runs: |