changeset 9d2364203316 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=9d2364203316
description:
config: Updates for distributed gem5 simulations
diffstat:
configs/common/FSConfig.py | 36 +++
configs/common/Options.py | 31 ++
configs/example/fs.py | 12 +
util/dist/gem5-dist.sh | 385 ++++++++++++++++++++++++++++++++++
util/dist/test/simple_bootscript.rcS | 107 +++++++++
util/dist/test/test-2nodes-AArch64.sh | 82 +++++++
util/multi/bootscript.rcS | 122 ----------
util/multi/gem5-multi.sh | 275 ------------------------
8 files changed, 653 insertions(+), 397 deletions(-)
diffs (truncated from 1101 to 300 lines):
diff -r 1640dd68b0a4 -r 9d2364203316 configs/common/FSConfig.py
--- a/configs/common/FSConfig.py Thu Jan 07 16:33:47 2016 -0600
+++ b/configs/common/FSConfig.py Thu Jan 07 16:33:47 2016 -0600
@@ -654,3 +654,39 @@
self.etherlink.dump = Parent.etherdump
return self
+
+
+def makeDistRoot(testSystem,
+ rank,
+ size,
+ server_name,
+ server_port,
+ sync_repeat,
+ sync_start,
+ linkspeed,
+ linkdelay,
+ dumpfile):
+ self = Root(full_system = True)
+ self.testsys = testSystem
+
+ self.etherlink = DistEtherLink(speed = linkspeed,
+ delay = linkdelay,
+ dist_rank = rank,
+ dist_size = size,
+ server_name = server_name,
+ server_port = server_port,
+ sync_start = sync_start,
+ sync_repeat = sync_repeat)
+
+ if hasattr(testSystem, 'realview'):
+ self.etherlink.int0 = Parent.testsys.realview.ethernet.interface
+ elif hasattr(testSystem, 'tsunami'):
+ self.etherlink.int0 = Parent.testsys.tsunami.ethernet.interface
+ else:
+ fatal("Don't know how to connect DistEtherLink to this system")
+
+ if dumpfile:
+ self.etherdump = EtherDump(file=dumpfile)
+ self.etherlink.dump = Parent.etherdump
+
+ return self
diff -r 1640dd68b0a4 -r 9d2364203316 configs/common/Options.py
--- a/configs/common/Options.py Thu Jan 07 16:33:47 2016 -0600
+++ b/configs/common/Options.py Thu Jan 07 16:33:47 2016 -0600
@@ -297,10 +297,41 @@
# Benchmark options
parser.add_option("--dual", action="store_true",
help="Simulate two systems attached with an ethernet
link")
+ parser.add_option("--dist", action="store_true",
+ help="Parallel distributed gem5 simulation.")
+ parser.add_option("--is-switch", action="store_true",
+ help="Select the network switch simulator process for a"\
+ "distributed gem5 run")
+ parser.add_option("--dist-rank", default=0, action="store", type="int",
+ help="Rank of this system within the dist gem5 run.")
+ parser.add_option("--dist-size", default=0, action="store", type="int",
+ help="Number of gem5 processes within the dist gem5
run.")
+ parser.add_option("--dist-server-name",
+ default="127.0.0.1",
+ action="store", type="string",
+ help="Name of the message server host\nDEFAULT:
localhost")
+ parser.add_option("--dist-server-port",
+ default=2200,
+ action="store", type="int",
+ help="Message server listen port\nDEFAULT: 2200")
+ parser.add_option("--dist-sync-repeat",
+ default="0us",
+ action="store", type="string",
+ help="Repeat interval for synchronisation barriers among
dist-gem5 processes\nDEFAULT: --ethernet-linkdelay")
+ parser.add_option("--dist-sync-start",
+ default="5200000000000t",
+ action="store", type="string",
+ help="Time to schedule the first dist synchronisation
barrier\nDEFAULT:5200000000000t")
parser.add_option("-b", "--benchmark", action="store", type="string",
dest="benchmark",
help="Specify the benchmark to run. Available
benchmarks: %s"\
% DefinedBenchmarks)
+ parser.add_option("--ethernet-linkspeed", default="10Gbps",
+ action="store", type="string",
+ help="Link speed in bps\nDEFAULT: 10Gbps")
+ parser.add_option("--ethernet-linkdelay", default="10us",
+ action="store", type="string",
+ help="Link delay in seconds\nDEFAULT: 10us")
# Metafile options
parser.add_option("--etherdump", action="store", type="string",
dest="etherdump",
diff -r 1640dd68b0a4 -r 9d2364203316 configs/example/fs.py
--- a/configs/example/fs.py Thu Jan 07 16:33:47 2016 -0600
+++ b/configs/example/fs.py Thu Jan 07 16:33:47 2016 -0600
@@ -340,6 +340,18 @@
if len(bm) == 2:
drive_sys = build_drive_system(np)
root = makeDualRoot(True, test_sys, drive_sys, options.etherdump)
+elif len(bm) == 1 and options.dist:
+ # This system is part of a dist-gem5 simulation
+ root = makeDistRoot(test_sys,
+ options.dist_rank,
+ options.dist_size,
+ options.dist_server_name,
+ options.dist_server_port,
+ options.dist_sync_repeat,
+ options.dist_sync_start,
+ options.ethernet_linkspeed,
+ options.ethernet_linkdelay,
+ options.etherdump);
elif len(bm) == 1:
root = Root(full_system=True, system=test_sys)
else:
diff -r 1640dd68b0a4 -r 9d2364203316 util/dist/gem5-dist.sh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/util/dist/gem5-dist.sh Thu Jan 07 16:33:47 2016 -0600
@@ -0,0 +1,385 @@
+#! /bin/bash
+
+#
+# Copyright (c) 2015 ARM Limited
+# All rights reserved
+#
+# The license below extends only to copyright in the software and shall
+# not be construed as granting a license to any other intellectual
+# property including but not limited to intellectual property relating
+# to a hardware implementation of the functionality of the software
+# licensed hereunder. You may use the software subject to the license
+# terms below provided that you ensure that this notice is replicated
+# unmodified and in its entirety in all distributions of the software,
+# modified or unmodified, in source code or in binary form.
+#
+# Copyright (c) 2015 University of Illinois Urbana Champaign
+# 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: Gabor Dozsa
+# Mohammad Alian
+
+
+# This is a wrapper script to run a dist gem5 simulations.
+# See the usage_func() below for hints on how to use it. Also,
+# there are some examples in the util/dist directory (e.g.
+# see util/dist/test-2nodes-AArch64.sh)
+#
+#
+# Allocated hosts/cores are assumed to be listed in the LSB_MCPU_HOSTS
+# environment variable (which is what LSF does by default).
+# E.g. LSB_MCPU_HOSTS=\"hname1 2 hname2 4\" means we have altogether 6 slots
+# allocated to launch the gem5 processes, 2 of them are on host hname1
+# and 4 of them are on host hname2.
+# If LSB_MCPU_HOSTS environment variable is not defined then we launch all
+# processes on the localhost.
+#
+# Each gem5 process are passed in a unique rank ID [0..N-1] via the kernel
+# boot params. The total number of gem5 processes is also passed in.
+# These values can be used in the boot script to configure the MAC/IP
+# addresses - among other things (see util/dist/bootscript.rcS).
+#
+# Each gem5 process will create an m5out.$GEM5_RANK directory for
+# the usual output files. Furthermore, there will be a separate log file
+# for each ssh session (we use ssh to start gem5 processes) and one for
+# the server. These are called log.$GEM5_RANK and log.switch.
+#
+
+
+# print help
+usage_func ()
+{
+ echo "Usage:$0 [-debug] [-n nnodes] [-r rundir] [-c ckptdir] [-p port]
[-sw switch] [--sw-args sw_args] [-fs fullsystem] [--fs-args fs_args]
[--cf-args conf_args] [--m5-args m5_args] -x gem5_exe "
+ echo " -debug : debug mode (start gem5 in gdb)"
+ echo " nnodes : number of gem5 processes"
+ echo " rundir : run simulation under this path. If not specified,
current dir will be used"
+ echo " ckptdir : dump/restore checkpoints to/from this path. If not
specified, current dir will be used"
+
+ echo " fullsystem: fullsystem config file"
+ echo " fs_args : fullsystem config specific argument list: arg1 arg2
..."
+ echo " port : switch listen port"
+ echo " switch : switch config file"
+ echo " sw_args : switch config specific argument list: arg1 arg2 ..."
+ echo " conf_args : common (for both fullsystem and switch) config
argument list: arg1 arg2 ..."
+ echo " gem5_exe : gem5 executable (full path required)"
+ echo " m5_args : common m5 argument list (e.g. debug flags): arg1
arg2 ..."
+ echo "Note: if no LSF slots allocation is found all proceses are launched
on the localhost."
+}
+
+# Process (optional) command line options
+FS_ARGS=" "
+SW_ARGS=" "
+CF_ARGS=" "
+M5_ARGS=" "
+while (($# > 0))
+do
+ case "x$1" in
+ x-debug)
+ GEM5_DEBUG="-debug"
+ shift 1
+ ;;
+ x-n|x-nodes)
+ NNODES=$2
+ shift 2
+ ;;
+ x-r|x-rundir)
+ RUN_DIR=$2
+ shift 2
+ ;;
+ x-c|x-ckptdir)
+ CKPT_DIR=$2
+ shift 2
+ ;;
+ x-p|x-port)
+ SW_PORT=$2
+ shift 2
+ ;;
+ x-s|x-switch)
+ SW_CONFIG=$2
+ shift 2
+ ;;
+ x--sw-args)
+ CUR_ARGS="SW_ARGS"
+ shift 1
+ ;;
+ x-f|x-fullsystem)
+ FS_CONFIG=$2
+ shift 2
+ ;;
+ x--fs-args)
+ CUR_ARGS="FS_ARGS"
+ shift 1
+ ;;
+ x--cf-args)
+ CUR_ARGS="CF_ARGS"
+ shift 1
+ ;;
+ x--m5-args)
+ CUR_ARGS="M5_ARGS"
+ shift 1
+ ;;
+ x-x)
+ GEM5_EXE=$2
+ shift 2
+ ;;
+ x-*)
+ [ -n "$CUR_ARGS" ] || { echo "Unexpected arg: $1"; usage_func; exit
-1; }
+ case "x$2" in
+ x-*|x)
+ eval $CUR_ARGS=\"${!CUR_ARGS} $1\"
+ shift 1
+ ;;
+ *)
+ eval $CUR_ARGS=\"${!CUR_ARGS} $1 $2\"
+ shift 2
+ ;;
+ esac
+ ;;
+ *)
+ echo "Unknown arg: $1"
+ usage_func
+ exit 1
+ ;;
+ esac
+done
+
+# Default values to use (in case they are not defined as command line options)
+DEFAULT_FS_CONFIG=$M5_PATH/configs/example/fs.py
+DEFAULT_SW_CONFIG=$M5_PATH/configs/example/sw.py
+DEFAULT_SW_PORT=2200
+
+[ -z "$FS_CONFIG" ] && FS_CONFIG=$DEFAULT_FS_CONFIG
+[ -z "$SW_CONFIG" ] && SW_CONFIG=$DEFAULT_SW_CONFIG
+[ -z "$SW_PORT" ] && SW_PORT=$DEFAULT_SW_PORT
+[ -z "$NNODES" ] && NNODES=2
+[ -z "$RUN_DIR" ] && RUN_DIR=$(pwd)
+[ -z "$CKPT_DIR" ] && CKPT_DIR=$(pwd)
+
+# Check if all the executables we need exist
+[ -f "$FS_CONFIG" ] || { echo "FS config ${FS_CONFIG} not found"; exit 1; }
+[ -f "$SW_CONFIG" ] || { echo "Switch config ${SW_CONFIG} not found"; exit 1; }
+[ -x "$GEM5_EXE" ] || { echo "Executable ${GEM5_EXE} not found"; exit 1; }
+# make sure that RUN_DIR exists
+mkdir -p $RUN_DIR > /dev/null 2>&1
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev