-
Notifications
You must be signed in to change notification settings - Fork 725
/
settings.sh
executable file
·135 lines (120 loc) · 6.37 KB
/
settings.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# Copyright 2017 Google LLC.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived from this
# software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
# Source this file---these options are needed for TF config and for
# successive bazel runs.
# Set this to 1 if the system image already has TensorFlow preinstalled. This
# will skip the installation of TensorFlow.
export DV_USE_PREINSTALLED_TF="${DV_USE_PREINSTALLED_TF:-0}"
export TF_NEED_GCP=1
export CUDNN_INSTALL_PATH="/usr/lib/x86_64-linux-gnu"
# The version of bazel we want to build DeepVariant.
# https://www.tensorflow.org/install/source#tested_build_configurations
DV_BAZEL_VERSION="5.3.0"
# We need to make sure that $HOME/bin is first in the binary search path so that
# `bazel` will find the latest version of bazel installed in the user's home
# directory. This is set in setting.sh as all DeepVariant scripts source
# settings.sh and assume that `bazel` will find the right version.
export PATH="$HOME/bin:$PATH"
# Path to the public bucket containing DeepVariant-related artifacts.
export DEEPVARIANT_BUCKET="gs://deepvariant"
export DV_PACKAGE_BUCKET_PATH="${DEEPVARIANT_BUCKET}/packages"
export DV_PACKAGE_CURL_PATH="https://storage.googleapis.com/deepvariant/packages"
# Set this to 1 to use the nightly (latest) build of TensorFlow instead of a
# named release version. Set it to an already existing value in the environment
# (allowing command line control of the build), defaulting to 0 (release build).
# Note that setting this to 1 implies that the C++ code in DeepVariant will be
# build using the master branch and not the pinned version to avoid
# incompatibilities between TensorFlow C++ used to build DeepVariant and the
# tf-nightly wheel.
export DV_TF_NIGHTLY_BUILD="${DV_TF_NIGHTLY_BUILD:-0}"
# The branch/tag we checkout to build our C++ dependencies against. This is not
# the same as the python version of TensorFlow we use, but should be similar or
# we risk having version incompatibilities between our C++ code and the Python
# code we use at runtime.
if [[ "${DV_TF_NIGHTLY_BUILD}" = "1" ]]; then
export DV_CPP_TENSORFLOW_TAG="master"
else
export DV_CPP_TENSORFLOW_TAG="v2.11.0"
fi
# These WHL_VERSIONs determine the Python version of TensorFlow we use.
export DV_GCP_OPTIMIZED_TF_WHL_VERSION="2.11.0"
export DV_TENSORFLOW_STANDARD_GPU_WHL_VERSION="2.11.0"
export DV_TENSORFLOW_STANDARD_CPU_WHL_VERSION="2.11.0"
# Set this to 1 to use DeepVariant with GPUs. Set it to an already existing
# value in the environment (allowing command line control of the build),
# defaulting to 0 (CPU only build).
export DV_GPU_BUILD="${DV_GPU_BUILD:-0}"
# If this variable is set to 1, DeepVariant will use a TensorFlow wheel file
# compiled with MKL support for corei7 or better chipsets, which
# significantly speeds up execution when running on modern CPUs. The default
# TensorFlow wheel files don't contain these instructions (and thereby run on a
# broader set of CPUs). Using this optimized wheel reduces the runtime of
# DeepVariant's call_variants step by >3x. This is called the GCP (Google Cloud
# Platform) optimized wheel because all GCP instances have at least Sandy Bridge
# or better chipsets, so this wheel should run anywhere on GCP.
export DV_USE_GCP_OPTIMIZED_TF_WHL="${DV_USE_GCP_OPTIMIZED_TF_WHL:-1}"
export GCP_OPTIMIZED_TF_WHL_FILENAME="tensorflow-${DV_GCP_OPTIMIZED_TF_WHL_VERSION}.deepvariant_gcp-cp27-none-linux_x86_64.whl"
export GCP_OPTIMIZED_TF_WHL_PATH="${DV_PACKAGE_BUCKET_PATH}/tensorflow"
export GCP_OPTIMIZED_TF_WHL_CURL_PATH="${DV_PACKAGE_CURL_PATH}/tensorflow"
export DV_TF_NUMPY_VERSION="1.19.2" # To match GCP_OPTIMIZED_TF_WHL_FILENAME
# Set this to 1 to make our prereq scripts install the CUDA libraries.
# If you already have CUDA installed, such as on a properly provisioned
# Docker image, it shouldn't be necessary.
export DV_INSTALL_GPU_DRIVERS="${DV_INSTALL_GPU_DRIVERS:-0}"
export PYTHON_VERSION=3.8
# shellcheck disable=SC2155
export PYTHON_BIN_PATH="$(which python${PYTHON_VERSION})"
export PYTHON_LIB_PATH="/usr/local/lib/python${PYTHON_VERSION}/dist-packages"
export USE_DEFAULT_PYTHON_LIB_PATH=1
# N.B. The --experimental_build_setting_api had to be added on protobuf
# upgrade to 3.9.2 to avoid error in bazel_skylib:
# "parameter 'build_setting' is experimental and thus unavailable with the
# current flags. It may be enabled by setting
# --experimental_build_setting_api"
# Presumably it won't be needed at some later point when bazel_skylib is
# upgraded again.
export DV_COPT_FLAGS="--copt=-march=corei7 --copt=-Wno-sign-compare --copt=-Wno-write-strings --experimental_build_setting_api --java_runtime_version=remotejdk_11"
function note_build_stage {
echo "========== [$(date)] Stage '${1}' starting"
}
function wait_for_dpkg_lock {
# Wait for at most 5 minutes.
echo "Calling wait_for_dpkg_lock."
max_wait=300
i=0
while sudo fuser /var/lib/dpkg/{lock,lock-frontend} >/dev/null 2>&1 ; do
echo "Waiting to obtain dpkg lock.."
sleep 10
((i=i+10))
if (( i > max_wait )); then
echo "ERROR: Waited for dpkg lock for 5 minutes."
exit 1
fi
done
}