[go: nahoru, domu]

Skip to content

Commit

Permalink
[Linaro:ARM_CI] Stop running pip tests on AARCH64
Browse files Browse the repository at this point in the history
pip tests are no longer supported so stop running them
on AARCH64, run the python tests instead.
  • Loading branch information
elfringham committed Jun 15, 2023
1 parent 13e0702 commit a55931c
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 100 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/arm-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
is_nightly=0 && tf_project_name='tensorflow_cpu_aws' && ${{ github.event_name == 'schedule' }} && is_nightly=1 && tf_project_name='tf_nightly_cpu_aws'
echo "PyPI project name:" $tf_project_name
CI_DOCKER_BUILD_EXTRA_PARAMS="--build-arg py_major_minor_version=${{ matrix.pyver }} --build-arg is_nightly=${is_nightly} --build-arg tf_project_name=${tf_project_name}" \
./tensorflow/tools/ci_build/ci_build.sh cpu.arm64 bash tensorflow/tools/ci_build/rel/ubuntu/cpu_arm64_pip.sh
./tensorflow/tools/ci_build/ci_build.sh cpu.arm64 bash tensorflow/tools/ci_build/rel/ubuntu/cpu_arm64_nonpip.sh
- name: Upload pip wheel to PyPI
shell: bash
run: python3 -m twine upload --verbose /home/ubuntu/actions-runner/_work/tensorflow/tensorflow/whl/* -u "__token__" -p ${{ secrets.AWS_PYPI_ACCOUNT_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/arm-ci-extended.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
- name: Checkout repository
if: ${{ github.event_name == 'push' }}
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3.2.0
- name: Build binary and run non-pip tests
- name: Build binary and run python tests on nightly for all python versions
shell: bash
run: |
is_nightly=0 && tf_project_name='tf_ci_ext' && ${{ github.event_name == 'schedule' }} && is_nightly=1 && tf_project_name='tf_nightly_ci_ext'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/arm-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ jobs:
run: find /home/ubuntu/actions-runner/_work/tensorflow/tensorflow/. -name . -o -prune -exec sudo rm -rf -- {} + || true
- name: Checkout repository
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3.2.0
- name: Build and test pip wheel
- name: Build binary and run python tests
shell: bash
run: |
CI_DOCKER_BUILD_EXTRA_PARAMS="--build-arg py_major_minor_version=${{ matrix.pyver }} --build-arg is_nightly=1 --build-arg tf_project_name=tf_nightly_ci" \
./tensorflow/tools/ci_build/ci_build.sh cpu.arm64 bash tensorflow/tools/ci_build/rel/ubuntu/cpu_arm64_pip.sh
./tensorflow/tools/ci_build/ci_build.sh cpu.arm64 bash tensorflow/tools/ci_build/rel/ubuntu/cpu_arm64_nonpip.sh
- name: Upload pip wheel to GitHub
uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # v3.1.1
with:
Expand Down
4 changes: 2 additions & 2 deletions tensorflow/tools/ci_build/Dockerfile.cpu.arm64
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ FROM linaro/tensorflow-arm64-build:2.14-multipython

ARG py_major_minor_version='3.10'

ENV TF_PYTHON_VERSION=python${py_major_minor_version}
ENV PYTHON_BIN_PATH=/usr/bin/${TF_PYTHON_VERSION}
ENV TF_PYTHON_VERSION=${py_major_minor_version}
ENV PYTHON_BIN_PATH=/usr/bin/python${TF_PYTHON_VERSION}

RUN ln -s ${PYTHON_BIN_PATH} /usr/local/bin/python && \
ln -s ${PYTHON_BIN_PATH} /usr/local/bin/python3 && \
Expand Down
87 changes: 86 additions & 1 deletion tensorflow/tools/ci_build/rel/ubuntu/cpu_arm64_nonpip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,27 @@ set -x

source tensorflow/tools/ci_build/release/common.sh

# Strip leading and trailing whitespaces
str_strip () {
echo -e "$1" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//'
}

# Clean up bazel build & test flags with proper configuration.
update_bazel_flags() {
# Add git tag override flag if necessary.
GIT_TAG_STR=" --action_env=GIT_TAG_OVERRIDE"
if [[ -z "${GIT_TAG_OVERRIDE}" ]] && \
! [[ ${TF_BUILD_FLAGS} = *${GIT_TAG_STR}* ]]; then
TF_BUILD_FLAGS+="${GIT_TAG_STR}"
fi
# Clean up whitespaces
TF_BUILD_FLAGS=$(str_strip "${TF_BUILD_FLAGS}")
TF_TEST_FLAGS=$(str_strip "${TF_TEST_FLAGS}")
# Cleaned bazel flags
echo "Bazel build flags (cleaned):\n" "${TF_BUILD_FLAGS}"
echo "Bazel test flags (cleaned):\n" "${TF_TEST_FLAGS}"
}

sudo install -o ${CI_BUILD_USER} -g ${CI_BUILD_GROUP} -d /tmpfs
sudo install -o ${CI_BUILD_USER} -g ${CI_BUILD_GROUP} -d /tensorflow
sudo chown -R ${CI_BUILD_USER}:${CI_BUILD_GROUP} /usr/local/lib/python*
Expand Down Expand Up @@ -75,6 +96,7 @@ export TF_TEST_FLAGS="${TF_BUILD_FLAGS} \
--test_output=errors --verbose_failures=true --test_keep_going --notest_verbose_timeout_warnings"
export TF_TEST_TARGETS="${DEFAULT_BAZEL_TARGETS} ${ARM_SKIP_TESTS}"
export TF_FILTER_TAGS="-no_oss,-oss_excluded,-oss_serial,-v1only,-benchmark-test,-no_aarch64,-gpu,-tpu,-no_oss_py38,-no_oss_py39,-no_oss_py310"
export TF_AUDITWHEEL_TARGET_PLAT="manylinux2014"

if [ ${IS_NIGHTLY} == 1 ]; then
./tensorflow/tools/ci_build/update_version.py --nightly
Expand All @@ -84,13 +106,76 @@ sudo sed -i '/^build --profile/d' /usertools/aarch64.bazelrc
sudo sed -i '\@^build.*=\"/usr/local/bin/python3\"$@d' /usertools/aarch64.bazelrc
sed -i '$ aimport /usertools/aarch64.bazelrc' .bazelrc

# Override breaking change in setuptools v60 (https://github.com/pypa/setuptools/pull/2896)
export SETUPTOOLS_USE_DISTUTILS=stdlib

# Obtain the path to python binary as written by ./configure if it was run.
if [[ -e tools/python_bin_path.sh ]]; then
source tools/python_bin_path.sh
fi
# Assume PYTHON_BIN_PATH is exported by the script above or the caller.
if [[ -z "$PYTHON_BIN_PATH" ]]; then
die "PYTHON_BIN_PATH was not provided. Did you run configure?"
fi

# Local variables
WHL_DIR="${KOKORO_ARTIFACTS_DIR}/tensorflow/whl"
mkdir -p "${WHL_DIR}"
WHL_DIR=$(realpath "${WHL_DIR}") # Get absolute path

# Determine the major.minor versions of python being used (e.g., 3.7).
# Useful for determining the directory of the local pip installation.
PY_MAJOR_MINOR_VER=$(${PYTHON_BIN_PATH} -c "print(__import__('sys').version)" 2>&1 | awk '{ print $1 }' | head -n 1 | cut -d. -f1-2)

update_bazel_flags

bazel build \
--action_env=PYTHON_BIN_PATH=${PYTHON_BIN_PATH} \
${TF_BUILD_FLAGS} \
//tensorflow/tools/pip_package:build_pip_package \
|| die "Error: Bazel build failed for target: '${PIP_BUILD_TARGET}'"

./bazel-bin/tensorflow/tools/pip_package/build_pip_package ${WHL_DIR} ${NIGHTLY_FLAG} "--project_name" ${PROJECT_NAME} || die "build_pip_package FAILED"

PY_DOTLESS_MAJOR_MINOR_VER=$(echo $PY_MAJOR_MINOR_VER | tr -d '.')
if [[ $PY_DOTLESS_MAJOR_MINOR_VER == "2" ]]; then
PY_DOTLESS_MAJOR_MINOR_VER="27"
fi

# Set wheel path and verify that there is only one .whl file in the path.
WHL_PATH=$(ls "${WHL_DIR}"/"${PROJECT_NAME}"-*"${PY_DOTLESS_MAJOR_MINOR_VER}"*"${PY_DOTLESS_MAJOR_MINOR_VER}"*.whl)
if [[ $(echo "${WHL_PATH}" | wc -w) -ne 1 ]]; then
echo "ERROR: Failed to find exactly one built TensorFlow .whl file in "\
"directory: ${WHL_DIR}"
fi

# Print the size of the wheel file and log to sponge.
WHL_SIZE=$(ls -l ${WHL_PATH} | awk '{print $5}')
echo "Size of the PIP wheel file built: ${WHL_SIZE}"

# Repair the wheels for manylinux2014
echo "auditwheel repairing ${WHL_PATH}"
auditwheel repair --plat ${AUDITWHEEL_TARGET_PLAT}_$(uname -m) -w "${WHL_DIR}" "${WHL_PATH}"

if [[ $(ls ${WHL_DIR} | grep ${AUDITWHEEL_TARGET_PLAT} | wc -l) == 1 ]] ; then
WHL_PATH=${WHL_DIR}/$(ls ${WHL_DIR} | grep ${AUDITWHEEL_TARGET_PLAT})
echo "Repaired ${AUDITWHEEL_TARGET_PLAT} wheel file at: ${WHL_PATH}"
else
die "WARNING: Cannot find repaired wheel."
fi


bazel test ${TF_TEST_FLAGS} \
--repo_env=PYTHON_BIN_PATH="$(which python)" \
--repo_env=PYTHON_BIN_PATH="${PYTHON_BIN_PATH}" \
--build_tag_filters=${TF_FILTER_TAGS} \
--test_tag_filters=${TF_FILTER_TAGS} \
--local_test_jobs=$(grep -c ^processor /proc/cpuinfo) \
--build_tests_only \
-- ${TF_TEST_TARGETS}


# remove duplicate wheel and copy wheel to mounted volume for local access
rm -rf ${WHL_DIR}/*linux_aarch64.whl && cp -r ${WHL_DIR} .

# Remove virtual environment
remove_venv_ubuntu
93 changes: 0 additions & 93 deletions tensorflow/tools/ci_build/rel/ubuntu/cpu_arm64_pip.sh

This file was deleted.

0 comments on commit a55931c

Please sign in to comment.