Damn Simics

30
1 YANG DING @ CSE What the hell is Simics? September 21, 2007 (Part of the slides are from CSE 532 Tutorial) NOTE: Some of the contents here are outdated. Esp. Simics 2.0 is no longer supported by VirtuTech You have to install and use Simics 3.0.

description

introduction the simulator for solaris system

Transcript of Damn Simics

Page 1: Damn Simics

1

YANG DING @ CSE

What the hell isSimics?

September 21, 2007

(Part of the slides are from CSE 532 Tutorial)

NOTE: Some of the contents here are outdated. Esp. Simics 2.0 is no longer supported by VirtuTech.

You have to install and use Simics 3.0.

Page 2: Damn Simics

2

YANG DING @ CSE

Overview of Simics

• Virtutech Simics 3.0.x or 2.2.x – Academic licenses available in department– Get your own free for one year, renewable– http://www.virtutech.com

• Full system simulator– Operating System– Libraries, Applications

Page 3: Damn Simics

3

YANG DING @ CSE

Some keywords

• Host Machine– Where you run the simulation– Windows, Linux, Solaris host machines

• Target Machine– What you want to simulate

• Module

• Configuration

• Script

Page 4: Damn Simics

4

YANG DING @ CSE

Take a look

Page 5: Damn Simics

5

YANG DING @ CSE

Another look

Page 6: Damn Simics

6

YANG DING @ CSE

Last look

Page 7: Damn Simics

7

YANG DING @ CSE

What to simulate?

Symmetric Multiprocessor

Glueless Multiprocessor

CPU

Uniprocessor

Multiple-CMP

CMP CMP

CMP CMP

P

Chip Multiprocessor (CMP)

P P P

$ $ $ $

Credit: GEMS@Wisc

Page 8: Damn Simics

8

YANG DING @ CSE

System level simulator

• “Virtutech Simics is a full system simulation platform that provides a controlled, deterministic, and fully virtualized environment.”

• Models the entire machine that OS sees– it can run anything target system can

• Vital for tracing OS-intensive workload

• Simics is a hardware simulator

Page 9: Damn Simics

9

YANG DING @ CSE

Full System Simulation• Microprocessor design• Memory studies• Device development• Operating system emulation• OS development• Debugging• High-availability testing

– Please see the “Simics:A Full System Simulation Platform” paper for the details.

Page 10: Damn Simics

10

YANG DING @ CSE

Simics helps a lot

• Used in various research areas– Access to shared-memory system /

message-passing system– Run real parallel programs.– Inspect what happens in the system. (e.g.

examine cache coherent traffic.)– Study the system parameter’s impact to the

performance.– Test out new synchronization

atoms/coherent protocol.

Page 11: Damn Simics

11

YANG DING @ CSE

Fast or slow simulator?

• Simulate instruction by instruction

• Fast enough to run real applications

• 100x slowdown with statistics

• ~5-10MIPS. Faster than sim-fast, a simulator in the simplescalar suite

• However, the truth is that simulation is always slow

Page 12: Damn Simics

12

YANG DING @ CSE

Flexibility with modules

• User pluggable modules enable detailed simulation of required hardware components– Caches, out-of-order Microarchitecture,…

• A variety of statistics available to use• Simics API has more than 200 exported

functions, several data types, and more than 50 predefined interfaces. The API is written in C.

Page 13: Damn Simics

13

YANG DING @ CSE

Simulator Translation Cache

• STC enables statistical-accuracy as well as efficiency.– a mechanism in the simulator to improve s

imulator performance. Among other things, it filters uninteresting memory accesses from the memory hierarchy.

– istc-disable– dstc-disable

Page 14: Damn Simics

14

YANG DING @ CSE

How to simulate multiprocessors?

• Simulate on each processor for certain number of cycles

• cpu-switch-time– default: 1000 cycles

• Cycles– Number of cycles

• Steps– Number of instructions (os and application)

Page 15: Damn Simics

15

YANG DING @ CSE

Start Simics• cd $SIMICS_HOME• ./simics• ./simics -x firststeps.simics• ./simics -c configuration• -stall• -no-win• -help

Page 16: Damn Simics

16

YANG DING @ CSE

Pause/Stop the simulation

• ctrl + c• Temporal breakpoint

– cc N (cycles)– c N (steps)

• Memory/Register/IO breakpoint• Graphics breakpoint• Text output breakpoint• magic breakpoint

– magic instruction

Page 17: Damn Simics

17

YANG DING @ CSE

Checkpoints

• Save the states:– simics> write-configuration blabla– simics> exit

• Resume– ./simics -c blabla– simics> read-configuration blabla

Page 18: Damn Simics

18

YANG DING @ CSE

Access Host Files

• You can access the host file system by mounting it to the simulated machine.–The /host file system is mounted

as read-only–Do not execute files on host

system directly, instead, copy it to simulated machine and run

Page 19: Damn Simics

19

YANG DING @ CSE

Execution Model

• In-Order execution: An instruction can not be issued unless the previous instruction completes, no matter how many simulated cycle it takes.

• Out-of-Order execution (only available for sparc targets). Instruction stalls only if the instruction’s true dependencies are not completed.

Page 20: Damn Simics

20

YANG DING @ CSE

Default Timing Model

• Default timing model– In-Order execution: An instruction use

exact one clock cycle.– Out-of-Order execution: Control or data

dependency will cost one clock cycle.

Page 21: Damn Simics

21

YANG DING @ CSE

User Defined Timing Model

• Memory Hierarchy Interface– Instruction fetch visibility

• cpu0.instruction-fetch-mode instruction-cache-access-trace

– Timing model• User define a timing model function which will

be called when memory request occurs.• The function should return the number of

cycles to stall the instruction.• If return nonzero, Simics will stall that number

of cycles

Page 22: Damn Simics

22

YANG DING @ CSE

Setup your own Simics

• Simics 2.2.12– Build on what Chun LIU left years ago

• Simics 3.0.11– Build on the department installation

• Simics 3.0.29– Download it yourself

• Windows on x86• Linux on x86• Solaris on SPARC• Linux on AMD64

Note: As Simics is evolving quite rapidly and many bugs are fixed in later versions, users are generally recommend to upgrade. Possible compatibility issues are read in the RELEASENOTES.

Page 23: Damn Simics

23

YANG DING @ CSE

Setup Simics 2.2.12

• 1. go to any directory you want to install simics-2.2.12

• 2. run /home/csl/chliu/simics-2.2.12/scripts/user-in

stall.sh /home/scalp/chliu/simics-2.2.12/

• 3. run /home/mdl/yding/image/chliu.sh instead of /home/csl/chliu/simics-2.0/simics_install

• 4. go to simics-2.2.12/v9-sol8-64/lib• 5. make v9 • 6. go to simics-2.2.12/home/sarek

Successfully tested on eru as of 09/21/2007

Page 24: Damn Simics

24

YANG DING @ CSE

Setup Simics 2.2.12 (cont’d)

• You have a version to run!

• ./simics -c s1p– s2p, s4p, s8p as well in the directory

• Configurations from 2 to 24 processors available in /home/mdl/yding/image/– You may not be able to access, though– Most research work has results up tp 16 pr

ocessors

Page 25: Damn Simics

25

YANG DING @ CSE

Setup Simics 3.0.11

• Simics 3.0.11 Base Install Directory: /home/software/simics-3.0.11– home/ contains configurations of the targe

t machines.– src/ contains the framework for developing

new Simics modules (including the examples).

– {host}/ (such as v9-sol8-64/ or amd64-linux/) contains the object files and specific modules or libraries developed by the user.

Page 26: Damn Simics

26

YANG DING @ CSE

Setup Simics 3.0.11

• Create Personal Workspace– setenv SIMICS_HOME ./simics-workspace

– /home/software/simics-3.0.11/bin/workspace-setup $SIMICS_HOME

– Change dir to $SIMICS_HOME• compiler.mk: compiler configuration

• config.mk: general configuration (shouldn’t have to edit)

• GNUmakefile: The Makefile

• modules/: user-created module source code

• simics: simics executable

• targets/: configuration for various targets

• v9-sol8-64/: host-specific object and library files

Page 27: Damn Simics

27

YANG DING @ CSE

Recompiling Simics (with user modules)

• Change dir to $SIMICS_HOME

• Edit compiler.mk– Change the CC variable in v9-sol8-64 and a

dd a CXX variable:CC=cc –Kpic

CXX=cc

• Type gmake

• You should have an executable called simics

Page 28: Damn Simics

28

YANG DING @ CSE

Variations

• GEMS– Wisconsin

• http://www.cs.wisc.edu/gems/

– Version 1.3

• Flexus– CMU

• http://www.ece.cmu.edu/~simflex/flexus.html

– Version 2.1.1

Page 29: Damn Simics

29

YANG DING @ CSE

Resources

• Some intruduction papers online, such as Simics: A Full System Simulation Platform, IEEE Computer, 2002

• Simics User Guide– Much thinner than you think– Read it first

• Simics Forum– http://www.simics.net

• Quite a few people in CSE department

Page 30: Damn Simics

30

YANG DING @ CSE