forked from morganstanley/Xpedite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·81 lines (68 loc) · 2.02 KB
/
install.sh
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/usr/bin/env bash
################################################################################################
#
# Creates a virtual environment and installs xpedite python dependencies
#
# Download and install uarch spec and topdown metrics
#
# Author: Manikandan Dhamodharan, Morgan Stanley
#
################################################################################################
usage() {
cat << EOM
Usage: $0 [OPTION]...
Install xpedite profiler.
Mandatory arguments to long options are mandatory for short options too.
-v, --verbose verbose mode
-p, --enablePMU downloads files to enable performance counters
EOM
exit 1
}
ARGS=`getopt -o vp --long verbose,enablePMU -- "$@"`
if [ $? -ne 0 ]; then
usage
fi
eval set -- "$ARGS"
ENABLE_PMU=0
VERBOSE=0
while true ; do
case "$1" in
-p|--enablePMU)
ENABLE_PMU=1 ; shift ;;
-v|--verbose)
VERBOSE=1 ; shift ;;
--) shift ; break ;;
*) usage ;;
esac
done
XPEDITE_DIR=`dirname $0`
VENV_CMD=virtualenv
if ! type ${VENV_CMD} >/dev/null 2>&1; then
VENV_CMD=virtualenv2
if ! type ${VENV_CMD} >/dev/null 2>&1; then
echo xpedite requires python virtualenv to install dependencies. Please install virtualenv and run this script again
exit 1
fi
fi
${VENV_CMD} ${XPEDITE_DIR}/install/runtime
if [ $? -ne 0 ]; then
echo failed to create virtual environment ...
exit 1
fi
RUNTIME_DIR=${XPEDITE_DIR}/install/runtime/bin
${RUNTIME_DIR}/python -m pip --trusted-host pypi.org --trusted-host files.pythonhosted.org install -r ${XPEDITE_DIR}/scripts/lib/xpedite/requirements.txt
if [ $? -ne 0 ]; then
echo failed to install python dependencies...
exit 1
fi
export PATH=${RUNTIME_DIR}/bin:${PATH}
if [ ${ENABLE_PMU} -eq 1 ]; then
if [ ${VERBOSE} -eq 1 ]; then
echo 'downloading uarch spec and topdown metrics ...'
fi
#Download uarch spec database and pmu js
$XPEDITE_DIR/scripts/bin/xpedite list >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo failed to install micro architecture spec files
fi
fi