$60 Bounty: Run Snipersim multi-core

Snipersim is a multi-core micro-architecture simulator written in C++. It mainly use Intel SDE library under the hood. It officially only supports Ubuntu and Docker.

Request:
I’d like to run Snipersim multi-core simulation on NixOS.

Problem:
Single-core workloads runs but multicore ones throws exception on NixOS.

Deliverables:

  • A flake.nix shell environment for the project where I can activate and run multi-core tests on Snipersim.
  • The example workload provided in the ./test/triangles/triangles.cc should be able to complete without throwing any errors.
  • A brief explanation of how did you debug the problem.

Requirements:

  • No buildFHSUserEnv

My attempt:
I can run single core workloads using this setup. By default, the main Makefile of the repo automatically downloads dependencies if their directories do not exist. Those dependencies are in precompiled form hence they need to be patched. To solve this issue, I have individually packaged those dependencies using autopatchelfhook and on flake shellHook their contents are copied from /nix/store to their respective directories in the repo.

To run my attempt:

  • Clone GitHub - hakan-demirli/snipersim_nix
  • Copy the patched derivations to local repo dir
    • nix develop or direnv allow
  • Compile the simulator: Snipersim
    • make -j 16
  • Compile and run the multicore workload
    • cd test/triangles && make
Error: No such file or directory
❯ make
Makefile:23: warning: overriding recipe for target 'clean'
../shared/Makefile.shared:35: warning: ignoring old recipe for target 'clean'
g++ -mno-sse4 -mno-sse4.1 -mno-sse4.2 -mno-sse4a -mno-avx -mno-avx2 -I/home/emre/Downloads/tmp/bounty/snipersim_nix/include  -flto -fopenmp -ffast-math -I../../gapbs/src    -c -o triangles.o triangles.cc
mkdir -p /home/emre/Downloads/tmp/bounty/snipersim_nix/test/triangles/build
g++ -flto -fopenmp -ffast-math triangles.o -lm -L/home/emre/Downloads/tmp/bounty/snipersim_nix/lib -pthread  -o /home/emre/Downloads/tmp/bounty/snipersim_nix/test/triangles/build/triangles
../../run-sniper -n 16 -- /home/emre/Downloads/tmp/bounty/snipersim_nix/test/triangles/build/triangles -f ../../dataset/cage3/cage3.mtx
[SNIPER] Start
[SNIPER] --------------------------------------------------------------------------------
[SNIPER] Sniper using SIFT/trace-driven frontend
[SNIPER] Running full application in DETAILED mode
[SNIPER] --------------------------------------------------------------------------------
[SNIPER] Enabling performance models
[SNIPER] Setting instrumentation mode to DETAILED
[RECORD-TRACE] Using the SDE frontend (sift/recorder)
NUM Threads: 16
Read Time:           0.00006
Build Time:          0.00001
Graph has 5 nodes and 14 directed edges for degree: 2
Number of triangles: 3
[TRACE:3] -- STOP --
[TRACE:9] -- STOP --
[TRACE:2] -- STOP --
[TRACE:5] -- STOP --
[TRACE:13] -- STOP --
[TRACE:15] -- STOP --
[TRACE:8] -- STOP --
[TRACE:6] -- STOP --
[TRACE:10] -- STOP --
[TRACE:4] -- STOP --
[TRACE:7] -- STOP --
[TRACE:11] -- STOP --
[TRACE:12] -- STOP --
[TRACE:14] -- STOP --
[TRACE:1] -- STOP --
zfstream.cc:205: virtual void cvifstream::read(char*, std::__1::streamsize): assertion "num_read == n || std::ferror(this->stream) == 0" failed
libc: zfstream.cc:205: virtual void cvifstream::read(char*, std::__1::streamsize): assertion "num_read == n || std::ferror(this->stream) == 0" failed
[SIFT:0] Error: No such file or directory
[TRACE:0] -- DONE --
[SNIPER] Disabling performance models
[SNIPER] Leaving ROI after 27.28 seconds
[SNIPER] Simulated 12.8M instructions, 3.9M cycles, 3.32 IPC
[SNIPER] Simulation speed 468.0 KIPS (29.3 KIPS / target core - 34184.6ns/instr)
[SNIPER] Setting instrumentation mode to FAST_FORWARD
[SNIPER] End
[SNIPER] Elapsed time: 28.62 seconds
# ../../run-sniper -n 16 -- /home/emre/Downloads/tmp/bounty/snipersim_nix/test/triangles/build/triangles -f ../../dataset/wiki-Vote/wiki-Vote.mtx


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
  • Compile and run the single-core workload
    • cd test/triangles_single && make
Correct Operation
❯ make
Makefile:23: warning: overriding recipe for target 'clean'
../shared/Makefile.shared:35: warning: ignoring old recipe for target 'clean'
g++ -mno-sse4 -mno-sse4.1 -mno-sse4.2 -mno-sse4a -mno-avx -mno-avx2 -I/home/emre/Downloads/tmp/bounty/snipersim_nix/include  -flto -fopenmp -ffast-math -I../../gapbs/src    -c -o triangles.o triangles.cc
mkdir -p /home/emre/Downloads/tmp/bounty/snipersim_nix/test/triangles_single/build
g++ -flto -fopenmp -ffast-math triangles.o -lm -L/home/emre/Downloads/tmp/bounty/snipersim_nix/lib -pthread  -o /home/emre/Downloads/tmp/bounty/snipersim_nix/test/triangles_single/build/triangles
../../run-sniper -n 1 -- /home/emre/Downloads/tmp/bounty/snipersim_nix/test/triangles_single/build/triangles -f ../../dataset/cage3/cage3.mtx
[SNIPER] Start
[SNIPER] --------------------------------------------------------------------------------
[SNIPER] Sniper using SIFT/trace-driven frontend
[SNIPER] Running full application in DETAILED mode
[SNIPER] --------------------------------------------------------------------------------
[SNIPER] Enabling performance models
[SNIPER] Setting instrumentation mode to DETAILED
[RECORD-TRACE] Using the SDE frontend (sift/recorder)
NUM Threads: 1
Read Time:           0.00004
Build Time:          0.00001
Graph has 5 nodes and 14 directed edges for degree: 2
Number of triangles: 3
[TRACE:0] -- DONE --
[SNIPER] Disabling performance models
[SNIPER] Leaving ROI after 19.16 seconds
[SNIPER] Simulated 3.2M instructions, 3.6M cycles, 0.88 IPC
[SNIPER] Simulation speed 165.4 KIPS (165.4 KIPS / target core - 6046.2ns/instr)
[SNIPER] Setting instrumentation mode to FAST_FORWARD
[SNIPER] End
[SNIPER] Elapsed time: 20.31 seconds
# ../../run-sniper -n 16 -- /home/emre/Downloads/tmp/bounty/snipersim_nix/test/triangles_single/build/triangles -f ../../dataset/wiki-Vote/wiki-Vote.mtx


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
4 Likes

I’ll give this a shot for a short period but no promises

Runs with this commit on multicore:

I added openmp and wget to the shell dependencies. wget wasn’t needed for the fix, but just for compiling since i don’t have wget on my system.

2 Likes

@purepani Thanks for solving the bounty! Can you please share your preferred payment method (the more possibility the better). And a way to contact you in private for this discussion. I did message you using discourse private message if that’s sufficient.

No problem; Discourse DMs should be ok.