-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup-dev.sh
executable file
·66 lines (55 loc) · 1.89 KB
/
setup-dev.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
#!/usr/bin/env bash
# unofficial "bash strict mode"
# http://redsymbol.net/articles/unofficial-bash-strict-mode/
# Commented out 'u' because the `activate` script has some unassignment issues
# set -u
set -eo pipefail
IFS=$'\n\t'
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
build_virtualenv_dir="${DIR}/_python_build"
dev_dir="${DIR}/python_dev"
#max_build_threads=$(bc <<< "scale=0; ($(nproc) * 1.1) / 1" )
max_build_threads=$(nproc)
prep_virtualenv() {
install_dir=$1
python_path=$2
virtualenv --system-site-packages --python=$python_path $install_dir
source $install_dir/bin/activate
}
build_tensorflow() {
echo "Building using $max_build_threads threads"
git submodule update --init # in case you forget, or switched branches
#PYTHON_BIN_PATH=$(which python3) TF_NEED_GCP=0 TF_NEED_CUDA=0 ./configure
bazel build -j $max_build_threads --copt=-msse4.1 --copt=-msse4.2 //tensorflow/tools/pip_package:build_pip_package
}
prep_dirs() {
if [[ $OSTYPE == darwin* ]]; then
echo "Just....don't install on Mac. You're gonna have a bad time :/"
exit 2
sudo easy_install pip
else
# assume Ubuntu
# have to do this in case of ceph-common complaining
set +e
sudo apt-get -y install python3-pip python3-dev python-virtualenv
set -e
sudo pip3 install --upgrade pip setuptools wheel pysam
fi
[ ! -e $build_virtualenv_dir ] || rm -rf $build_virtualenv_dir
[ ! -e $dev_dir ] || rm -rf $dev_dir
mkdir $build_virtualenv_dir
mkdir $dev_dir
}
install_dev_build() {
pushd .
cd $build_virtualenv_dir
ln -sf ../bazel-bin/tensorflow/tools/pip_package/build_pip_package.runfiles/org_tensorflow/* .
ln -sf ../tensorflow/tools/pip_package/* .
python3 setup.py develop
popd
deactivate
}
build_tensorflow
prep_dirs
prep_virtualenv $dev_dir $(which python3)
install_dev_build