summaryrefslogtreecommitdiffstats
path: root/scripts/t-rex-64
blob: c18db43f8502575c3978078839c4493f30a122fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#! /bin/bash
if [ $USER != 'root' ]; then
  echo 'Error: Please run as root (sudo etc.)'
  exit -1
fi

INPUT_ARGS=${@//[–—]/-} # replace bizarre minuses with normal one

./trex-cfg $INPUT_ARGS
RESULT=$?
if [ $RESULT -ne 0 ]; then
  exit $RESULT
fi


cd $(dirname $0)
export LD_LIBRARY_PATH=$PWD
saveterm="$(stty -g)"
# if we have a new core run optimized trex 
if  cat /proc/cpuinfo | grep -q avx ; then
    ./_$(basename $0) $INPUT_ARGS
    RESULT=$?
    if [ $? -eq 132 ]; then
        echo " WARNING this program is optimized for the new Intel processors.  "
        echo " try the ./t-rex-64-o application that should work for any Intel processor but might be slower. "
        echo " try to run t-rex-64-o .. "
        ./_t-rex-64-o $INPUT_ARGS
        RESULT=$?
    fi
else
        ./_t-rex-64-o $INPUT_ARGS
        RESULT=$?
fi
stty $saveterm  

if [ $RESULT -ne 0 ]; then
  exit $RESULT
fi