-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit_submodules.sh
executable file
·37 lines (31 loc) · 1.22 KB
/
init_submodules.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
#!/bin/bash
export AUTO_POWER_DIR=`cd $(dirname "$0"); pwd`
echo "Updating Automated Power Modeling submodules..."
git submodule update --init --recursive
# Verify Python is installed as python3
if [ -n "$(command -v python3)" ]; then
PYTHON_CMD="python3"
# Verify Python 3 is installed as python
elif [ -n "$(command -v python3)" ] && python -V 2>&1 | grep -q "Python 3"; then
PYTHON_CMD="python"
else
echo "Python 3 is not installed. Install Python to use CPUPowerSeer."
exit 1
fi
# Verify venv is installed
if ! "${PYTHON_CMD}" -c "import venv" 2>/dev/null; then
echo "'venv' module is not installed. Please install venv using pip to run CPUPowerSeer."
exit 1
fi
# CPUPowerSeer
echo "Installing CPUPowerSeer in a virtual environment"
if [ -d "${AUTO_POWER_DIR}/my_venv" ]; then
echo "Default virtual environment directory already exists. Removing ${AUTO_POWER_DIR}/my_venv"
rm -rf "${AUTO_POWER_DIR}"/my_venv
fi
python -m venv my_venv
source my_venv/bin/activate
pip install "${AUTO_POWER_DIR}"/CPUPowerSeer/
echo -e "\n\nCPUPowerSeer successfully installed in virtual environment 'my_venv'. Activate it running:"
echo -e "\tsource my_venv/bin/activate\e[0m"
echo "Then you can run CPUPowerSeer using 'powerseer' command"