summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.circleci/config.yml37
-rwxr-xr-x.jenkins/pytorch/build.sh51
-rwxr-xr-x.jenkins/pytorch/test.sh26
3 files changed, 105 insertions, 9 deletions
diff --git a/.circleci/config.yml b/.circleci/config.yml
index 87bd7ada1c..f00c05a652 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -169,9 +169,15 @@ setup_ci_environment: &setup_ci_environment
export MAX_JOBS=$(( ${SCCACHE_MAX_JOBS} > ${MEMORY_LIMIT_MAX_JOBS} ? ${MEMORY_LIMIT_MAX_JOBS} : ${SCCACHE_MAX_JOBS} ))
echo "declare -x MAX_JOBS=${MAX_JOBS}" >> /home/circleci/project/env
- # This IAM user allows write access to S3 bucket for sccache
- echo "declare -x AWS_ACCESS_KEY_ID=${CIRCLECI_AWS_ACCESS_KEY_FOR_SCCACHE_S3_BUCKET_V3}" >> /home/circleci/project/env
- echo "declare -x AWS_SECRET_ACCESS_KEY=${CIRCLECI_AWS_SECRET_KEY_FOR_SCCACHE_S3_BUCKET_V3}" >> /home/circleci/project/env
+ if [[ "${JOB_BASE_NAME}" == *xla* ]]; then
+ # This IAM user allows write access to S3 bucket for sccache & bazels3cache
+ echo "declare -x AWS_ACCESS_KEY_ID=${CIRCLECI_AWS_ACCESS_KEY_FOR_SCCACHE_AND_XLA_BAZEL_S3_BUCKET_V1}" >> /home/circleci/project/env
+ echo "declare -x AWS_SECRET_ACCESS_KEY=${CIRCLECI_AWS_SECRET_KEY_FOR_SCCACHE_AND_XLA_BAZEL_S3_BUCKET_V1}" >> /home/circleci/project/env
+ else
+ # This IAM user allows write access to S3 bucket for sccache
+ echo "declare -x AWS_ACCESS_KEY_ID=${CIRCLECI_AWS_ACCESS_KEY_FOR_SCCACHE_S3_BUCKET_V3}" >> /home/circleci/project/env
+ echo "declare -x AWS_SECRET_ACCESS_KEY=${CIRCLECI_AWS_SECRET_KEY_FOR_SCCACHE_S3_BUCKET_V3}" >> /home/circleci/project/env
+ fi
fi
# This IAM user only allows read-write access to ECR
@@ -994,6 +1000,19 @@ jobs:
resource_class: large
<<: *pytorch_linux_test_defaults
+ pytorch_xla_linux_trusty_py3_6_gcc5_4_build:
+ environment:
+ JOB_BASE_NAME: pytorch-xla-linux-trusty-py3.6-gcc5.4-build
+ DOCKER_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/pytorch/pytorch-linux-trusty-py3.6-gcc5.4:278"
+ <<: *pytorch_linux_build_defaults
+
+ pytorch_xla_linux_trusty_py3_6_gcc5_4_test:
+ environment:
+ JOB_BASE_NAME: pytorch-xla-linux-trusty-py3.6-gcc5.4-test
+ DOCKER_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/pytorch/pytorch-linux-trusty-py3.6-gcc5.4:278"
+ resource_class: large
+ <<: *pytorch_linux_test_defaults
+
pytorch_linux_trusty_py3_6_gcc7_build:
environment:
JOB_BASE_NAME: pytorch-linux-trusty-py3.6-gcc7-build
@@ -3155,6 +3174,18 @@ workflows:
- pytorch_linux_trusty_py3_6_gcc7_test:
requires:
- pytorch_linux_trusty_py3_6_gcc7_build
+ - pytorch_xla_linux_trusty_py3_6_gcc5_4_build:
+ filters:
+ branches:
+ only:
+ - master
+ - pytorch_xla_linux_trusty_py3_6_gcc5_4_test:
+ filters:
+ branches:
+ only:
+ - master
+ requires:
+ - pytorch_xla_linux_trusty_py3_6_gcc5_4_build
- pytorch_linux_trusty_pynightly_build
- pytorch_linux_trusty_pynightly_test:
requires:
diff --git a/.jenkins/pytorch/build.sh b/.jenkins/pytorch/build.sh
index 31a6918580..2b05a30824 100755
--- a/.jenkins/pytorch/build.sh
+++ b/.jenkins/pytorch/build.sh
@@ -115,6 +115,12 @@ if [[ "$BUILD_ENVIRONMENT" == *trusty-py3.6-gcc5.4* ]]; then
export DEBUG=1
fi
+# Patch required to build xla
+if [[ "${JOB_BASE_NAME}" == *xla* ]]; then
+ git clone --recursive https://github.com/pytorch/xla.git
+ patch -p1 < xla/pytorch.patch
+fi
+
# ppc64le build fails when WERROR=1
# set only when building other architectures
# only use for "python setup.py install" line
@@ -167,3 +173,48 @@ if [[ "$BUILD_TEST_LIBTORCH" == "1" ]]; then
make VERBOSE=1
popd
fi
+
+# Test XLA build
+if [[ "${JOB_BASE_NAME}" == *xla* ]]; then
+ # TODO: Move this to Dockerfile.
+ # Bazel doesn't work with sccache gcc. https://github.com/bazelbuild/bazel/issues/3642
+ sudo add-apt-repository "deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-7 main"
+ wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
+ sudo apt-get -qq update
+
+ # Install clang-7 clang++-7 for xla
+ sudo apt-get -qq install clang-7 clang++-7
+
+ # Bazel dependencies
+ sudo apt-get -qq install pkg-config zip zlib1g-dev unzip
+ # XLA build requires Bazel
+ wget https://github.com/bazelbuild/bazel/releases/download/0.21.0/bazel-0.21.0-installer-linux-x86_64.sh
+ chmod +x bazel-*.sh
+ sudo ./bazel-*.sh
+ BAZEL="$(which bazel)"
+ if [ -z "${BAZEL}" ]; then
+ echo "Unable to find bazel..."
+ exit 1
+ fi
+
+ # Install bazels3cache for cloud cache
+ sudo apt-get -qq install npm
+ npm config set strict-ssl false
+ curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
+ sudo apt-get install -qq nodejs
+ sudo npm install -g bazels3cache
+ BAZELS3CACHE="$(which bazels3cache)"
+ if [ -z "${BAZELS3CACHE}" ]; then
+ echo "Unable to find bazels3cache..."
+ exit 1
+ fi
+
+ bazels3cache --bucket=ossci-compiler-cache-circleci-xla --maxEntrySizeBytes=0
+ pushd xla
+ export CC=clang-7 CXX=clang++-7
+ # Use cloud cache to build when available.
+ sed -i '/bazel build/ a --remote_http_cache=http://localhost:7777 \\' build_torch_xla_libs.sh
+
+ python setup.py install
+ popd
+fi
diff --git a/.jenkins/pytorch/test.sh b/.jenkins/pytorch/test.sh
index cb0e724726..05d33a9dd6 100755
--- a/.jenkins/pytorch/test.sh
+++ b/.jenkins/pytorch/test.sh
@@ -169,13 +169,27 @@ test_custom_script_ops() {
fi
}
+test_xla() {
+ export XLA_USE_XRT=1 XRT_DEVICE_MAP="CPU:0;/job:localservice/replica:0/task:0/device:XLA_CPU:0"
+ export XRT_WORKERS="localservice:0;grpc://localhost:40934"
+ pushd xla
+ python test/test_operations.py
+ python test/test_train_mnist.py --tidy
+ popd
+}
+
if [ -z "${JOB_BASE_NAME}" ] || [[ "${JOB_BASE_NAME}" == *-test ]]; then
- test_torchvision
- test_python_nn
- test_python_all_except_nn
- test_aten
- test_libtorch
- test_custom_script_ops
+ if [[ "${JOB_BASE_NAME}" == *xla* ]]; then
+ test_torchvision
+ test_xla
+ else
+ test_torchvision
+ test_python_nn
+ test_python_all_except_nn
+ test_aten
+ test_libtorch
+ test_custom_script_ops
+ fi
else
if [[ "${JOB_BASE_NAME}" == *-test1 ]]; then
test_torchvision