# Node ID a171d990e57fc4a7db70ffcf1090d890060db0c0 # Parent 62fa4f3ccba6fcf02baa20a81b8382950515263d diff --git a/configs/common/FSConfig.py b/configs/common/FSConfig.py --- a/configs/common/FSConfig.py +++ b/configs/common/FSConfig.py @@ -645,3 +645,39 @@ self.etherlink.dump = Parent.etherdump return self + + +def makeMultiRoot(testSystem, + rank, + size, + server_name, + server_port, + sync_repeat, + sync_start, + linkspeed, + linkdelay, + dumpfile): + self = Root(full_system = True) + self.testsys = testSystem + + self.etherlink = MultiEtherLink(speed = linkspeed, + delay = linkdelay, + multi_rank = rank, + multi_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 MultiEtherLink to this system") + + if dumpfile: + self.etherdump = EtherDump(file=dumpfile) + self.etherlink.dump = Parent.etherdump + + return self diff --git a/configs/common/Options.py b/configs/common/Options.py --- a/configs/common/Options.py +++ b/configs/common/Options.py @@ -275,10 +275,38 @@ # Benchmark options parser.add_option("--dual", action="store_true", help="Simulate two systems attached with an ethernet link") + parser.add_option("--multi", action="store_true", + help="Parallel multi gem5 simulation.") + parser.add_option("--multi-rank", default=0, action="store", type="int", + help="Rank of this system within the multi gem5 run.") + parser.add_option("--multi-size", default=0, action="store", type="int", + help="Number of gem5 processes within the multi gem5 run.") + parser.add_option("--multi-server-name", + default="localhost", + action="store", type="string", + help="Name of the message server host\nDEFAULT: localhost") + parser.add_option("--multi-server-port", + default=2200, + action="store", type="int", + help="Message server listen port\nDEFAULT: 2200") + parser.add_option("--multi-sync-repeat", + default="0us", + action="store", type="string", + help="Repeat interval for synchronisation barriers among multi gem5 processes\nDEFAULT: --ethernet-linkdelay") + parser.add_option("--multi-sync-start", + default="5200000000000t", + action="store", type="string", + help="Time to schedule the first multi 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 --git a/configs/example/fs.py b/configs/example/fs.py --- a/configs/example/fs.py +++ b/configs/example/fs.py @@ -328,6 +328,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.multi: + # This system is part of a multi-gem5 simulation + root = makeMultiRoot(test_sys, + options.multi_rank, + options.multi_size, + options.multi_server_name, + options.multi_server_port, + options.multi_sync_repeat, + options.multi_sync_start, + options.ethernet_linkspeed, + options.ethernet_linkdelay, + options.etherdump); elif len(bm) == 1: root = Root(full_system=True, system=test_sys) else: diff --git a/src/dev/Ethernet.py b/src/dev/Ethernet.py --- a/src/dev/Ethernet.py +++ b/src/dev/Ethernet.py @@ -66,8 +66,9 @@ delay_var = Param.Latency('0ns', "packet transmit delay variability") speed = Param.NetworkBandwidth('1Gbps', "link speed") dump = Param.EtherDump(NULL, "dump object") - multi_rank = Param.UInt32('0', "Rank of the this gem5 process (multi run)") - sync_start = Param.Latency('5200000000000t', "first multi sync barrier") + multi_rank = Param.UInt32('0', "Rank of this gem5 process (multi run)") + multi_size = Param.UInt32('1', "Number of gem5 processes (multi run)") + sync_start = Param.Latency('5200000000000t', "first multi sync barrier") sync_repeat = Param.Latency('10us', "multi sync barrier repeat") server_name = Param.String('localhost', "Message server name") server_port = Param.UInt32('2200', "Message server port") diff --git a/src/dev/multi_etherlink.cc b/src/dev/multi_etherlink.cc --- a/src/dev/multi_etherlink.cc +++ b/src/dev/multi_etherlink.cc @@ -75,15 +75,26 @@ : EtherObject(p) { DPRINTF(MultiEthernet,"MultiEtherLink::MultiEtherLink() " - "link delay:%llu\n", p->delay); + "link delay:%llu ticksPerByte:%f\n", p->delay, p->speed); txLink = new TxLink(name() + ".link0", this, p->speed, p->delay_var, p->dump); rxLink = new RxLink(name() + ".link1", this, p->delay, p->dump); + Tick sync_repeat; + if (p->sync_repeat != 0) { + if (p->sync_repeat != p->delay) + warn("MultiEtherLink(): sync_repeat is %lu and linkdelay is %lu", + p->sync_repeat, p->delay); + sync_repeat = p->sync_repeat; + } else { + sync_repeat = p->delay; + } + // create the multi (TCP) interface to talk to the peer gem5 processes. - multiIface = new TCPIface(p->server_name, p->server_port, p->multi_rank, - p->sync_start, p->sync_repeat, this); + multiIface = new TCPIface(p->server_name, p->server_port, + p->multi_rank, p->multi_size, + p->sync_start, sync_repeat, this); localIface = new LocalIface(name() + ".int0", txLink, rxLink, multiIface); } diff --git a/src/dev/multi_iface.hh b/src/dev/multi_iface.hh --- a/src/dev/multi_iface.hh +++ b/src/dev/multi_iface.hh @@ -371,6 +371,11 @@ * The rank of this process among the gem5 peers. */ unsigned rank; + + /** + * The number of gem5 processes comprising this multi simulation. + */ + unsigned size; /** * Total number of receiver threads (in this gem5 process). * During the simulation it should be constant and equal to the @@ -441,6 +446,7 @@ * @param em The event manager associated with the simulated Ethernet link */ MultiIface(unsigned multi_rank, + unsigned multi_size, Tick sync_start, Tick sync_repeat, EventManager *em); @@ -486,6 +492,14 @@ void serialize(const std::string &base, CheckpointOut &cp) const; void unserialize(const std::string &base, CheckpointIn &cp); + /** + * Getter for the multi rank param. + */ + static uint64_t rankParam(); + /** + * Getter for the multi size param. + */ + static uint64_t sizeParam(); }; diff --git a/src/dev/multi_iface.cc b/src/dev/multi_iface.cc --- a/src/dev/multi_iface.cc +++ b/src/dev/multi_iface.cc @@ -310,12 +310,14 @@ } MultiIface::MultiIface(unsigned multi_rank, + unsigned multi_size, Tick sync_start, Tick sync_repeat, EventManager *em) : syncStart(sync_start), syncRepeat(sync_repeat), recvThread(nullptr), eventManager(em), recvDone(nullptr), - scheduledRecvPacket(nullptr), linkDelay(0), rank(multi_rank) + scheduledRecvPacket(nullptr), linkDelay(0), rank(multi_rank), + size(multi_size) { DPRINTF(MultiEthernet, "MultiIface() ctor rank:%d\n",multi_rank); if (master == nullptr) { @@ -620,3 +622,29 @@ } DPRINTF(MultiEthernet, "MultiIface::initPeriodicSync done\n"); } + +uint64_t +MultiIface::rankParam() +{ + uint64_t val; + if (master) { + val = master->rank; + } else { + warn("Multi-rank parameter is queried in single gem5 simulation."); + val = 0; + } + return val; +} + +uint64_t +MultiIface::sizeParam() +{ + uint64_t val; + if (master) { + val = master->size; + } else { + warn("Multi-size parameter is queried in single gem5 simulation."); + val = 1; + } + return val; +} diff --git a/src/dev/tcp_iface.hh b/src/dev/tcp_iface.hh --- a/src/dev/tcp_iface.hh +++ b/src/dev/tcp_iface.hh @@ -125,8 +125,8 @@ * Ethernet link. */ TCPIface(std::string server_name, unsigned server_port, - unsigned multi_rank, Tick sync_start, Tick sync_repeat, - EventManager *em); + unsigned multi_rank, unsigned multi_size, + Tick sync_start, Tick sync_repeat, EventManager *em); ~TCPIface() M5_ATTR_OVERRIDE; }; diff --git a/src/dev/tcp_iface.cc b/src/dev/tcp_iface.cc --- a/src/dev/tcp_iface.cc +++ b/src/dev/tcp_iface.cc @@ -67,9 +67,10 @@ vector TCPIface::sockRegistry; TCPIface::TCPIface(string server_name, unsigned server_port, - unsigned multi_rank, Tick sync_start, Tick sync_repeat, + unsigned multi_rank, unsigned multi_size, + Tick sync_start, Tick sync_repeat, EventManager *em) : - MultiIface(multi_rank, sync_start, sync_repeat, em) + MultiIface(multi_rank, multi_size, sync_start, sync_repeat, em) { struct addrinfo addr_hint, *addr_results; int ret; diff --git a/src/sim/initparam_keys.hh b/src/sim/initparam_keys.hh new file mode 100644 --- /dev/null +++ b/src/sim/initparam_keys.hh @@ -0,0 +1,67 @@ +/* + * 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 + */ + +/* @file + * Magic key definitions for the InitParam pseudo inst + */ +#ifndef ___SIM_INITPARAM_KEYS_HH__ +#define ___SIM_INITPARAM_KEYS_HH__ + +namespace PseudoInst { +/** + * Magic keys to retrieve various params by the iniParam pseudo inst. + * + */ +struct InitParamKey { + /** + * The default key (0) + */ + static constexpr int DEFAULT = 0; + /** + * Magic key for "rank" param (parallel multi-gem5 runs) + */ + static constexpr int MULTI_RANK = 1234; + /** + * Magic key for "size" param (parallel multi-gem5 runs) + */ + static constexpr int MULTI_SIZE = 1235; +}; +} // namespace PseudoInst + +#endif diff --git a/src/sim/pseudo_inst.cc b/src/sim/pseudo_inst.cc --- a/src/sim/pseudo_inst.cc +++ b/src/sim/pseudo_inst.cc @@ -63,8 +63,10 @@ #include "debug/PseudoInst.hh" #include "debug/Quiesce.hh" #include "debug/WorkItems.hh" +#include "dev/multi_iface.hh" #include "params/BaseCPU.hh" #include "sim/full_system.hh" +#include "sim/initparam_keys.hh" #include "sim/process.hh" #include "sim/pseudo_inst.hh" #include "sim/serialize.hh" @@ -449,9 +451,15 @@ } uint64_t val; switch (key) { - case 0: + case InitParamKey::DEFAULT: val = tc->getCpuPtr()->system->init_param; break; + case InitParamKey::MULTI_RANK: + val = MultiIface::rankParam(); + break; + case InitParamKey::MULTI_SIZE: + val = MultiIface::sizeParam(); + break; default: panic("Unknown key for initparam pseudo instruction"); } diff --git a/util/multi/bootscript.rcS b/util/multi/bootscript.rcS deleted file mode 100644 --- 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 + sleep 20 + # (try to) kill gem5 processes - just in case something went wrong with the + # server triggered exit bname=$(basename $GEM5_EXE) - killall -q $bname + killall -q -s SIGKILL $bname for h in ${HOSTS[@]} do - ssh $h killall -q $bname + ssh $h killall -q -s SIGKILL $bname done - sleep 3 - # kill the message server and the watchdog - [ "x$SERVER_PID" != "x" ] && kill $SERVER_PID 2>/dev/null + sleep 5 + # kill the watchdog [ "x$WATCHDOG_PID" != "x" ] && kill $WATCHDOG_PID 2>/dev/null exit -1 } @@ -200,20 +204,22 @@ done } -# This function launches the gem5 processes. We use it only to allow launching -# gem5 processes under gdb control (in the foreground) for debugging +# This function launches the gem5 processes. The only purpose is to enable +# launching gem5 processes under gdb control 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 + local N=$1 + local HOST=$2 + local ENV_ARGS=$3 + shift 3 + if [ "x$GEM5_DEBUG" != "x" ] + then + echo "DEBUG starting terminal..." + MY_ARGS="$@" + xterm -e "gdb --args $MY_ARGS" + else + ssh $HOST $ENV_ARGS "$@" &>log.$N & + fi } @@ -237,19 +243,20 @@ 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 \ + echo "starting gem5 on $h ..." + start_func $n $h "$ENV_ARGS" $GEM5_EXE -d $(pwd)/m5out.$n $GEM5_ARGS \ + --multi \ + --multi-rank=$n \ + --multi-size=$NNODES \ --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)) + --multi-server-port=$SERVER_PORT + SSH_PIDS[$n]=$! + ((n+=1)) done done -[ "x$GEM5_DEBUG" == "x" ] || { kill $SERVER_PID; echo "DEBUG exit"; exit -1; } +# Wait here if it is a debug session +[ "x$GEM5_DEBUG" == "x" ] || { echo "DEBUG session"; wait $SERVER_PID; exit -1; } # start watchdog to trigger complete abort (after a grace period) if any # gem5 process dies diff --git a/util/multi/test/bootscript.rcS b/util/multi/test/bootscript.rcS new file mode 100644 --- /dev/null +++ b/util/multi/test/bootscript.rcS @@ -0,0 +1,101 @@ +#!/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 multi gem5 runs. The important +# task here is to extract the rank and size information through the m5 +# initparam utility and use those to configure MAC/IP addresses and hostname. +# +# You are expected to customize 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" + +# Retrieve multi-gem5 rank and size parameters using magic keys +MY_RANK=$(/sbin/m5 initparam 1234) +MY_SIZE=$(/sbin/m5 initparam 1235) + +/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 + +echo "Hello from $MY_RANK of $MY_SIZE" + +# Now that our network interface is configured we can use the usual commands to +# contact the other systems, e.g. let's try to ping a "neighbour" system +if ((MY_RANK < MY_SIZE - 1)) +then + ping -c 1 192.168.0.$((MY_ADDR + 1)) +else + ping -c 1 192.168.0.2 +fi + + +if [ "$MY_RANK" == "0" ] +then + /sbin/m5 checkpoint + echo "A real multi node workload might start here ..." + /sbin/m5 exit 0 +else + # This is to avoid other (rank!=0) gem5 processes exiting + # before the test (started by rank 0) completes. When rank 0 completes the + # test it will exit and that will trigger a notification to all the peer + # gem5 processes to stop the simulation. + echo "sleep forever..." + while /bin/true + do + sleep 5 + done +fi diff --git a/util/multi/test/test-2nodes-AArch64.sh b/util/multi/test/test-2nodes-AArch64.sh new file mode 100755 --- /dev/null +++ b/util/multi/test/test-2nodes-AArch64.sh @@ -0,0 +1,73 @@ +#! /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 script to start a multi gem5 simulations using +# two AArch64 systems. It is also uses the example +# multi gem5 bootscript util/multi/test/bootscript.rcS that will run the +# linux ping command to check if we can see the peer system connected via +# the simulated Ethernet link. + +GEM5_DIR=$(dirname $0)/../../.. + +IMG=$M5_PATH/disks/aarch64-ubuntu-trusty-headless.img +VMLINUX=$M5_PATH/binaries/vmlinux.aarch64.20140821 +DTB=$M5_PATH/binaries/vexpress.aarch64.20140821.dtb + +SYS_CONFIG=$GEM5_DIR/configs/example/fs.py +GEM5_EXE=$GEM5_DIR/build/ARM/gem5.opt + +BOOT_SCRIPT=$GEM5_DIR/util/multi/test/bootscript.rcS +GEM5_MULTI_SH=$GEM5_DIR/util/multi/gem5-multi.sh + +#DEBUG_FLAGS="--debug-flags=MultiEthernet" +#CHKPT_RESTORE="-r1" + +NNODES=2 + +$GEM5_MULTI_SH -n $NNODES $GEM5_EXE $DEBUG_FLAGS $SYS_CONFIG \ + --cpu-type=atomic \ + --num-cpus=1 \ + --machine-type=VExpress_EMM64 \ + --disk-image=$IMG \ + --kernel=$VMLINUX \ + --dtb-filename=$DTB \ + --script=$BOOT_SCRIPT \ + $CHKPT_RESTORE