#!/usr/bin/env bash12if [ $# -gt 1 ]; then3echo "Running simulation for grid $1 x $2"4else5echo "Usage: ./run <rows> <cols>"6exit 17fi89# Remove results from previous simulatiosn10rm -f gcc.init11rm -f outputs/*1213# Create outputs directory if it doesn't exist14mkdir outputs1516# The simulation in `example1` used the fast but less accurate `block`17# thermal model. HotSpot offers the choice of a more accurate but18# relatively slower model called the 'grid' model. The '-model_type19# grid' command line option switches HotSpot to the grid mode. Hence,20# the set of commands to redo the thermal simulation from `example1`21# using the grid model would be:22echo "RUNNING HOTSPOT with grid $1 x $2"23../../hotspot -c example.config -f ev6.flp -p gcc.ptrace -materials_file example.materials -model_type grid -grid_rows $1 -grid_cols $2 -steady_file outputs/gcc.steady -grid_steady_file outputs/gcc.grid.steady2425cp outputs/gcc.steady gcc.init2627# Report average heater temperatures to screen28echo "Average temperatures across active regions:"29head -n 2 outputs/gcc.steady303132#hotspot -c example.config -init_file gcc.init -f ev6.flp -p gcc.ptrace -materials_file example.materials -model_type grid -grid_rows $1 -grid_cols $2 -o outputs/gcc.ttrace -grid_transient_file outputs/gcc.grid.ttrace3334# The trade-off between speed and accuracy of the grid model can be35# controlled by specifying the grid model's resolution through the36# command line options '-grid_rows <num>' and '-grid_cols <num>'. The37# default grid size is 64x64 (as can be seen from the 'example.config'38# file). When simulating without SuperLU, grid dimensions are restricted39# to powers of 2 for algorithmic convenience.4041# In addition to the '-steady_file <file>' option that provides42# temperatures at a per-block granularity, the grid model provides an43# additional means to access the finer grid of steady state44# temperatures. The command line option '-grid_steady_file <file>'45# outputs the internal grid temperatures directly (without46# aggregating them into per-block temperatures). This can help in47# learning how temperatures vary 'within' a block. Also, the Perl script48# 'grid_thermal_map.pl' or the Python script `grid_thermal_map.py` can produce color images49# of these temperatures with a superposed drawing of the floorplan for easy50# viewing. Note that we need to first split gcc.grid.steady into layer-specific temperature51# files. Although we've only given a single layer to be simulated, HotSpot is also simulating52# the Thermal Interface Material (TIM), heat spreader, and heat sink as separate layers53python3 ../../scripts/split_grid_steady.py outputs/gcc.grid.steady 4 $1 $254#perl ../scripts/grid_thermal_map.pl ev6.flp outputs/gcc_layer0.grid.steady > outputs/gcc.svg55python3 ../../scripts/grid_thermal_map.py ev6.flp outputs/gcc_layer0.grid.steady $1 $2 outputs/gcc.png5657# HotSpot also provides the `-grid_transient_file <file>` option to view58# transient grid temperatures5960# Since the grid model aggregates the finer grid temperatures into61# per-block temperatures, HotSpot provides a choice to the user in the62# mode of aggregation. The user can select the mapping between the grid63# and block temperatures of the grid model through the command line64# option '-grid_map_mode <mode>'. The four mapping modes supported are:65# 'min', 'max', 'avg' and 'center'. The first three options respectively66# mean that the block's temperature is computed as the minimum, maximum,67# or average temperature of the grid cells in it. The 'center' option68# means that the block's temperature is given by the temperature of the69# grid cell at its center. You can change the `grid_map_mode` in `example.config`7071# HotSpot also models the secondary heat transfer path from the silicon72# to on-chip interconnect layers, C4 pads, packaging substrate, solder73# balls and printed-circuit board. In most cases when there is a heatsink74# with forced air-convection, the effect of secondary heat transfer path75# can be neglected. For special cases such as exposing silicon die to an76# oil flow for infrared thermal measurements, secondary heat transfer77# path should not be omitted. This feature is only available with the grid model.78# Here is an example of how to enable the secondary heat flow path:79#hotspot -c example.config -materials_file example.materials -f ev6.flp -p gcc.ptrace -model_type grid -model_secondary 1 -grid_steady_file outputs/gcc.grid.steady808182