1#! /bin/bash 2 3# 4# Copyright (c) 2015 ARM Limited 5# All rights reserved 6# 7# The license below extends only to copyright in the software and shall 8# not be construed as granting a license to any other intellectual 9# property including but not limited to intellectual property relating 10# to a hardware implementation of the functionality of the software 11# licensed hereunder. You may use the software subject to the license 12# terms below provided that you ensure that this notice is replicated 13# unmodified and in its entirety in all distributions of the software, 14# modified or unmodified, in source code or in binary form. 15# 16# Copyright (c) 2015 University of Illinois Urbana Champaign 17# All rights reserved 18# 19# Redistribution and use in source and binary forms, with or without 20# modification, are permitted provided that the following conditions are 21# met: redistributions of source code must retain the above copyright 22# notice, this list of conditions and the following disclaimer; 23# redistributions in binary form must reproduce the above copyright 24# notice, this list of conditions and the following disclaimer in the 25# documentation and/or other materials provided with the distribution; 26# neither the name of the copyright holders nor the names of its 27# contributors may be used to endorse or promote products derived from 28# this software without specific prior written permission. 29# 30# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 31# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 32# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 33# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 34# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 35# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 36# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 37# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 38# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 39# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 40# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 41# 42# Authors: Gabor Dozsa 43# Mohammad Alian 44 45 46# This is a wrapper script to run a dist gem5 simulations. 47# See the usage_func() below for hints on how to use it. Also, 48# there are some examples in the util/dist directory (e.g. 49# see util/dist/test-2nodes-AArch64.sh) 50# 51# 52# Allocated hosts/cores are assumed to be listed in the LSB_MCPU_HOSTS 53# environment variable (which is what LSF does by default). 54# E.g. LSB_MCPU_HOSTS=\"hname1 2 hname2 4\" means we have altogether 6 slots 55# allocated to launch the gem5 processes, 2 of them are on host hname1 56# and 4 of them are on host hname2. 57# If LSB_MCPU_HOSTS environment variable is not defined then we launch all 58# processes on the localhost. 59# 60# Each gem5 process are passed in a unique rank ID [0..N-1] via the kernel 61# boot params. The total number of gem5 processes is also passed in. 62# These values can be used in the boot script to configure the MAC/IP 63# addresses - among other things (see util/dist/bootscript.rcS). 64# 65# Each gem5 process will create an m5out.$GEM5_RANK directory for 66# the usual output files. Furthermore, there will be a separate log file 67# for each ssh session (we use ssh to start gem5 processes) and one for 68# the server. These are called log.$GEM5_RANK and log.switch. 69# 70 71 72# print help 73usage_func () 74{ 75 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 " 76 echo " -debug : debug mode (start gem5 in gdb)" 77 echo " nnodes : number of gem5 processes" 78 echo " rundir : run simulation under this path. If not specified, current dir will be used" 79 echo " ckptdir : dump/restore checkpoints to/from this path. If not specified, current dir will be used" 80 81 echo " fullsystem: fullsystem config file" 82 echo " fs_args : fullsystem config specific argument list: arg1 arg2 ..." 83 echo " port : switch listen port" 84 echo " switch : switch config file" 85 echo " sw_args : switch config specific argument list: arg1 arg2 ..." 86 echo " conf_args : common (for both fullsystem and switch) config argument list: arg1 arg2 ..." 87 echo " gem5_exe : gem5 executable (full path required)" 88 echo " m5_args : common m5 argument list (e.g. debug flags): arg1 arg2 ..." 89 echo "Note: if no LSF slots allocation is found all proceses are launched on the localhost." 90} 91 92# Process (optional) command line options 93FS_ARGS=" " 94SW_ARGS=" " 95CF_ARGS=" " 96M5_ARGS=" " 97while (($# > 0)) 98do 99 case "x$1" in 100 x-debug) 101 GEM5_DEBUG="-debug" 102 shift 1 103 ;; 104 x-n|x-nodes) 105 NNODES=$2 106 shift 2 107 ;; 108 x-r|x-rundir) 109 RUN_DIR=$2 110 shift 2 111 ;; 112 x-c|x-ckptdir) 113 CKPT_DIR=$2 114 shift 2 115 ;; 116 x-p|x-port) 117 SW_PORT=$2 118 shift 2 119 ;; 120 x-s|x-switch) 121 SW_CONFIG=$2 122 shift 2 123 ;; 124 x--sw-args) 125 CUR_ARGS="SW_ARGS" 126 shift 1 127 ;; 128 x-f|x-fullsystem) 129 FS_CONFIG=$2 130 shift 2 131 ;; 132 x--fs-args) 133 CUR_ARGS="FS_ARGS" 134 shift 1 135 ;; 136 x--cf-args) 137 CUR_ARGS="CF_ARGS" 138 shift 1 139 ;; 140 x--m5-args) 141 CUR_ARGS="M5_ARGS" 142 shift 1 143 ;; 144 x-x) 145 GEM5_EXE=$2 146 shift 2 147 ;; 148 x-*) 149 [ -n "$CUR_ARGS" ] || { echo "Unexpected arg: $1"; usage_func; exit -1; } 150 case "x$2" in 151 x-*|x) 152 eval $CUR_ARGS=\"${!CUR_ARGS} $1\" 153 shift 1 154 ;; 155 *) 156 eval $CUR_ARGS=\"${!CUR_ARGS} $1 $2\" 157 shift 2 158 ;; 159 esac 160 ;; 161 *) 162 echo "Unknown arg: $1" 163 usage_func 164 exit 1 165 ;; 166 esac 167done 168 169# Default values to use (in case they are not defined as command line options) 170DEFAULT_FS_CONFIG=$M5_PATH/configs/example/fs.py
|