Modeling and Simulation with SST and OCCAM Exercise 1 Setup, Configure & Run a Simple Processor Be on the lookout for this fellow: The callouts are ACTIONs for you to do! When you see the check mark, compare your work to the marked element 1
SST In the following exercises we will Use the SST prospero CPU model Issues memory access instructions based on traces Connected to a memory simulator Use MemHierarch memory simulator Using different backends simpledram, DRAMSim2 With different L1 and L2 Caches input config input trace SST framework prospero CPU model MemHierarchy mem model output stats 2
Exercise 1: Learning Objectives Run an SST simulation from command line Configuration model and how to setup SST Create experimental workflows, modify parameters in OCCAM Visualize results Change configurations in SST 3
Exercise 1: Overview of Steps Setup an SST simulation Use prospero simulator Read traces, sends to simple memory simulator Define experiment and run in OCCAM Instantiate a specific SST simulator Create an experiment with simulator & run it Visualize results Modify an SST configuration Change prospero to use DRAMsim2 simulator Run new experiment w/modified configuration 4
Setup & Run an SST simulation Estimated time: 10 minutes 5
Setup & Run a Simulation Getting started Each participant has access to a system Preconfigured for the tutorial Preloaded with working SST and OCCAM setup Mix of command line (SST & OCCAM) and web OCCAM s GUI is via web services, running on instance SST materials ~/tutorial/sst_materials Extra materials Printed materials supplied in the session 6
Setup & Run a Simulation Running prospero Let s run prospero on a trace! (a) Follow the instructions in the handout on terminal access (b) navigate to exercise 1 folder (c) run prospero on trace* Copy-paste: sst config_prosperosimpledram.py --model-options --trace_prospero0 prospero0.trace 7
Setup & Run a Simulation Viewing the results Output file stats.csv is generated This is only an example, your values can be different (a) Execute: less stats.csv (b) Check you got a similar output 8
Define & Run an Experiment in OCCAM Estimated time: 20 minutes 9
Running the install script For your convenience we have provided a script While the script runs let s see what it is doing (a) Change into directory tutorial (b) Run the script 10
Import simulator First we need to import the wrapped SST Import: add a tool into your OCCAM instance Must be wrapped for running with OCCAM Clone from a git repository (a) Change into directory tutorial (b) Clone the SST repository* *Copy-paste git clone https://bitbucket.org/occam/simulator-sst-sc16.git 11
Import simulator First we need to import the wrapped SST Import: add a tool into your OCCAM instance Must be wrapped for running with OCCAM Clone from a git repository (a) Change into directory tutorial (b) Clone the SST repository (c) Import the repository into OCCAM 12
Import other materials In this tutorial we will need materials other than SST (configuration files, traces, etc.) (a) Import the extra materials by copy-pasting this into your terminal git clone https://bitbucket.org/occam/docker-environment-ubuntu14.04.git occam pull docker-environment-ubuntu14.04 cd docker-environment-ubuntu14.04 && occam build && cd.. git clone https://bitbucket.org/occam/configuration-sst_tutorial_configuration.git occam pull configuration-sst_tutorial_configuration git clone https://bitbucket.org/occam/prospero-traces.git occam pull prospero-traces git clone https://bitbucket.org/occam/configuration-generator-dramsim2-config-generator.git occam pull configuration-generator-dramsim2-config-generator git clone https://bitbucket.org/occam/plotter-plotly.js.git occam pull plotter-plotly.js git clone https://luisfnqoliveira@bitbucket.org/occam/script-plotter.git occam pull script-plotter 13
Building the simulator Resources are the software that our OCCAM object wraps (a) Go to the simulator-sst-sc16 directory (b) Install the SST resources 14
Building the simulator Now we need to build the imported SST STOP Building SST takes a long time, therefore, we have built it for you in advance. If you want to use the pre-built version, please skip the next slide. If you have the time to build, you can continue to the next slide. 15
Building the simulator Import associates the source repository We need to build the imported SST (a) Build SST 16
Accessing OCCAM Use your laptop s web browser to access your OCCAM instance for exercise 1 Follow instructions in the handout on exercise 1 access Warning: Your browser may complain about the certificate. When this happens, follow the browser instructions to add an exception. 17
Accessing OCCAM Create an OCCAM account First click Signup Then add username & password * 18
Using SST with OCCAM SST is a framework to build simulators Instantiate a specific simulator with SST Specify/develop modules, connections, parameters E.g., Prospero + simpledram Instantiated simulator Used in experiments Need to specify input, output, run to OCCAM Automatically extract OCCAM specifications Query instantiated simulator to derive specifications Generate specification May require manual specification in some cases 19
Using SST with OCCAM Add a new simulator (done only once!) 1. Create a workset 2. Create a workflow to instantiate sim in OCCAM 3. Run to extract specifications & make objects Then, use simulator for experiments 1. Define simulation workflow in the workset 2. Run workflow to get simulator results 3. Repeat as necessary (Note: OCCAM s workflow capability is used for both instantiation of an SST simulator as well as running experiments.) 20
Add a new SST simulator 21
Create a workset Workset: Collection of experiments Create a new workset named Ex 1 workset Used to create and maintain OCCAM objects (a) click here to access worksets (b) give new workset a name (c) click to make workset! 22
Create a workflow Workflow: Steps to do an experiment Use workflow to instantiate simulator in OCCAM We first add a new workflow object (a) go to bottom of workset page (b) give workflow a good descriptive name (c) click to add the workflow 23
Create a workflow Add the SST block This block instantiates SST simulators (a) Select the empty block (b) And then click on the top section of the box 24
Create a workflow Add the SST block This block instantiates SST simulators (a) Type simulator-instantiator (b) Select the simulatorinstantiator option 25
Create a workflow Add the SST block This block instantiates SST simulators (a) Add SST as the framework on the middle section (b) Click Attach 26
Create a workflow Add a block to the simulator Specifies configuration to instantiate simulator E.g., SST elements and their connections Click plus sign to add a new block 27
Create a workflow Add the SST configuration block We ve prepared some for the tutorial (a) Click top section and search for configuration (b) Click configuration 28
Create a workflow Add the SST configuration block We ve prepared some for the tutorial (a) Click middle section and search for SST Tutorial Configuration (c) Click attach (hidden) (b) Select SST Tutorial Configuration 29
Create a workflow Let s name the instantiated simulator (a) Click the SST configuration tab Careful: check that you are using the General Options subtab (b) Name simulator: Simulator simpledram (c) Click Update (scroll down) 30
Create a workflow Now, we specify the SST simulator itself Use an SST python script Configures prospero + simpledram (a) Click the SST Tutorial configuration tab (b) Select config_prosperosimpledram.py (c) Click Update 31
Run the workflow Instantiate simulator by executing workflow Extracts specifications & objects for OCCAM Associates SST simulator with the named object (a) Select the Run tab (b) Click Run 32
Run the workflow Instantiate simulator by executing workflow Extracts specifications & objects for OCCAM Associates SST simulator with the named object Wait until the run finishes 33
Check your work! Verify that we have generated the simulator (a) Refresh web page (not shown) (b) Click Output tab (c) Check for new simulator 34
Using an SST simulator (to run experiments!) 35
Assemble an experiment Now, we can use the simulator We will create an experiment that executes the simulator on traces to determine the memory latency using simpledram Go back to Ex 1 workset Click on the link on the top left of the page 36
Create new experiment We ll follow similar steps to make an experiment with a workflow We just created this experiment to instantiate simulator 37
Create new experiment We ll follow similar steps to make an experiment with a workflow (a) Add an experiment object (b) Give experiment a name (c) Add the experiment 38
Add simulator to workflow Use the simulator that you just created (a) Select empty block and select simulator in top section (not shown ) (c) Click attach (hidden) (b) Click middle section and search for Simulator simpledram (the name we gave the instantiated sim) 39
Add traces for simulator Simulator needs memory operations Trace is the input, gathered from benchmarks Click plus to add an input (trace) to the instantiated simulator 40
Add traces to simulator Insert trace object as the simulator s input (a) Type trace in top section (b) Click middle section and search for Prospero Traces (c) Click Attach to add a trace object into the workflow (hidden) 41
Add traces for simulator Now, we need to select specific traces First, check your work does it match? Is your workflow the same? 42
Add traces for simulator Specific traces that can be used with workflow are added as parameters to the trace (a) Click Prospero Traces tab (b) Select all traces to add each one for a separate simulation run (c) Click Update to save parameters for the trace object 43
Run the experiment Submit the workflow to a job scheduler to execute the experiment. (a) Click Run tab (b) Click Run to dispatch workflow. You should see it executing. 44
Run the experiment Submit the workflow to a job scheduler to execute the experiment. Example of output from the running experiment Wait until the run finishes 45
Viewing the output Verify that we have generated the output (a) Refresh web page, then click on Output tab (b) Check for the output files 46
Viewing the output Verify that we have generated the output Click on the output to view it 47
Viewing the output Verify that we have generated the output Trace file used Inputs (omitted information) Results 48
Create a report 49
Create a report with plot Go back to Ex 1 workset Click on the link on the top left of the page 50
Create a report with plot A report allows visualizing results Widgets can be associated with report, such as a script to plot the results (a) Add a new object of type paper (b) Name it SST Report (c) Click Add 51
Create a report with plot A page is used to hold content in the report We ll add the plot to a page (a) Add a Page (b) Give the page the name Results (c) Click Add 52
Create a report with a plot A widget is a script on a Page (in this case, to plot results) (a) Select the Results page from the report (b) Click the Plus Brings up Add Component (c) Select widget (d) Click Add 53
Create a report with a plot We have an unloaded widget Need to specify a widget for plotting (a) Hover the mouse on this spot to show the configuration button (b) Click configuration button 54
Create a report with a plot The widget is a filter that operates on results (a) Search for plotly (b) Select the plotly.js widget (c) click Attach (hidden) 55
Add results to the plot Let s plot results from running the simulation Navigate the drop down options to the experiment we just ran and click on the output (a) Select Datasets tab (b) Navigate dropdowns from Open From Workset (c) Click on the output 56
Add results to the plot Select the data from results to plot (a) Click on the tab you just opened (b) Search for prospero0.trace (Note: not prospero1.trace ) (c) Collapse the inputs 57
Add results to the plot Select the data from results to plot (a) Select the results: Memory cycles_attempted_issue_but_rejected SimTime (b) Select Groups (create a new data group for the plot) (c) Click Append 58
Add results to the plot Select the data from results to plot (b) Collapse the inputs (a) Search for prospero1.trace 59
Add results to the plot Select the data from results to plot (a) Select the results: Memory cycles_attempted_issue_but_rejected SimTime (b) Select Groups[0] (add data to the previously created group) (c) Click Append 60
Set how to plot the results Resize the plot area (a) Drag this down to reveal the plot
Set how to plot the results We ll use a bar chart (a) Click on Data tab (b) Change Type to Bar (c) Change Name to Prospero+simpleDRAM (d) Change Color to red 62
Set the plot layout (a) Click on Layout tab (b) Set the title Runtime of traces (c) Set the X-axis name Trace file 63
The Final Result! Click here to save the changes Two bars corresponding to the two trace files. Check your plot against this one. Note that your the values may be different. 64
Modify an SST configuration We will switch the memory simulator from simpledram to DRAMsim2. Estimated time: 5 minutes 65
Modify SST configuration Instantiate a new simulator The new simulator will use DRAMsim2 Instantiate simulator like the first one (a) Return to Ex 1 Workset 66
Modify SST configuration Instantiate a new simulator The new simulator will use DRAMsim2 Instantiate simulator like the first one (a) Return to the first experiment to instantiate a new simulator 67
Modify SST configuration Instantiate a new simulator The new simulator will use DRAMsim2 Instantiate simulator like the first one (b) Select the SST Tutorial Configuration tab 68
Modify SST configuration Instantiate a new simulator SST configuration script changes the backend to use DRAMsim2. Need to select this script. (a) Select config_prosperodramsim2.py (b) Deselect the config_prosperosimpledram.py (c) Click Update 69
Modify SST configuration Instantiate a new simulator Let s give the simulator a new name (a) Select the SST->General Options tab (b) Name the simulator Simulator DRAMSIM2 (c) Click Update 70
Modify SST configuration Instantiate a new simulator Re-run the workflow to create the various objects required by OCCAM for the new sim (a) Click the Run tab (b) Click Run 71
Modify SST configuration Instantiate a new simulator Wait until the run finishes 72
Modify SST configuration Instantiate a new simulator Verify that we have generated the simulator (a) Refresh web page (not shown) (b) Click Output tab (c) Check for new simulator 73
Run an experiment with the new simulator Estimated time: 20 minutes 74
Run a new experiment Go back to Ex 1 workset Click on the link on the top left of the page 75
Run a new experiment Define an experiment Make a new experiment with the simulator using DRAMsim2 (a) Create a new experiment (b) Name simulator SST DRAMSIM2 (c) Click add 76
Run a new experiment Setup the workflow We ll make a new workflow, adding the new simulator with trace inputs and memory config (a) Select the Workflow tab (b) Select the empty block, and then select simulator in top section (c) Click the middle section and search for Simulator DRAMSIM2 (d) Click Attach (hidden) 77
Run a new experiment Setup the workflow Does your workflow look like this? Click the plus 78
Run a new experiment Setup the workflow Add a trace input to the simulator (a) Type trace in top section (b) Click middle section and search for Prospero Traces (c) Click Attach 79
Run a new experiment Configuring DRAMsim2 DRAMsim2 uses configuration files as input Defines various memory parameters (e.g., timing) Provided as two input files, which could be added similarly to the workflow as traces We ll use a configuration tab in the workflow Described by an input schema for DRAMsim2 object in OCCAM Permits easily changing parameters on the fly 80
Run a new experiment Configuring DRAMsim2 Add a DRAMsim2 configuration to the workflow Does your workflow look like this? (a) Select the bottom plus 81
Run a new experiment Configuring DRAMsim2 Add a DRAMsim2 configuration to the workflow (a) Type configuration in top section (b) Select new configuration in the middle section (c) Click Attach (not shown) 82
Run a new experiment Configuring DRAMsim2 Add block to output configuration files Part of workflow to generate DRAMsim2 config Does your workflow look like this? (b) Select the bottom plus 83
Run a new experiment Configuring DRAMsim2 Add block to output configuration files Part of workflow to generate DRAMsim2 config (a) Type configuration-generator in the top section (b) Select DRAMSIM2-configgenerator in the middle section (c) Click Attach (hidden) 84
Run a new experiment Configuring DRAMsim2 Now we need to select which trace files we want to use. But first, check your work. Does your workflow look like this? 85
Run a new experiment Setup the traces in workflow Specify the traces to run with simulator (a) Click Prospero Traces tab (b) Select all traces to add each one for a separate simulation run (c) Click Update to save parameters for the trace object 86
Run a new experiment Setup the traces in workflow With this workflow, it is easy to change the DRAMSim2 configuration For example: change the row buffer policy to close_page. Forcing the memory row to be closed after each read. 87
Run a new experiment Setup the traces in workflow (a) Click DRAMSim2-config-generator tab (c) Change the Row Buffer Policy to close_page (b) Select System Configuration (d) Click Update 88
Run a new experiment Execute the workflow Let s run the workflow with the new simulator! (a) Select the Run tab (b) Click Run 89
Run a new experiment Execute the workflow Workflow is the task graph. Handed to a job scheduler to execute the experiment. Example of output from the running experiment Wait until the run finishes 90
Run a new experiment Check the output Check we got output and view it (a) Refresh web page, then click on Output tab (b) Click to take a look! 91
Modify the report 92
Run a new experiment Add data to the report (a) Go back to the Ex 1 Workset (b) Open the previously created SST Report 93
Run a new experiment Add data to the report (a) Select the Results page from the report (b) Hover the mouse on this spot to show the configuration button (c) Click configuration button 94
Run a new experiment Add results to the plot Let s plot the new results from running the simulation Navigate the drop down options to the experiment we just ran and click on the output (a) Select Datasets (b) Navigate dropdowns from Open From Workset (c) Click on output 95
Run a new experiment Add results to the plot Select the data from results to plot (a) Click on the tab you just opened (b) Search for prospero0.trace (Note: not prospero1.trace ) (c) Collapse the inputs 96
Run a new experiment Add results to the plot Select the data from results to plot (a) Select the results: Memory cycles_attempted_issue_but_rejected SimTime (b) Select Groups (create a new data group for the plot) (c) Click Append 97
Run a new experiment Add results to the plot Select the data from results to plot (b) Collapse the inputs (a) Search for prospero1.trace 98
Run a new experiment Add results to the plot Select the data from results to plot (a) Select the results: Memory cycles_attempted_issue_but_rejected SimTime (b) Select Groups[1] (add data to the newly created group) (c) Click Append 99
Run a new experiment Set how to plot the results We ll use a bar chart (a) Click on Data tab (b) Scroll down to the new data (c) Change Type to Bar (d) Change Name to Prospero+DRAMsim2 (e) Change Color to green 100
Run a new experiment The Final Result! Click here to save the changes Two bars corresponding to the two trace files. Check your plot against this one. Note that your the values may be different. 101
Acknowledgments http://sst-simulator.org http://occam.cs.pitt.edu We gratefully acknowledge the support and collaboration of our research partners. Portions of this material is based in part upon work supported by the National Science Foundation under Grant Numbers CCF-142331, CNS-1012070, ACI-1535232, CNS1305220 and CCF-1148646. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation. 102