5 # Copyright (c) 2015 ARM Limited
8 # The license below extends only to copyright in the software and shall
9 # not be construed as granting a license to any other intellectual
10 # property including but not limited to intellectual property relating
11 # to a hardware implementation of the functionality of the software
12 # licensed hereunder. You may use the software subject to the license
13 # terms below provided that you ensure that this notice is replicated
14 # unmodified and in its entirety in all distributions of the software,
15 # modified or unmodified, in source code or in binary form.
17 # Redistribution and use in source and binary forms, with or without
18 # modification, are permitted provided that the following conditions are
19 # met: redistributions of source code must retain the above copyright
20 # notice, this list of conditions and the following disclaimer;
21 # redistributions in binary form must reproduce the above copyright
22 # notice, this list of conditions and the following disclaimer in the
23 # documentation and/or other materials provided with the distribution;
24 # neither the name of the copyright holders nor the names of its
25 # contributors may be used to endorse or promote products derived from
26 # this software without specific prior written permission.
28 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
31 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
32 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40 # Authors: Gabor Dozsa
43 # This is an example boot script to use for muti gem5 runs. The important
44 # task here is to extract the rank and size information from the kernel
45 # boot args and use those to configure MAC/IP addresses and hostname.
46 # Then we can kick off our (parallel) workload ...
48 # You are expected to costumize this scipt for your needs (e.g. change
49 # the command at the end of the scipt to run your tests/workloads.
52 echo "bootscript.rcS is running"
54 m
='GEM5\_RANK=([0-9]+) GEM5\_SIZE=([0-9]+)'
55 if [[ $
(cat /proc
/cmdline
) =~
$m ]]
57 MY_RANK
=${BASH_REMATCH[1]}
58 MY_SIZE
=${BASH_REMATCH[2]}
60 echo "(E) GEM5_RANK/GEM5_SIZE was not defined in bootargs, exiting ..."
64 /bin
/hostname node
${MY_RANK}
66 # Keep MAC address assignment simple for now ...
67 (($MY_RANK>97)) && { echo "(E) Rank must be less than 98"; /sbin
/m5 abort
; }
71 MY_ADDR_PADDED
=0${MY_ADDR}
73 MY_ADDR_PADDED
=${MY_ADDR}
76 /sbin
/ifconfig eth0 hw ether
00:90:00:00:00:${MY_ADDR_PADDED}
77 /sbin
/ifconfig eth0
192.168.0.
${MY_ADDR} netmask
255.255.255.0 up
81 # Prepare host lists for mpirun
82 MY_MPI_HOSTS
="192.168.0.2"
83 for ((i
=1; i
<MY_SIZE
; i
++))
85 MY_MPI_HOSTS
+=",192.168.0.$((i+2))"
88 # Check that Ethernet links work, then take a checkpoint
89 if [ "$MY_RANK" == "0" ]
93 for i
in $MY_MPI_HOSTS
95 ping -c 1 $i ||
{ echo "ping $i failed, exiting ..."; exit -1; }
96 ssh $i hostname ||
{ echo "ssh $i failed, exiting ..."; exit -1; }
102 # --------------------------------------------
103 # ------ Start your tests below ... ---------
104 # --------------------------------------------
106 if [ "$MY_RANK" == "0" ]
109 #mpirun -H 192.168.0.3,192.168.0.2 hostname
111 mpirun
-H $MY_MPI_HOSTS lulesh
/lulesh2.0
-mpi -s 5
113 # This is to avoid other (rank!=0) gem5 processes exiting
114 # before the test (started by rank 0) completes. When rank 0 completes the
115 # test it will exit and that will trigger a notification to all the peer
116 # gem5 peocesses to stop the simulation.
117 echo "sleep forever..."