FPGA開発日記

カテゴリ別記事インデックス https://msyksphinz.github.io/github_pages , English Version https://fpgadevdiary.hatenadiary.com/

サイクルベースシミュレータSniperについて調査する

http://snipersim.org/download/980fe7028b4bf959/git/sniper.git

Sniperはサイクルベースのトレース型シミュレータだ。インストールの手順をメモしておく。

Docker上へのインストール方法は以下の通りだ。

cd sniper/docker
make # build the Docker image
make run # starts running the Docker image
cd .. # return to the base Sniper directory (while running inside of Docker)

普通にインストールする方法は以下のようになる。

Python2のままになっているっぽいので、いくつか修正する必要があった。

diff --git a/tools/checkdependencies.py b/tools/checkdependencies.py
index 465fda6..9b10618 100755
--- a/tools/checkdependencies.py
+++ b/tools/checkdependencies.py
@@ -46,7 +46,7 @@ def find_file(filename):

 for package, filename in DEPENDENCIES:
   if not find_file(filename):
-    print '*** Please install package %s' % package
+    print ('*** Please install package %s' % package)
     missing = True

diff --git a/tools/pinversion.py b/tools/pinversion.py
index 4643a15..64e5282 100755
--- a/tools/pinversion.py
+++ b/tools/pinversion.py
@@ -9,7 +9,7 @@ def run_pin(pin_home):
   try:
     ver = ex_ret(pin_home+"/pin -version")
     versplit = ver.split('pin-')[1].split('\n')[0].split('-')
-    print versplit[0] + '.' + versplit[1]
+    print (versplit[0] + '.' + versplit[1])
     return True
   except:
     return False
@@ -40,6 +40,6 @@ for line in file(headerfile):
       version[var] = res.group(1)
       break

-print version.get('PIN_PRODUCT_VERSION_MAJOR', '?') + '.' \
+print (version.get('PIN_PRODUCT_VERSION_MAJOR', '?') + '.' \
     + version.get('PIN_PRODUCT_VERSION_MINOR', '?') + '.' \
-    + version.get('PIN_BUILD_NUMBER', '?')
+    + version.get('PIN_BUILD_NUMBER', '?'))

インストールする。

sudo dpkg --add-architecture i386
sudo apt-get install binutils build-essential curl git libboost-dev libbz2-dev libc6:i386 libncurses5:i386 libsqlite3-dev libstdc++6:i386 python wget zlib1g-dev
make # or use 'make -j N' where N is the number of cores in your machine to use parallel make

テストは以下のように実行するらしい。

cd test/fft
make run
../../run-sniper -v -n 1 -c gainestown --roi -- ./fft -p 1
[SNIPER] Warning: Unable to use physical addresses for shared memory simulation.
[SNIPER] Running ['/home/msyksphinz/work/sniper/sniper/record-trace', '-o', '/tmp/tmpxMvPGj/run_benchmarks', '-v', '--roi', '-e', '1', '-s', '0', '-r', '1', '--follow', '--routine-tracing', '--', './fft', '-p', '1']
[SNIPER] Start
[SNIPER] Running ['bash', '-c', '/home/msyksphinz/work/sniper/sniper/lib/sniper -c /home/msyksphinz/work/sniper/sniper/config/base.cfg --general/total_cores=1 --general/output_dir=/home/msyksphinz/work/sniper/sniper/test/fft --config=/home/msyksphinz/work/sniper/sniper/config/nehalem.cfg --config=/home/msyksphinz/work/sniper/sniper/config/gainestown.cfg -g --general/magic=true -g --traceinput/stop_with_first_app=true -g --traceinput/restart_apps=false -g --traceinput/stop_with_first_app=false -g --traceinput/enabled=true -g --traceinput/emulate_syscalls=true -g --traceinput/num_apps=1 -g --traceinput/trace_prefix=/tmp/tmpxMvPGj/run_benchmarks']
[SNIPER] --------------------------------------------------------------------------------
[SNIPER] Sniper using SIFT/trace-driven frontend
[SNIPER] Running pre-ROI region in  CACHE_ONLY mode
[SNIPER] Running application ROI in DETAILED mode
[SNIPER] Running post-ROI region in FAST_FORWARD mode
[SNIPER] --------------------------------------------------------------------------------
[RECORD-TRACE] Using the Pin frontend (sift/recorder)
[SIFT_RECORDER] Running /home/msyksphinz/work/sniper/sniper/pin_kit/pin -mt -injection child -xyzzy -ifeellucky -follow_execv 1  -t /home/msyksphinz/work/sniper/sniper/sift/recorder/obj-intel64/sift_recorder -verbose 1 -debug 0 -roi 1 -roi-mpi 0 -f 0 -d 0 -b 0 -o /tmp/tmpxMvPGj/run_benchmarks -e 1 -s 0 -r 1 -pa 0 -rtntrace 1 -stop 0    -- ./fft -p 1
[SIFT_RECORDER:0:0] Output = [/tmp/tmpxMvPGj/run_benchmarks.app0.th0.sift]
[SIFT_RECORDER:0:0] Response = [/tmp/tmpxMvPGj/run_benchmarks_response.app0.th0.sift]

FFT with Blocking Transpose
   1024 Complex Doubles
   1 Processors
   65536 Cache lines
   16 Byte line size
   4096 Bytes per page

[SNIPER] Enabling performance models
[SNIPER] Setting instrumentation mode to DETAILED
[SIFT_RECORDER:0] ROI Begin
[SNIPER] Disabling performance models
[SNIPER] Leaving ROI after 0.97 seconds
[SNIPER] Simulated 1.2M instructions, 1.8M cycles, 0.70 IPC
[SNIPER] Simulation speed 1288.2 KIPS (1288.2 KIPS / target core - 776.3ns/instr)
[SNIPER] Sampling: executed 46.25% of simulated time in detailed mode
[SNIPER] Setting instrumentation mode to FAST_FORWARD
[SIFT_RECORDER:0[TRACE:0] -- DONE --
] ROI End

                 PROCESS STATISTICS
            Computation      Transpose     Transpose
 Proc          Time            Time        Fraction
    0               249             30       0.12048

                 TIMING INFORMATION
Start time                        :      -1844408300
Initialization finish time        :      -1844407900
Overall finish time               :      -1844407651
Total time with initialization    :              649
Total time without initialization :              249
Overall transpose time            :               30
Overall transpose fraction        :          0.12048

[SIFT_RECORDER:0:0] Recorded 1170005 (out of 1355603) instructions
[SNIPER] End
[SNIPER] Elapsed time: 3.67 seconds

Optional: Run '../../tools/cpistack.py' in this directory to generate cpi-stack output for this run
Optional: Run '../../tools/mcpat.py' in this directory to generate power output for this run
Optional: Run '../../tools/dumpstats.py' in this directory to view detailed statistics for this run
Optional: Run '../../tools/gen_topology.py' in this directory to view the system topology for this run

Sniper用語集

  • SIFT : Sniper Instruction Trace File Format
    • Dynamic Instruction stream generated by the Frontend