From 64ca31976fe91eedd91b2d703c6e3e62328f8e1d Mon Sep 17 00:00:00 2001 From: Gabor Dozsa Date: Thu, 7 Jan 2016 16:33:47 -0600 Subject: config: Updates for distributed gem5 simulations --- util/multi/bootscript.rcS | 122 -------------------- util/multi/gem5-multi.sh | 275 ---------------------------------------------- 2 files changed, 397 deletions(-) delete mode 100644 util/multi/bootscript.rcS delete mode 100755 util/multi/gem5-multi.sh (limited to 'util/multi') diff --git a/util/multi/bootscript.rcS b/util/multi/bootscript.rcS deleted file mode 100644 index 95736f4b7..000000000 --- a/util/multi/bootscript.rcS +++ /dev/null @@ -1,122 +0,0 @@ -#!/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. -# -# 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 -# -# -# This is an example boot script to use for muti gem5 runs. The important -# task here is to extract the rank and size information from the kernel -# boot args and use those to configure MAC/IP addresses and hostname. -# Then we can kick off our (parallel) workload ... -# -# You are expected to costumize this scipt for your needs (e.g. change -# the command at the end of the scipt to run your tests/workloads. - -source /root/.bashrc -echo "bootscript.rcS is running" - -m='GEM5\_RANK=([0-9]+) GEM5\_SIZE=([0-9]+)' -if [[ $(cat /proc/cmdline) =~ $m ]] -then - MY_RANK=${BASH_REMATCH[1]} - MY_SIZE=${BASH_REMATCH[2]} -else - echo "(E) GEM5_RANK/GEM5_SIZE was not defined in bootargs, exiting ..." - /sbin/m5 abort -fi - -/bin/hostname node${MY_RANK} - -# Keep MAC address assignment simple for now ... -(($MY_RANK>97)) && { echo "(E) Rank must be less than 98"; /sbin/m5 abort; } -((MY_ADDR=MY_RANK+2)) -if (($MY_ADDR<10)) -then - MY_ADDR_PADDED=0${MY_ADDR} -else - MY_ADDR_PADDED=${MY_ADDR} -fi - -/sbin/ifconfig eth0 hw ether 00:90:00:00:00:${MY_ADDR_PADDED} -/sbin/ifconfig eth0 192.168.0.${MY_ADDR} netmask 255.255.255.0 up - -/sbin/ifconfig -a - -# Prepare host lists for mpirun -MY_MPI_HOSTS="192.168.0.2" -for ((i=1; i/dev/null - [ "x$WATCHDOG_PID" != "x" ] && kill $WATCHDOG_PID 2>/dev/null - exit -1 -} - - -# We need a watchdog to trigger full clean up if a gem5 process dies -watchdog_func () -{ - while true - do - sleep 30 - ((NDEAD=0)) - for p in ${SSH_PIDS[*]} - do - kill -0 $p 2>/dev/null || ((NDEAD+=1)) - done - kill -0 $SERVER_PID || ((NDEAD+=1)) - if ((NDEAD>0)) - then - # we may be in the middle of an orderly termination, - # give it some time to complete before reporting abort - sleep 60 - echo -n "(I) (some) gem5 process(es) exited" - abort_func - fi - done -} - -# This function launches the gem5 processes. We use it only to allow launching -# gem5 processes under gdb control (in the foreground) for debugging -start_func () -{ - local N=$1 - local HOST=$2 - local ENV_ARGS=$3 - shift 3 - if [ "x$GEM5_DEBUG" != "x" ] - then - gdb --args "$@" - else - ssh $HOST $ENV_ARGS "$@" &>log.$N & - fi -} - - -# Trigger full clean up in case we are being killed by external signal -trap 'abort_func' INT TERM - -# env args to be passed explicitly to gem5 processes started via ssh -ENV_ARGS="LD_LIBRARY_PATH=$LD_LIBRARY_PATH M5_PATH=$M5_PATH" - -# launch the mesage server and check if it has started okay -$TCP_SERVER $GEM5_DEBUG $NNODES $SERVER_PORT &>log.server & -SERVER_PID=$! -sleep 2 -kill -0 $SERVER_PID || { echo "Failed to start message server"; exit -1; } - -# Now launch all the gem5 processes with ssh. -echo "START $(date)" -n=0 -for ((i=0; i < ${#HOSTS[@]}; i++)) -do - h=${HOSTS[$i]} - for ((j=0; j < ${NCORES[i]}; j++)) - do - echo "starting gem5 on $h ..." - start_func $n $h "$ENV_ARGS" $GEM5_EXE -d $(pwd)/m5out.$n $GEM5_ARGS \ - --multi \ - --multi-rank=$n \ - --multi-server-name=${HOSTS[0]} \ - --multi-server-port=$SERVER_PORT \ - --testsys-toplevel-LinuxArmSystem.boot_osflags="\"GEM5_RANK=$n GEM5_SIZE=$NNODES\"" - SSH_PIDS[$n]=$! - ((n+=1)) - done -done - -[ "x$GEM5_DEBUG" == "x" ] || { kill $SERVER_PID; echo "DEBUG exit"; exit -1; } - -# start watchdog to trigger complete abort (after a grace period) if any -# gem5 process dies -watchdog_func & -WATCHDOG_PID=$! - -# wait for exit statuses -((NFAIL=0)) -for p in ${SSH_PIDS[*]} -do - wait $p || ((NFAIL+=1)) -done -wait $SERVER_PID || ((NFAIL+=1)) - -# all done, let's terminate the watchdog -kill $WATCHDOG_PID 2>/dev/null - -if ((NFAIL==0)) -then - echo "EXIT $(date)" -else - echo "ABORT $(date)" -fi -- cgit v1.2.3