Skip to content

Commit 372fcb1

Browse files
authored
Merge pull request tensorflow#5208 from yifeif/r0.11
Cherry-picks for 0.11.0rc2
2 parents 1a52bb1 + 974a861 commit 372fcb1

File tree

5 files changed

+63
-34
lines changed

5 files changed

+63
-34
lines changed

tensorflow/tools/ci_build/builds/test_installation.sh

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,8 @@
4747
# TF_BUILD_BAZEL_CLEAN, if set to any non-empty and non-0 value, directs the
4848
# script to perform bazel clean prior to main build and test steps.
4949
#
50-
# TF_BUILD_SERIAL_INSTALL_TESTS, if set to any non-empty and non-0 value,
51-
# will force the Python install tests to run serially, overriding than the
52-
# concurrent testing behavior.
50+
# TF_BUILD_USE_GPU, if set to 1, limits the number of concurrent tests to
51+
# the number stored in TF_GPU_COUNT and assigns each test to a different GPU.
5352
#
5453
# TF_GPU_COUNT, Set the number of GPUs in the system. We run only this many
5554
# concurrent tests when running GPU tests.
@@ -411,21 +410,21 @@ SKIP_COUNTER=0
411410
FAILED_TESTS=""
412411
FAILED_TEST_LOGS=""
413412

414-
N_JOBS=$(grep -c ^processor /proc/cpuinfo)
415-
if [[ -z ${N_JOBS} ]]; then
416-
# Try the Mac way of getting number of CPUs
417-
N_JOBS=$(sysctl -n hw.ncpu)
418-
fi
419-
420-
if [[ -z ${N_JOBS} ]]; then
421-
N_JOBS=8
422-
echo "Cannot determine the number of processors"
423-
echo "Using default concurrent job counter ${N_JOBS}"
424-
fi
425-
426-
if [[ ! -z "${TF_BUILD_SERIAL_INSTALL_TESTS}" ]] &&
427-
[[ "${TF_BUILD_SERIAL_INSTALL_TESTS}" != "0" ]]; then
413+
if [[ "${TF_BUILD_USE_GPU}" == "1" ]]; then
428414
N_JOBS=$TF_GPU_COUNT
415+
else
416+
N_JOBS=$(grep -c ^processor /proc/cpuinfo)
417+
if [[ -z ${N_JOBS} ]]; then
418+
# Try the Mac way of getting number of CPUs
419+
N_JOBS=$(sysctl -n hw.ncpu)
420+
fi
421+
422+
# If still cannot determine the number of CPUs, pick 8.
423+
if [[ -z ${N_JOBS} ]]; then
424+
N_JOBS=8
425+
echo "Cannot determine the number of processors"
426+
echo "Using default concurrent job counter ${N_JOBS}"
427+
fi
429428
fi
430429

431430
echo "Running Python tests-on-install with ${N_JOBS} concurrent jobs..."
@@ -485,9 +484,14 @@ while true; do
485484
TEST_LOGS="${TEST_LOGS} ${TEST_LOG}"
486485

487486
# Launch test asynchronously
488-
"${SCRIPT_DIR}/../gpu_build/parallel_gpu_execute.sh" \
487+
if [[ "${TF_BUILD_USE_GPU}" == "1" ]]; then
488+
"${SCRIPT_DIR}/../gpu_build/parallel_gpu_execute.sh" \
489+
"${SCRIPT_DIR}/py_test_delegate.sh" \
490+
"${PYTHON_BIN_PATH}" "${PY_TEST_DIR}/${TEST_BASENAME}" "${TEST_LOG}" &
491+
else
489492
"${SCRIPT_DIR}/py_test_delegate.sh" \
490-
"${PYTHON_BIN_PATH}" "${PY_TEST_DIR}/${TEST_BASENAME}" "${TEST_LOG}" &
493+
"${PYTHON_BIN_PATH}" "${PY_TEST_DIR}/${TEST_BASENAME}" "${TEST_LOG}" &
494+
fi
491495

492496
if [[ "${TEST_COUNTER}" -ge "${N_PAR_TESTS}" ]]; then
493497
# Run in exclusive mode

tensorflow/tools/ci_build/ci_build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ BUILD_TAG="${BUILD_TAG:-tf_ci}"
105105
# Add extra params for cuda devices and libraries for GPU container.
106106
if [ "${CONTAINER_TYPE}" == "gpu" ]; then
107107
# GPU pip tests-on-install concurrency is limited to the number of GPUs.
108-
GPU_EXTRA_PARAMS="${GPU_EXTRA_PARAMS} -e TF_BUILD_SERIAL_INSTALL_TESTS=1"
108+
GPU_EXTRA_PARAMS="${GPU_EXTRA_PARAMS} -e TF_BUILD_USE_GPU=1"
109109
else
110110
GPU_EXTRA_PARAMS=""
111111
fi

tensorflow/tools/dist_test/build_server.sh

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,14 @@
1616
#
1717
# Builds the test server for distributed (GRPC) TensorFlow
1818
#
19-
# Usage: build_server.sh <docker_image_name> [--test]
19+
# Usage: build_server.sh <docker_image_name> <whl_url> [--test]
20+
#
21+
# Arguments:
22+
# docker_image_name: Name of the docker image to build.
23+
# E.g.: tensorflow/tf_grpc_test_server:0.11.0rc1
24+
#
25+
# whl_url: URL from which the TensorFlow whl file will be downloaded.
26+
# E.g.: https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-cpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON2,label=cpu-slave/lastSuccessfulBuild/artifact/pip_test/whl/tensorflow-0.11.0rc1-cp27-none-linux_x86_64.whl
2027
#
2128
# The optional flag --test lets the script to use the Dockerfile for the
2229
# testing GRPC server. Without the flag, the script will build the non-test
@@ -33,28 +40,44 @@ die() {
3340
}
3441

3542
# Check arguments
36-
if [[ $# != 1 ]] && [[ $# != 2 ]]; then
37-
die "Usage: $0 <docker_image_name> [--test]"
43+
if [[ $# -lt 2 ]]; then
44+
die "Usage: $0 <docker_image_name> <whl_url> [--test]"
3845
fi
3946

4047
DOCKER_IMG_NAME=$1
41-
shift
48+
WHL_URL=$2
49+
shift 2
4250

4351
# Current script directory
4452
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
4553

46-
DOCKER_FILE="${DIR}/server/Dockerfile"
54+
BUILD_DIR=$(mktemp -d)
55+
echo ""
56+
echo "Using whl file URL: ${WHL_URL}"
57+
echo "Building in temporary directory: ${BUILD_DIR}"
58+
59+
cp -r ${DIR}/* "${BUILD_DIR}"/ || \
60+
die "Failed to copy files to ${BUILD_DIR}"
61+
62+
DOCKER_FILE="${BUILD_DIR}/server/Dockerfile"
4763
if [[ $1 == "--test" ]]; then
48-
DOCKER_FILE="${DIR}/server/Dockerfile.test"
64+
DOCKER_FILE="${BUILD_DIR}/server/Dockerfile.test"
4965
fi
5066
echo "Using Docker file: ${DOCKER_FILE}"
5167

68+
# Download whl file into the build context directory.
69+
wget -P "${BUILD_DIR}" ${WHL_URL} || \
70+
die "Failed to download tensorflow whl file from URL: ${WHL_URL}"
71+
5272
if [[ ! -f "${DOCKER_FILE}" ]]; then
5373
die "ERROR: Unable to find dockerfile: ${DOCKER_FILE}"
5474
fi
5575
echo "Dockerfile: ${DOCKER_FILE}"
5676

5777
# Call docker build
5878
docker build --no-cache -t "${DOCKER_IMG_NAME}" \
59-
-f "${DOCKER_FILE}" \
60-
"${DIR}"
79+
-f "${DOCKER_FILE}" "${BUILD_DIR}" || \
80+
die "Failed to build docker image: ${DOCKER_IMG_NAME}"
81+
82+
# Clean up docker build context directory.
83+
rm -rf "${BUILD_DIR}"

tensorflow/tools/dist_test/server/Dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,10 @@ RUN curl -O https://bootstrap.pypa.io/get-pip.py && \
3434
python get-pip.py && \
3535
rm get-pip.py
3636

37-
# Install TensorFlow CPU version from nightly build
38-
RUN pip --no-cache-dir install \
39-
https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-cpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON2,label=cpu-slave/lastSuccessfulBuild/artifact/pip_test/whl/tensorflow-0.11.0rc2-cp27-none-linux_x86_64.whl
37+
# Install TensorFlow wheel
38+
COPY tensorflow-*.whl /
39+
RUN pip install /tensorflow-*.whl && \
40+
rm -f /tensorflow-*.whl
4041

4142
# Copy files, including the GRPC server binary at
4243
# server/grpc_tensorflow_server.py

tensorflow/tools/dist_test/server/Dockerfile.test

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,10 @@ RUN curl -O https://bootstrap.pypa.io/get-pip.py && \
4040
# Install python panda for the census wide&deep test
4141
RUN pip install --upgrade pandas==0.18.1
4242

43-
# Install TensorFlow CPU version.
44-
RUN pip --no-cache-dir install \
45-
https://ci.tensorflow.org/view/Nightly/job/nightly-matrix-cpu/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON2,label=cpu-slave/lastSuccessfulBuild/artifact/pip_test/whl/tensorflow-0.11.0rc2-cp27-none-linux_x86_64.whl
43+
# Install TensorFlow wheel
44+
COPY tensorflow-*.whl /
45+
RUN pip install /tensorflow-*.whl && \
46+
rm -f /tensorflow-*.whl
4647

4748
# Copy files, including the GRPC server binary at
4849
# server/grpc_tensorflow_server.py

0 commit comments

Comments
 (0)