0

I need to run a series of program execution simulations both on MIPS and ARM processors, for that I'm using a benchmark called MPSoCBench. In total there will be over 200 simulations, so I created a bash script to execute it one by one and save the output to a file. However, for some reason, it is not redirecting the output like it should be.

Here is the bash script:

source env.sh
echo "Simulation start"
./MPSoCBench -p=mips -s=stringsearch -i=noc.lt -n=1 -r > output/MIPS/stringsearch/stringsearch-1.out
./MPSoCBench -p=mips -s=stringsearch -i=noc.lt -n=2 -r > output/MIPS/stringsearch/stringsearch-2.out
./MPSoCBench -p=mips -s=stringsearch -i=noc.lt -n=4 -r > output/MIPS/stringsearch/stringsearch-4.out
./MPSoCBench -p=mips -s=stringsearch -i=noc.lt -n=8 -r > output/MIPS/stringsearch/stringsearch-8.out

./MPSoCBench -p=mips -s=dijkstra -i=noc.lt -n=1 -r > output/MIPS/dijkstra/dijkstra-1.out
./MPSoCBench -p=mips -s=dijkstra -i=noc.lt -n=2 -r > output/MIPS/dijkstra/dijkstra-2.out
./MPSoCBench -p=mips -s=dijkstra -i=noc.lt -n=4 -r > output/MIPS/dijkstra/dijkstra-4.out
./MPSoCBench -p=mips -s=dijkstra -i=noc.lt -n=8 -r > output/MIPS/dijkstra/dijkstra-8.out

./MPSoCBench -p=mips -s=sha -i=noc.lt -n=1 -r > output/MIPS/sha/sha-1.out
./MPSoCBench -p=mips -s=sha -i=noc.lt -n=2 -r > output/MIPS/sha/sha-2.out
./MPSoCBench -p=mips -s=sha -i=noc.lt -n=4 -r > output/MIPS/sha/sha-4.out
./MPSoCBench -p=mips -s=sha -i=noc.lt -n=8 -r > output/MIPS/sha/sha-8.out

./MPSoCBench -p=mips -s=basicmath -i=noc.lt -n=1 -r > output/MIPS/basicmath/basicmath-1.out
./MPSoCBench -p=mips -s=basicmath -i=noc.lt -n=2 -r > output/MIPS/basicmath/basicmath-2.out
./MPSoCBench -p=mips -s=basicmath -i=noc.lt -n=4 -r > output/MIPS/basicmath/basicmath-4.out
./MPSoCBench -p=mips -s=basicmath -i=noc.lt -n=8 -r > output/MIPS/basicmath/basicmath-8.out

./MPSoCBench -p=mips -s=susanedges -i=noc.lt -n=1 -r > output/MIPS/susanedges/susanedges-1.out
./MPSoCBench -p=mips -s=susanedges -i=noc.lt -n=2 -r > output/MIPS/susanedges/susanedges-2.out
./MPSoCBench -p=mips -s=susanedges -i=noc.lt -n=4 -r > output/MIPS/susanedges/susanedges-4.out
./MPSoCBench -p=mips -s=susanedges -i=noc.lt -n=8 -r > output/MIPS/susanedges/susanedges-8.out

./MPSoCBench -p=mips -s=susansmoothing -i=noc.lt -n=1 -r > output/MIPS/susansmoothing/susansmoothing-1.out
./MPSoCBench -p=mips -s=susansmoothing -i=noc.lt -n=2 -r > output/MIPS/susansmoothing/susansmoothing-2.out
./MPSoCBench -p=mips -s=susansmoothing -i=noc.lt -n=4 -r > output/MIPS/susansmoothing/susansmoothing-4.out
./MPSoCBench -p=mips -s=susansmoothing -i=noc.lt -n=8 -r > output/MIPS/susansmoothing/susansmoothing-8.out

./MPSoCBench -p=mips -s=susancorners -i=noc.lt -n=1 -r > output/MIPS/susancorners/susancorners-1.out
./MPSoCBench -p=mips -s=susancorners -i=noc.lt -n=2 -r > output/MIPS/susancorners/susancorners-2.out
./MPSoCBench -p=mips -s=susancorners -i=noc.lt -n=4 -r > output/MIPS/susancorners/susancorners-4.out
./MPSoCBench -p=mips -s=susancorners -i=noc.lt -n=8 -r > output/MIPS/susancorners/susancorners-8.out

#Começo das simulações ARM

./MPSoCBench -p=arm -s=stringsearch -i=noc.lt -n=1 -r > output/ARM/stringsearch/stringsearch-1.out
./MPSoCBench -p=arm -s=stringsearch -i=noc.lt -n=2 -r > output/ARM/stringsearch/stringsearch-2.out
./MPSoCBench -p=arm -s=stringsearch -i=noc.lt -n=4 -r > output/ARM/stringsearch/stringsearch-4.out
./MPSoCBench -p=arm -s=stringsearch -i=noc.lt -n=8 -r > output/ARM/stringsearch/stringsearch-8.out

./MPSoCBench -p=arm -s=dijkstra -i=noc.lt -n=1 -r > output/ARM/dijkstra/dijkstra-1.out
./MPSoCBench -p=arm -s=dijkstra -i=noc.lt -n=2 -r > output/ARM/dijkstra/dijkstra-2.out
./MPSoCBench -p=arm -s=dijkstra -i=noc.lt -n=4 -r > output/ARM/dijkstra/dijkstra-4.out
./MPSoCBench -p=arm -s=dijkstra -i=noc.lt -n=8 -r > output/ARM/dijkstra/dijkstra-8.out

./MPSoCBench -p=arm -s=sha -i=noc.lt -n=1 -r > output/ARM/sha/sha-1.out
./MPSoCBench -p=arm -s=sha -i=noc.lt -n=2 -r > output/ARM/sha/sha-2.out
./MPSoCBench -p=arm -s=sha -i=noc.lt -n=4 -r > output/ARM/sha/sha-4.out
./MPSoCBench -p=arm -s=sha -i=noc.lt -n=8 -r > output/ARM/sha/sha-8.out

./MPSoCBench -p=arm -s=basicmath -i=noc.lt -n=1 -r > output/ARM/basicmath/basicmath-1.out
./MPSoCBench -p=arm -s=basicmath -i=noc.lt -n=2 -r > output/ARM/basicmath/basicmath-2.out
./MPSoCBench -p=arm -s=basicmath -i=noc.lt -n=4 -r > output/ARM/basicmath/basicmath-4.out
./MPSoCBench -p=arm -s=basicmath -i=noc.lt -n=8 -r > output/ARM/basicmath/basicmath-8.out

./MPSoCBench -p=arm -s=susanedges -i=noc.lt -n=1 -r > output/ARM/susanedges/susanedges-1.out
./MPSoCBench -p=arm -s=susanedges -i=noc.lt -n=2 -r > output/ARM/susanedges/susanedges-2.out
./MPSoCBench -p=arm -s=susanedges -i=noc.lt -n=4 -r > output/ARM/susanedges/susanedges-4.out
./MPSoCBench -p=arm -s=susanedges -i=noc.lt -n=8 -r > output/ARM/susanedges/susanedges-8.out

./MPSoCBench -p=arm -s=susansmoothing -i=noc.lt -n=1 -r > output/ARM/susansmoothing/susansmoothing-1.out
./MPSoCBench -p=arm -s=susansmoothing -i=noc.lt -n=2 -r > output/ARM/susansmoothing/susansmoothing-2.out
./MPSoCBench -p=arm -s=susansmoothing -i=noc.lt -n=4 -r > output/ARM/susansmoothing/susansmoothing-4.out
./MPSoCBench -p=arm -s=susansmoothing -i=noc.lt -n=8 -r > output/ARM/susansmoothing/susansmoothing-8.out

./MPSoCBench -p=arm -s=susancorners -i=noc.lt -n=1 -r > output/ARM/susancorners/susancorners-1.out
./MPSoCBench -p=arm -s=susancorners -i=noc.lt -n=2 -r > output/ARM/susancorners/susancorners-2.out
./MPSoCBench -p=arm -s=susancorners -i=noc.lt -n=4 -r > output/ARM/susancorners/susancorners-4.out
./MPSoCBench -p=arm -s=susancorners -i=noc.lt -n=8 -r > output/ARM/susancorners/susancorners-8.out
echo "Simulation end"

So for example, if I run: ./MPSoCBench -p=mips -s=susansmoothing -i=noc.lt -n=1 -r

the terminal output is:

[['mips'], ['1'], ['susansmoothing'], ['noc.lt']]
./platform.noc.lt.x susansmoothing.mips.x 1

        SystemC 2.3.1-Accellera --- May 26 2018 15:28:48
        Copyright (c) 1996-2014 by all Contributors,
        ALL RIGHTS RESERVED

NOC:

2 Lines

2 Columns

4 Peripherals

1 Masters

3 Slaves

0 Inactive Nodes

4 Wrappers for Masters/Slaves

Printing mesh!

mesh[0][0]: status-> 1  x->0  y->0
mesh[0][1]: status-> 1  x->0  y->1
mesh[1][0]: status-> 1  x->1  y->0
mesh[1][1]: status-> 1  x->1  y->1
Printing Table of routs!
Number of Active Lines in the table of routs: 4 
m[0]: 536870912 0 0
 m[1]: 553648128 0 1
 m[2]: 570425344 1 0
 m[3]: 587202560 1 1
 ArchC: Reading ELF application file: susansmoothing.mips.x


ArchC: -------------------- Starting Simulation --------------------

MPSoCBench: The simulator is prepared.
MPSoCBench: Beggining of time simulation measurement.


--------------------------------------------------------------------
--------------------------  MPSoCBench------------------------------
------------------- Running: susansmoothing ------------------------
--------------- The results will be available in -------------------
--------------------  the output.pgm file---------------------------
--------------------------------------------------------------------


Join Point->0 of 1 processors are not over yet...
Join Point->0 of 1 processors are not over yet...

ArchC: -------------------- Simulation Finished --------------------
Load word counter = 26316758
Store word counter = 12413560
Add Sub counter = 14802018
Mult Div counter = 7571964
Logic Op counter = 638874
Comparision Op counter = 2287692
Branches counter = 3022673
NOP counter = 22570205
SYSTEM Calls counter = 0

Info: /OSCI/SystemC: Simulation stopped by user.
ArchC: Simulation statistics
    Times: 33.87 user, 0.12 system, 33.58 real
    Number of instructions executed: 89623826
    Simulation speed: 2646.11 K instr/s
cache: IC
Cache statistics:
Read:   miss: 7792815 (8.69503%) hit: 81830929 (91.305%)
Write:  miss: 0 (0%) hit: 0 (0%)
Number of block evictions: 2911967
cache: DC
Cache statistics:
Read:   miss: 5480795 (20.9281%) hit: 20707932 (79.0719%)
Write:  miss: 534193 (4.3008%) hit: 11886589 (95.6992%)
Number of block evictions: 973023

Total Time Taken (seconds): 33.581356
Simulation advance (seconds):   0.634481
MPSoCBench: Ending the time simulation measurement.


Lock Access:    138
Memory Reads:   27615606 
Memory Writes:  24841564

TESTING RESULTS

Test Passed.

If I try to redirect this output to a file with the command: ./MPSoCBench -p=mips -s=susansmoothing -i=noc.lt -n=1 -r > output/MIPS/susansmoothing/susansmoothing-1

Then some weird stuff happen, first there is still terminal output:

        SystemC 2.3.1-Accellera --- May 26 2018 15:28:48
        Copyright (c) 1996-2014 by all Contributors,
        ALL RIGHTS RESERVED
ArchC: Reading ELF application file: susansmoothing.mips.x


ArchC: -------------------- Starting Simulation --------------------

ArchC: -------------------- Simulation Finished --------------------
Load word counter = 26316752
Store word counter = 12413554
Add Sub counter = 14802013
Mult Div counter = 7571962
Logic Op counter = 638873
Comparision Op counter = 2287692
Branches counter = 3022669
NOP counter = 22570200
SYSTEM Calls counter = 0

Info: /OSCI/SystemC: Simulation stopped by user.
ArchC: Simulation statistics
    Times: 35.22 user, 0.12 system, 34.93 real
    Number of instructions executed: 89623796
    Simulation speed: 2544.68 K instr/s
cache: IC
Cache statistics:
Read:   miss: 7793395 (8.69568%) hit: 81830320 (91.3043%)
Write:  miss: 0 (0%) hit: 0 (0%)
Number of block evictions: 2911975
cache: DC
Cache statistics:
Read:   miss: 5481489 (20.9307%) hit: 20707230 (79.0693%)
Write:  miss: 534593 (4.30402%) hit: 11886183 (95.696%)
Number of block evictions: 973878

Total Time Taken (seconds): 34.931891
Simulation advance (seconds):   0.634481
MPSoCBench: Ending the time simulation measurement.


Lock Access:    138
Memory Reads:   27618954 
Memory Writes:  24841552

Finally here is the file susansmoothing-1:

./platform.noc.lt.x susansmoothing.mips.x 1

NOC:

2 Lines

2 Columns

4 Peripherals

1 Masters

3 Slaves

0 Inactive Nodes

4 Wrappers for Masters/Slaves

Printing mesh!

mesh[0][0]: status-> 1  x->0  y->0
mesh[0][1]: status-> 1  x->0  y->1
mesh[1][0]: status-> 1  x->1  y->0
mesh[1][1]: status-> 1  x->1  y->1
Printing Table of routs!
Number of Active Lines in the table of routs: 4 
m[0]: 536870912 0 0
 m[1]: 553648128 0 1
 m[2]: 570425344 1 0
 m[3]: 587202560 1 1


--------------------------------------------------------------------
--------------------------  MPSoCBench------------------------------
------------------- Running: susansmoothing ------------------------
--------------- The results will be available in -------------------
--------------------  the output.pgm file---------------------------
--------------------------------------------------------------------


Join Point->0 of 1 processors are not over yet...
Join Point->0 of 1 processors are not over yet...

MPSoCBench: The simulator is prepared.
MPSoCBench: Beggining of time simulation measurement.


TESTING RESULTS

Test Passed.

[['mips'], ['1'], ['susansmoothing'], ['noc.lt']]

It is like some lines are redirected and other are not, what is going on here? Perhaps multi-threading? If so, how can I wait for the program to finish executing and then copy the terminal output to a file?

Thank you.

4
  • 1
    You might not be piping output on stderr. Try using &> instead of > (Bash 4+). Commented May 28, 2018 at 22:56
  • It's not about the stderr, I just tried it and the output was the same. Perhaps it has something to do with multi-threading. Commented May 28, 2018 at 23:01
  • For some reason the solution proposed by Tripp didn't work, but using &> did, @hnefatl can you post it as an answer? Commented May 28, 2018 at 23:06
  • 1
    As an aside, this looks like you would need to find out about for p in ARM MIPS; for s in stringsearch dijkstra sha ...etc; do for n in 1 2 3 4; do ./MPSoCBench -p="$p" -s="$s" -i=noc.lt -n="$n" -r > "output/$p/$s/$s-$n.out; done; done; done Commented May 29, 2018 at 4:14

1 Answer 1

1

The program output appears to be on STDERR instead of STDOUT. Give this a try:

./MPSoCBench -p=mips -s=dijkstra -i=noc.lt -n=2 -r > output/MIPS/dijkstra/dijkstra-2.out

changes to

./MPSoCBench -p=mips -s=dijkstra -i=noc.lt -n=2 -r > output/MIPS/dijkstra/dijkstra-2.out 2>&1

Note the 2>&1 added after the redirect. It sends STDERR -> STDOUT.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.