diff --git a/.circleci/config.yml b/.circleci/config.yml index 1333ab68dc2..438190e0565 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -6685,63 +6685,6 @@ workflows: - pytorch_linux_xenial_py3_clang5_android_ndk_r19c_x86_64_build - pytorch_linux_xenial_py3_clang5_android_ndk_r19c_arm_v7a_build - pytorch_linux_xenial_py3_clang5_android_ndk_r19c_arm_v8a_build - - pytorch_ios_build: - build_environment: pytorch-ios-12.5.1-x86_64_build - ios_arch: x86_64 - ios_platform: SIMULATOR - lite_interpreter: "1" - name: pytorch_ios_12_5_1_x86_64_build - - pytorch_ios_build: - build_environment: pytorch-ios-12.5.1-x86_64_full_jit_build - ios_arch: x86_64 - ios_platform: SIMULATOR - lite_interpreter: "0" - name: pytorch_ios_12_5_1_x86_64_full_jit_build - - pytorch_ios_build: - build_environment: pytorch-ios-12.5.1-arm64_build - context: org-member - ios_arch: arm64 - ios_platform: OS - lite_interpreter: "1" - name: pytorch_ios_12_5_1_arm64_build - - pytorch_ios_build: - build_environment: pytorch-ios-12.5.1-arm64_metal_build - context: org-member - ios_arch: arm64 - ios_platform: OS - lite_interpreter: "1" - name: pytorch_ios_12_5_1_arm64_metal_build - use_metal: "1" - - pytorch_ios_build: - build_environment: pytorch-ios-12.5.1-arm64_full_jit_build - context: org-member - ios_arch: arm64 - ios_platform: OS - lite_interpreter: "0" - name: pytorch_ios_12_5_1_arm64_full_jit_build - - pytorch_ios_build: - build_environment: pytorch-ios-12.5.1-arm64_custom_build - context: org-member - ios_arch: arm64 - ios_platform: OS - lite_interpreter: "1" - name: pytorch_ios_12_5_1_arm64_custom_build - op_list: mobilenetv2.yaml - - pytorch_ios_build: - build_environment: pytorch-ios-12.5.1-x86_64_coreml_build - ios_arch: x86_64 - ios_platform: SIMULATOR - lite_interpreter: "1" - name: pytorch_ios_12_5_1_x86_64_coreml_build - use_coreml: "1" - - pytorch_ios_build: - build_environment: pytorch-ios-12.5.1-arm64_coreml_build - context: org-member - ios_arch: arm64 - ios_platform: OS - lite_interpreter: "1" - name: pytorch_ios_12_5_1_arm64_coreml_build - use_coreml: "1" - binary_linux_build: build_environment: manywheel 3.7m cu102 devtoolset7 docker_image: pytorch/manylinux-cuda102 diff --git a/.circleci/generate_config_yml.py b/.circleci/generate_config_yml.py index ed21dd5bb3e..4ef6e171bfe 100755 --- a/.circleci/generate_config_yml.py +++ b/.circleci/generate_config_yml.py @@ -15,7 +15,6 @@ import cimodel.data.pytorch_build_definitions as pytorch_build_definitions import cimodel.data.simple.android_definitions import cimodel.data.simple.binary_smoketest import cimodel.data.simple.docker_definitions -import cimodel.data.simple.ios_definitions import cimodel.data.simple.macos_definitions import cimodel.data.simple.mobile_definitions import cimodel.data.simple.nightly_android @@ -143,7 +142,6 @@ def gen_build_workflows_tree(): pytorch_build_definitions.get_workflow_jobs, cimodel.data.simple.macos_definitions.get_workflow_jobs, cimodel.data.simple.android_definitions.get_workflow_jobs, - cimodel.data.simple.ios_definitions.get_workflow_jobs, cimodel.data.simple.mobile_definitions.get_workflow_jobs, cimodel.data.simple.binary_smoketest.get_workflow_jobs, cimodel.data.simple.nightly_ios.get_workflow_jobs, diff --git a/.github/generated-ciflow-ruleset.json b/.github/generated-ciflow-ruleset.json index 0da88b39767..65162d47959 100644 --- a/.github/generated-ciflow-ruleset.json +++ b/.github/generated-ciflow-ruleset.json @@ -4,6 +4,14 @@ "ciflow/all": [ "caffe2-linux-xenial-py3.6-gcc5.4", "docker-builds", + "ios-12-5-1-arm64", + "ios-12-5-1-arm64-coreml", + "ios-12-5-1-arm64-custom-ops", + "ios-12-5-1-arm64-full-jit", + "ios-12-5-1-arm64-metal", + "ios-12-5-1-x86-64", + "ios-12-5-1-x86-64-coreml", + "ios-12-5-1-x86-64-full-jit", "libtorch-linux-xenial-cuda10.2-py3.6-gcc7", "libtorch-linux-xenial-cuda11.3-py3.6-gcc7", "linux-bionic-cuda10.2-py3.9-gcc7", @@ -74,6 +82,16 @@ "win-vs2019-cpu-py3", "win-vs2019-cuda11.3-py3" ], + "ciflow/ios": [ + "ios-12-5-1-arm64", + "ios-12-5-1-arm64-coreml", + "ios-12-5-1-arm64-custom-ops", + "ios-12-5-1-arm64-full-jit", + "ios-12-5-1-arm64-metal", + "ios-12-5-1-x86-64", + "ios-12-5-1-x86-64-coreml", + "ios-12-5-1-x86-64-full-jit" + ], "ciflow/libtorch": [ "libtorch-linux-xenial-cuda10.2-py3.6-gcc7", "libtorch-linux-xenial-cuda11.3-py3.6-gcc7", @@ -102,6 +120,16 @@ "periodic-linux-xenial-cuda11.1-py3.6-gcc7", "pytorch-linux-xenial-py3-clang5-android-ndk-r19c-gradle-custom-build-single" ], + "ciflow/macos": [ + "ios-12-5-1-arm64", + "ios-12-5-1-arm64-coreml", + "ios-12-5-1-arm64-custom-ops", + "ios-12-5-1-arm64-full-jit", + "ios-12-5-1-arm64-metal", + "ios-12-5-1-x86-64", + "ios-12-5-1-x86-64-coreml", + "ios-12-5-1-x86-64-full-jit" + ], "ciflow/mobile": [ "linux-xenial-py3-clang5-mobile-build", "linux-xenial-py3-clang5-mobile-code-analysis", diff --git a/.github/scripts/generate_ci_workflows.py b/.github/scripts/generate_ci_workflows.py index 44c8d6d5cea..50a8a75fd59 100755 --- a/.github/scripts/generate_ci_workflows.py +++ b/.github/scripts/generate_ci_workflows.py @@ -11,7 +11,7 @@ import sys from typing_extensions import Literal YamlShellBool = Literal["''", 1] -Arch = Literal["windows", "linux"] +Arch = Literal["windows", "linux", "macos"] DOCKER_REGISTRY = "308535385114.dkr.ecr.us-east-1.amazonaws.com" GITHUB_DIR = Path(__file__).resolve().parent.parent @@ -32,6 +32,12 @@ LINUX_RUNNERS = { LINUX_CUDA_TEST_RUNNER, } +MACOS_TEST_RUNNER = "macos-10.15" + +MACOS_RUNNERS = { + MACOS_TEST_RUNNER +} + CUDA_RUNNERS = { WINDOWS_CUDA_TEST_RUNNER, LINUX_CUDA_TEST_RUNNER, @@ -61,6 +67,8 @@ LABEL_CIFLOW_VULKAN = "ciflow/vulkan" LABEL_CIFLOW_PREFIX = "ciflow/" LABEL_CIFLOW_SLOW_GRADCHECK = "ciflow/slow-gradcheck" LABEL_CIFLOW_DOCKER = "ciflow/docker" +LABEL_CIFLOW_IOS = "ciflow/ios" +LABEL_CIFLOW_MACOS = "ciflow/macos" @dataclass @@ -140,9 +148,9 @@ class CIWorkflow: # Required fields arch: Arch build_environment: str - test_runner_type: str # Optional fields + test_runner_type: str = '' ciflow_config: CIFlowConfig = field(default_factory=CIFlowConfig) cuda_version: str = '' docker_image_base: str = '' @@ -200,6 +208,11 @@ class CIWorkflow: assert LABEL_CIFLOW_LINUX in self.ciflow_config.labels if self.arch == 'windows': assert LABEL_CIFLOW_WIN in self.ciflow_config.labels + if self.arch == 'macos': + assert LABEL_CIFLOW_MACOS in self.ciflow_config.labels + # Make sure that jobs with tests have a test_runner_type + if not self.exclude_test: + assert self.test_runner_type != '' if self.test_runner_type in CUDA_RUNNERS: assert LABEL_CIFLOW_CUDA in self.ciflow_config.labels if self.test_runner_type in CPU_RUNNERS and not self.exclude_test: @@ -544,6 +557,73 @@ BAZEL_WORKFLOWS = [ ), ] +IOS_WORKFLOWS = [ + CIWorkflow( + arch="macos", + build_environment="ios-12-5-1-arm64", + exclude_test=True, + ciflow_config=CIFlowConfig( + labels={LABEL_CIFLOW_IOS, LABEL_CIFLOW_MACOS}, + ), + ), + CIWorkflow( + arch="macos", + build_environment="ios-12-5-1-arm64-coreml", + exclude_test=True, + ciflow_config=CIFlowConfig( + labels={LABEL_CIFLOW_IOS, LABEL_CIFLOW_MACOS}, + ), + ), + CIWorkflow( + arch="macos", + build_environment="ios-12-5-1-arm64-full-jit", + exclude_test=True, + ciflow_config=CIFlowConfig( + labels={LABEL_CIFLOW_IOS, LABEL_CIFLOW_MACOS}, + ), + ), + CIWorkflow( + arch="macos", + build_environment="ios-12-5-1-arm64-custom-ops", + exclude_test=True, + ciflow_config=CIFlowConfig( + labels={LABEL_CIFLOW_IOS, LABEL_CIFLOW_MACOS}, + ), + ), + CIWorkflow( + arch="macos", + build_environment="ios-12-5-1-arm64-metal", + exclude_test=True, + ciflow_config=CIFlowConfig( + labels={LABEL_CIFLOW_IOS, LABEL_CIFLOW_MACOS}, + ), + ), + CIWorkflow( + arch="macos", + build_environment="ios-12-5-1-x86-64", + exclude_test=True, + ciflow_config=CIFlowConfig( + labels={LABEL_CIFLOW_IOS, LABEL_CIFLOW_MACOS}, + ), + ), + CIWorkflow( + arch="macos", + build_environment="ios-12-5-1-x86-64-coreml", + exclude_test=True, + ciflow_config=CIFlowConfig( + labels={LABEL_CIFLOW_IOS, LABEL_CIFLOW_MACOS}, + ), + ), + CIWorkflow( + arch="macos", + build_environment="ios-12-5-1-x86-64-full-jit", + exclude_test=True, + ciflow_config=CIFlowConfig( + labels={LABEL_CIFLOW_IOS, LABEL_CIFLOW_MACOS}, + ), + ), +] + DOCKER_IMAGES = { f"{DOCKER_REGISTRY}/pytorch/pytorch-linux-bionic-cuda10.2-cudnn7-py3.6-clang9", # for pytorch/xla f"{DOCKER_REGISTRY}/pytorch/pytorch-linux-bionic-rocm4.1-py3.6", # for rocm @@ -576,6 +656,7 @@ def main() -> None: (jinja_env.get_template("linux_ci_workflow.yml.j2"), LINUX_WORKFLOWS), (jinja_env.get_template("windows_ci_workflow.yml.j2"), WINDOWS_WORKFLOWS), (jinja_env.get_template("bazel_ci_workflow.yml.j2"), BAZEL_WORKFLOWS), + (jinja_env.get_template("ios_ci_workflow.yml.j2"), IOS_WORKFLOWS), (jinja_env.get_template("docker_builds_ci_workflow.yml.j2"), DOCKER_WORKFLOWS), (jinja_env.get_template("android_ci_workflow.yml.j2"), ANDROID_WORKFLOWS), ] diff --git a/.github/templates/ios_ci_workflow.yml.j2 b/.github/templates/ios_ci_workflow.yml.j2 new file mode 100644 index 00000000000..926319c70b2 --- /dev/null +++ b/.github/templates/ios_ci_workflow.yml.j2 @@ -0,0 +1,85 @@ +{% import 'common.yml.j2' as common %} + +{%- block name -%} +# Template is at: .github/templates/ios_ci_workflow.yml.j2 +# Generation script: .github/scripts/generate_ci_workflows.py +name: !{{ build_environment }} +{%- endblock %} + +on: + pull_request: + types: [opened, synchronize, reopened, !{{ ciflow_config.trigger_action }}] + +{%- if is_scheduled %} + schedule: + - cron: !{{ is_scheduled }} +{%- else %} + push: + branches: + - master + - release/* +{%- endif %} + workflow_dispatch: + +# For setup-miniconda, see https://github.com/conda-incubator/setup-miniconda/issues/179 +defaults: + run: + shell: bash -x -e -l {0} +env: + BUILD_ENVIRONMENT: !{{ build_environment }} + IN_CI: 1 + IS_GHA: 1 + +jobs: +!{{ common.ciflow_should_run_job(ciflow_config) }} +{% block build +%} + build: + runs-on: macos-10.15 + needs: [!{{ ciflow_config.root_job_name }}] + env: + JOB_BASE_NAME: !{{ build_environment }}-build + IOS_CERT_KEY_2022: ${{ secrets.IOS_CERT_KEY_2022 }} + IOS_SIGN_KEY_2022: ${{ secrets.IOS_SIGN_KEY_2022 }} + steps: + !{{ common.checkout_pytorch("recursive") }} + - name: Setup miniconda + uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + python-version: 3.8 + activate-environment: build + - name: Install ios / conda Dependencies + run: | + # Install dependencies + brew install libtool + conda install numpy ninja pyyaml mkl mkl-include setuptools cmake cffi requests typing_extensions --yes + - name: Run Fastlane + shell: bash -e {0} + run: | + set -x + cd ios/TestApp + # install fastlane + sudo gem install bundler && bundle install + # install certificates + echo "${IOS_CERT_KEY_2022}" >> cert.txt + base64 --decode cert.txt -o Certificates.p12 + rm cert.txt + bundle exec fastlane install_root_cert + bundle exec fastlane install_dev_cert + # install the provisioning profile + PROFILE=PyTorch_CI_2022.mobileprovision + PROVISIONING_PROFILES=~/Library/MobileDevice/Provisioning\ Profiles + mkdir -pv "${PROVISIONING_PROFILES}" + cd "${PROVISIONING_PROFILES}" + echo "${IOS_SIGN_KEY_2022}" >> cert.txt + base64 --decode cert.txt -o ${PROFILE} + rm cert.txt + - name: Build + run: | + export TCLLIBPATH="/usr/local/lib" + python -VV + export CMAKE_PREFIX_PATH=${CONDA_PREFIX:-"$(dirname "$(which conda)")/../"} + scripts/build_ios.sh +{% endblock +%} + +!{{ common.concurrency(build_environment) }} diff --git a/.github/workflows/generated-ios-12-5-1-arm64-coreml.yml b/.github/workflows/generated-ios-12-5-1-arm64-coreml.yml new file mode 100644 index 00000000000..dd2510c3d5e --- /dev/null +++ b/.github/workflows/generated-ios-12-5-1-arm64-coreml.yml @@ -0,0 +1,100 @@ +# @generated DO NOT EDIT MANUALLY +# Template is at: .github/templates/ios_ci_workflow.yml.j2 +# Generation script: .github/scripts/generate_ci_workflows.py +name: ios-12-5-1-arm64-coreml + +on: + pull_request: + types: [opened, synchronize, reopened, unassigned] + push: + branches: + - master + - release/* + workflow_dispatch: + +# For setup-miniconda, see https://github.com/conda-incubator/setup-miniconda/issues/179 +defaults: + run: + shell: bash -x -e -l {0} +env: + BUILD_ENVIRONMENT: ios-12-5-1-arm64-coreml + IN_CI: 1 + IS_GHA: 1 + +jobs: + + ciflow_should_run: + runs-on: ubuntu-18.04 + env: + IS_PROBOT_TRIGGER_EVENT: ${{ (github.event.action == 'unassigned') && (github.event.assigneed.login == 'pytorchbot') }} + LABEL_CONDITIONS: ${{ contains(github.event.pull_request.labels.*.name, 'ciflow/all') || contains(github.event.pull_request.labels.*.name, 'ciflow/ios') || contains(github.event.pull_request.labels.*.name, 'ciflow/macos') }} + LABELS: ${{ toJson(github.event.pull_request.labels.*.name) }} + if: ${{ (github.repository == 'pytorch/pytorch') && ( + (github.event_name == 'push') || + (github.event_name == 'schedule') || + (contains(github.event.pull_request.labels.*.name, 'ciflow/all') || contains(github.event.pull_request.labels.*.name, 'ciflow/ios') || contains(github.event.pull_request.labels.*.name, 'ciflow/macos')) || + (false)) + }} + steps: + - name: noop + run: echo running ciflow_should_run + - name: print labels + run: echo "${LABELS}" + + build: + runs-on: macos-10.15 + needs: [ciflow_should_run] + env: + JOB_BASE_NAME: ios-12-5-1-arm64-coreml-build + IOS_CERT_KEY_2022: ${{ secrets.IOS_CERT_KEY_2022 }} + IOS_SIGN_KEY_2022: ${{ secrets.IOS_SIGN_KEY_2022 }} + steps: + - name: Checkout PyTorch + uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9 + with: + # deep clone, to allow use of git merge-base + fetch-depth: 0 + submodules: recursive + - name: Setup miniconda + uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + python-version: 3.8 + activate-environment: build + - name: Install ios / conda Dependencies + run: | + # Install dependencies + brew install libtool + conda install numpy ninja pyyaml mkl mkl-include setuptools cmake cffi requests typing_extensions --yes + - name: Run Fastlane + shell: bash -e {0} + run: | + set -x + cd ios/TestApp + # install fastlane + sudo gem install bundler && bundle install + # install certificates + echo "${IOS_CERT_KEY_2022}" >> cert.txt + base64 --decode cert.txt -o Certificates.p12 + rm cert.txt + bundle exec fastlane install_root_cert + bundle exec fastlane install_dev_cert + # install the provisioning profile + PROFILE=PyTorch_CI_2022.mobileprovision + PROVISIONING_PROFILES=~/Library/MobileDevice/Provisioning\ Profiles + mkdir -pv "${PROVISIONING_PROFILES}" + cd "${PROVISIONING_PROFILES}" + echo "${IOS_SIGN_KEY_2022}" >> cert.txt + base64 --decode cert.txt -o ${PROFILE} + rm cert.txt + - name: Build + run: | + export TCLLIBPATH="/usr/local/lib" + python -VV + export CMAKE_PREFIX_PATH=${CONDA_PREFIX:-"$(dirname "$(which conda)")/../"} + scripts/build_ios.sh + + +concurrency: + group: ios-12-5-1-arm64-coreml-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }} + cancel-in-progress: true diff --git a/.github/workflows/generated-ios-12-5-1-arm64-custom-ops.yml b/.github/workflows/generated-ios-12-5-1-arm64-custom-ops.yml new file mode 100644 index 00000000000..a8480d13b24 --- /dev/null +++ b/.github/workflows/generated-ios-12-5-1-arm64-custom-ops.yml @@ -0,0 +1,100 @@ +# @generated DO NOT EDIT MANUALLY +# Template is at: .github/templates/ios_ci_workflow.yml.j2 +# Generation script: .github/scripts/generate_ci_workflows.py +name: ios-12-5-1-arm64-custom-ops + +on: + pull_request: + types: [opened, synchronize, reopened, unassigned] + push: + branches: + - master + - release/* + workflow_dispatch: + +# For setup-miniconda, see https://github.com/conda-incubator/setup-miniconda/issues/179 +defaults: + run: + shell: bash -x -e -l {0} +env: + BUILD_ENVIRONMENT: ios-12-5-1-arm64-custom-ops + IN_CI: 1 + IS_GHA: 1 + +jobs: + + ciflow_should_run: + runs-on: ubuntu-18.04 + env: + IS_PROBOT_TRIGGER_EVENT: ${{ (github.event.action == 'unassigned') && (github.event.assigneed.login == 'pytorchbot') }} + LABEL_CONDITIONS: ${{ contains(github.event.pull_request.labels.*.name, 'ciflow/all') || contains(github.event.pull_request.labels.*.name, 'ciflow/ios') || contains(github.event.pull_request.labels.*.name, 'ciflow/macos') }} + LABELS: ${{ toJson(github.event.pull_request.labels.*.name) }} + if: ${{ (github.repository == 'pytorch/pytorch') && ( + (github.event_name == 'push') || + (github.event_name == 'schedule') || + (contains(github.event.pull_request.labels.*.name, 'ciflow/all') || contains(github.event.pull_request.labels.*.name, 'ciflow/ios') || contains(github.event.pull_request.labels.*.name, 'ciflow/macos')) || + (false)) + }} + steps: + - name: noop + run: echo running ciflow_should_run + - name: print labels + run: echo "${LABELS}" + + build: + runs-on: macos-10.15 + needs: [ciflow_should_run] + env: + JOB_BASE_NAME: ios-12-5-1-arm64-custom-ops-build + IOS_CERT_KEY_2022: ${{ secrets.IOS_CERT_KEY_2022 }} + IOS_SIGN_KEY_2022: ${{ secrets.IOS_SIGN_KEY_2022 }} + steps: + - name: Checkout PyTorch + uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9 + with: + # deep clone, to allow use of git merge-base + fetch-depth: 0 + submodules: recursive + - name: Setup miniconda + uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + python-version: 3.8 + activate-environment: build + - name: Install ios / conda Dependencies + run: | + # Install dependencies + brew install libtool + conda install numpy ninja pyyaml mkl mkl-include setuptools cmake cffi requests typing_extensions --yes + - name: Run Fastlane + shell: bash -e {0} + run: | + set -x + cd ios/TestApp + # install fastlane + sudo gem install bundler && bundle install + # install certificates + echo "${IOS_CERT_KEY_2022}" >> cert.txt + base64 --decode cert.txt -o Certificates.p12 + rm cert.txt + bundle exec fastlane install_root_cert + bundle exec fastlane install_dev_cert + # install the provisioning profile + PROFILE=PyTorch_CI_2022.mobileprovision + PROVISIONING_PROFILES=~/Library/MobileDevice/Provisioning\ Profiles + mkdir -pv "${PROVISIONING_PROFILES}" + cd "${PROVISIONING_PROFILES}" + echo "${IOS_SIGN_KEY_2022}" >> cert.txt + base64 --decode cert.txt -o ${PROFILE} + rm cert.txt + - name: Build + run: | + export TCLLIBPATH="/usr/local/lib" + python -VV + export CMAKE_PREFIX_PATH=${CONDA_PREFIX:-"$(dirname "$(which conda)")/../"} + scripts/build_ios.sh + + +concurrency: + group: ios-12-5-1-arm64-custom-ops-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }} + cancel-in-progress: true diff --git a/.github/workflows/generated-ios-12-5-1-arm64-full-jit.yml b/.github/workflows/generated-ios-12-5-1-arm64-full-jit.yml new file mode 100644 index 00000000000..7a54ddba6c6 --- /dev/null +++ b/.github/workflows/generated-ios-12-5-1-arm64-full-jit.yml @@ -0,0 +1,100 @@ +# @generated DO NOT EDIT MANUALLY +# Template is at: .github/templates/ios_ci_workflow.yml.j2 +# Generation script: .github/scripts/generate_ci_workflows.py +name: ios-12-5-1-arm64-full-jit + +on: + pull_request: + types: [opened, synchronize, reopened, unassigned] + push: + branches: + - master + - release/* + workflow_dispatch: + +# For setup-miniconda, see https://github.com/conda-incubator/setup-miniconda/issues/179 +defaults: + run: + shell: bash -x -e -l {0} +env: + BUILD_ENVIRONMENT: ios-12-5-1-arm64-full-jit + IN_CI: 1 + IS_GHA: 1 + +jobs: + + ciflow_should_run: + runs-on: ubuntu-18.04 + env: + IS_PROBOT_TRIGGER_EVENT: ${{ (github.event.action == 'unassigned') && (github.event.assigneed.login == 'pytorchbot') }} + LABEL_CONDITIONS: ${{ contains(github.event.pull_request.labels.*.name, 'ciflow/all') || contains(github.event.pull_request.labels.*.name, 'ciflow/ios') || contains(github.event.pull_request.labels.*.name, 'ciflow/macos') }} + LABELS: ${{ toJson(github.event.pull_request.labels.*.name) }} + if: ${{ (github.repository == 'pytorch/pytorch') && ( + (github.event_name == 'push') || + (github.event_name == 'schedule') || + (contains(github.event.pull_request.labels.*.name, 'ciflow/all') || contains(github.event.pull_request.labels.*.name, 'ciflow/ios') || contains(github.event.pull_request.labels.*.name, 'ciflow/macos')) || + (false)) + }} + steps: + - name: noop + run: echo running ciflow_should_run + - name: print labels + run: echo "${LABELS}" + + build: + runs-on: macos-10.15 + needs: [ciflow_should_run] + env: + JOB_BASE_NAME: ios-12-5-1-arm64-full-jit-build + IOS_CERT_KEY_2022: ${{ secrets.IOS_CERT_KEY_2022 }} + IOS_SIGN_KEY_2022: ${{ secrets.IOS_SIGN_KEY_2022 }} + steps: + - name: Checkout PyTorch + uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9 + with: + # deep clone, to allow use of git merge-base + fetch-depth: 0 + submodules: recursive + - name: Setup miniconda + uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + python-version: 3.8 + activate-environment: build + - name: Install ios / conda Dependencies + run: | + # Install dependencies + brew install libtool + conda install numpy ninja pyyaml mkl mkl-include setuptools cmake cffi requests typing_extensions --yes + - name: Run Fastlane + shell: bash -e {0} + run: | + set -x + cd ios/TestApp + # install fastlane + sudo gem install bundler && bundle install + # install certificates + echo "${IOS_CERT_KEY_2022}" >> cert.txt + base64 --decode cert.txt -o Certificates.p12 + rm cert.txt + bundle exec fastlane install_root_cert + bundle exec fastlane install_dev_cert + # install the provisioning profile + PROFILE=PyTorch_CI_2022.mobileprovision + PROVISIONING_PROFILES=~/Library/MobileDevice/Provisioning\ Profiles + mkdir -pv "${PROVISIONING_PROFILES}" + cd "${PROVISIONING_PROFILES}" + echo "${IOS_SIGN_KEY_2022}" >> cert.txt + base64 --decode cert.txt -o ${PROFILE} + rm cert.txt + - name: Build + run: | + export TCLLIBPATH="/usr/local/lib" + python -VV + export CMAKE_PREFIX_PATH=${CONDA_PREFIX:-"$(dirname "$(which conda)")/../"} + scripts/build_ios.sh + + +concurrency: + group: ios-12-5-1-arm64-full-jit-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }} + cancel-in-progress: true diff --git a/.github/workflows/generated-ios-12-5-1-arm64-metal.yml b/.github/workflows/generated-ios-12-5-1-arm64-metal.yml new file mode 100644 index 00000000000..9848061781a --- /dev/null +++ b/.github/workflows/generated-ios-12-5-1-arm64-metal.yml @@ -0,0 +1,100 @@ +# @generated DO NOT EDIT MANUALLY +# Template is at: .github/templates/ios_ci_workflow.yml.j2 +# Generation script: .github/scripts/generate_ci_workflows.py +name: ios-12-5-1-arm64-metal + +on: + pull_request: + types: [opened, synchronize, reopened, unassigned] + push: + branches: + - master + - release/* + workflow_dispatch: + +# For setup-miniconda, see https://github.com/conda-incubator/setup-miniconda/issues/179 +defaults: + run: + shell: bash -x -e -l {0} +env: + BUILD_ENVIRONMENT: ios-12-5-1-arm64-metal + IN_CI: 1 + IS_GHA: 1 + +jobs: + + ciflow_should_run: + runs-on: ubuntu-18.04 + env: + IS_PROBOT_TRIGGER_EVENT: ${{ (github.event.action == 'unassigned') && (github.event.assigneed.login == 'pytorchbot') }} + LABEL_CONDITIONS: ${{ contains(github.event.pull_request.labels.*.name, 'ciflow/all') || contains(github.event.pull_request.labels.*.name, 'ciflow/ios') || contains(github.event.pull_request.labels.*.name, 'ciflow/macos') }} + LABELS: ${{ toJson(github.event.pull_request.labels.*.name) }} + if: ${{ (github.repository == 'pytorch/pytorch') && ( + (github.event_name == 'push') || + (github.event_name == 'schedule') || + (contains(github.event.pull_request.labels.*.name, 'ciflow/all') || contains(github.event.pull_request.labels.*.name, 'ciflow/ios') || contains(github.event.pull_request.labels.*.name, 'ciflow/macos')) || + (false)) + }} + steps: + - name: noop + run: echo running ciflow_should_run + - name: print labels + run: echo "${LABELS}" + + build: + runs-on: macos-10.15 + needs: [ciflow_should_run] + env: + JOB_BASE_NAME: ios-12-5-1-arm64-metal-build + IOS_CERT_KEY_2022: ${{ secrets.IOS_CERT_KEY_2022 }} + IOS_SIGN_KEY_2022: ${{ secrets.IOS_SIGN_KEY_2022 }} + steps: + - name: Checkout PyTorch + uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9 + with: + # deep clone, to allow use of git merge-base + fetch-depth: 0 + submodules: recursive + - name: Setup miniconda + uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + python-version: 3.8 + activate-environment: build + - name: Install ios / conda Dependencies + run: | + # Install dependencies + brew install libtool + conda install numpy ninja pyyaml mkl mkl-include setuptools cmake cffi requests typing_extensions --yes + - name: Run Fastlane + shell: bash -e {0} + run: | + set -x + cd ios/TestApp + # install fastlane + sudo gem install bundler && bundle install + # install certificates + echo "${IOS_CERT_KEY_2022}" >> cert.txt + base64 --decode cert.txt -o Certificates.p12 + rm cert.txt + bundle exec fastlane install_root_cert + bundle exec fastlane install_dev_cert + # install the provisioning profile + PROFILE=PyTorch_CI_2022.mobileprovision + PROVISIONING_PROFILES=~/Library/MobileDevice/Provisioning\ Profiles + mkdir -pv "${PROVISIONING_PROFILES}" + cd "${PROVISIONING_PROFILES}" + echo "${IOS_SIGN_KEY_2022}" >> cert.txt + base64 --decode cert.txt -o ${PROFILE} + rm cert.txt + - name: Build + run: | + export TCLLIBPATH="/usr/local/lib" + python -VV + export CMAKE_PREFIX_PATH=${CONDA_PREFIX:-"$(dirname "$(which conda)")/../"} + scripts/build_ios.sh + + +concurrency: + group: ios-12-5-1-arm64-metal-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }} + cancel-in-progress: true diff --git a/.github/workflows/generated-ios-12-5-1-arm64.yml b/.github/workflows/generated-ios-12-5-1-arm64.yml new file mode 100644 index 00000000000..2fea55779bb --- /dev/null +++ b/.github/workflows/generated-ios-12-5-1-arm64.yml @@ -0,0 +1,100 @@ +# @generated DO NOT EDIT MANUALLY +# Template is at: .github/templates/ios_ci_workflow.yml.j2 +# Generation script: .github/scripts/generate_ci_workflows.py +name: ios-12-5-1-arm64 + +on: + pull_request: + types: [opened, synchronize, reopened, unassigned] + push: + branches: + - master + - release/* + workflow_dispatch: + +# For setup-miniconda, see https://github.com/conda-incubator/setup-miniconda/issues/179 +defaults: + run: + shell: bash -x -e -l {0} +env: + BUILD_ENVIRONMENT: ios-12-5-1-arm64 + IN_CI: 1 + IS_GHA: 1 + +jobs: + + ciflow_should_run: + runs-on: ubuntu-18.04 + env: + IS_PROBOT_TRIGGER_EVENT: ${{ (github.event.action == 'unassigned') && (github.event.assigneed.login == 'pytorchbot') }} + LABEL_CONDITIONS: ${{ contains(github.event.pull_request.labels.*.name, 'ciflow/all') || contains(github.event.pull_request.labels.*.name, 'ciflow/ios') || contains(github.event.pull_request.labels.*.name, 'ciflow/macos') }} + LABELS: ${{ toJson(github.event.pull_request.labels.*.name) }} + if: ${{ (github.repository == 'pytorch/pytorch') && ( + (github.event_name == 'push') || + (github.event_name == 'schedule') || + (contains(github.event.pull_request.labels.*.name, 'ciflow/all') || contains(github.event.pull_request.labels.*.name, 'ciflow/ios') || contains(github.event.pull_request.labels.*.name, 'ciflow/macos')) || + (false)) + }} + steps: + - name: noop + run: echo running ciflow_should_run + - name: print labels + run: echo "${LABELS}" + + build: + runs-on: macos-10.15 + needs: [ciflow_should_run] + env: + JOB_BASE_NAME: ios-12-5-1-arm64-build + IOS_CERT_KEY_2022: ${{ secrets.IOS_CERT_KEY_2022 }} + IOS_SIGN_KEY_2022: ${{ secrets.IOS_SIGN_KEY_2022 }} + steps: + - name: Checkout PyTorch + uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9 + with: + # deep clone, to allow use of git merge-base + fetch-depth: 0 + submodules: recursive + - name: Setup miniconda + uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + python-version: 3.8 + activate-environment: build + - name: Install ios / conda Dependencies + run: | + # Install dependencies + brew install libtool + conda install numpy ninja pyyaml mkl mkl-include setuptools cmake cffi requests typing_extensions --yes + - name: Run Fastlane + shell: bash -e {0} + run: | + set -x + cd ios/TestApp + # install fastlane + sudo gem install bundler && bundle install + # install certificates + echo "${IOS_CERT_KEY_2022}" >> cert.txt + base64 --decode cert.txt -o Certificates.p12 + rm cert.txt + bundle exec fastlane install_root_cert + bundle exec fastlane install_dev_cert + # install the provisioning profile + PROFILE=PyTorch_CI_2022.mobileprovision + PROVISIONING_PROFILES=~/Library/MobileDevice/Provisioning\ Profiles + mkdir -pv "${PROVISIONING_PROFILES}" + cd "${PROVISIONING_PROFILES}" + echo "${IOS_SIGN_KEY_2022}" >> cert.txt + base64 --decode cert.txt -o ${PROFILE} + rm cert.txt + - name: Build + run: | + export TCLLIBPATH="/usr/local/lib" + python -VV + export CMAKE_PREFIX_PATH=${CONDA_PREFIX:-"$(dirname "$(which conda)")/../"} + scripts/build_ios.sh + + +concurrency: + group: ios-12-5-1-arm64-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }} + cancel-in-progress: true diff --git a/.github/workflows/generated-ios-12-5-1-x86-64-coreml.yml b/.github/workflows/generated-ios-12-5-1-x86-64-coreml.yml new file mode 100644 index 00000000000..3baa4312994 --- /dev/null +++ b/.github/workflows/generated-ios-12-5-1-x86-64-coreml.yml @@ -0,0 +1,100 @@ +# @generated DO NOT EDIT MANUALLY +# Template is at: .github/templates/ios_ci_workflow.yml.j2 +# Generation script: .github/scripts/generate_ci_workflows.py +name: ios-12-5-1-x86-64-coreml + +on: + pull_request: + types: [opened, synchronize, reopened, unassigned] + push: + branches: + - master + - release/* + workflow_dispatch: + +# For setup-miniconda, see https://github.com/conda-incubator/setup-miniconda/issues/179 +defaults: + run: + shell: bash -x -e -l {0} +env: + BUILD_ENVIRONMENT: ios-12-5-1-x86-64-coreml + IN_CI: 1 + IS_GHA: 1 + +jobs: + + ciflow_should_run: + runs-on: ubuntu-18.04 + env: + IS_PROBOT_TRIGGER_EVENT: ${{ (github.event.action == 'unassigned') && (github.event.assigneed.login == 'pytorchbot') }} + LABEL_CONDITIONS: ${{ contains(github.event.pull_request.labels.*.name, 'ciflow/all') || contains(github.event.pull_request.labels.*.name, 'ciflow/ios') || contains(github.event.pull_request.labels.*.name, 'ciflow/macos') }} + LABELS: ${{ toJson(github.event.pull_request.labels.*.name) }} + if: ${{ (github.repository == 'pytorch/pytorch') && ( + (github.event_name == 'push') || + (github.event_name == 'schedule') || + (contains(github.event.pull_request.labels.*.name, 'ciflow/all') || contains(github.event.pull_request.labels.*.name, 'ciflow/ios') || contains(github.event.pull_request.labels.*.name, 'ciflow/macos')) || + (false)) + }} + steps: + - name: noop + run: echo running ciflow_should_run + - name: print labels + run: echo "${LABELS}" + + build: + runs-on: macos-10.15 + needs: [ciflow_should_run] + env: + JOB_BASE_NAME: ios-12-5-1-x86-64-coreml-build + IOS_CERT_KEY_2022: ${{ secrets.IOS_CERT_KEY_2022 }} + IOS_SIGN_KEY_2022: ${{ secrets.IOS_SIGN_KEY_2022 }} + steps: + - name: Checkout PyTorch + uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9 + with: + # deep clone, to allow use of git merge-base + fetch-depth: 0 + submodules: recursive + - name: Setup miniconda + uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + python-version: 3.8 + activate-environment: build + - name: Install ios / conda Dependencies + run: | + # Install dependencies + brew install libtool + conda install numpy ninja pyyaml mkl mkl-include setuptools cmake cffi requests typing_extensions --yes + - name: Run Fastlane + shell: bash -e {0} + run: | + set -x + cd ios/TestApp + # install fastlane + sudo gem install bundler && bundle install + # install certificates + echo "${IOS_CERT_KEY_2022}" >> cert.txt + base64 --decode cert.txt -o Certificates.p12 + rm cert.txt + bundle exec fastlane install_root_cert + bundle exec fastlane install_dev_cert + # install the provisioning profile + PROFILE=PyTorch_CI_2022.mobileprovision + PROVISIONING_PROFILES=~/Library/MobileDevice/Provisioning\ Profiles + mkdir -pv "${PROVISIONING_PROFILES}" + cd "${PROVISIONING_PROFILES}" + echo "${IOS_SIGN_KEY_2022}" >> cert.txt + base64 --decode cert.txt -o ${PROFILE} + rm cert.txt + - name: Build + run: | + export TCLLIBPATH="/usr/local/lib" + python -VV + export CMAKE_PREFIX_PATH=${CONDA_PREFIX:-"$(dirname "$(which conda)")/../"} + scripts/build_ios.sh + + +concurrency: + group: ios-12-5-1-x86-64-coreml-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }} + cancel-in-progress: true diff --git a/.github/workflows/generated-ios-12-5-1-x86-64-full-jit.yml b/.github/workflows/generated-ios-12-5-1-x86-64-full-jit.yml new file mode 100644 index 00000000000..e5421ff9e4a --- /dev/null +++ b/.github/workflows/generated-ios-12-5-1-x86-64-full-jit.yml @@ -0,0 +1,100 @@ +# @generated DO NOT EDIT MANUALLY +# Template is at: .github/templates/ios_ci_workflow.yml.j2 +# Generation script: .github/scripts/generate_ci_workflows.py +name: ios-12-5-1-x86-64-full-jit + +on: + pull_request: + types: [opened, synchronize, reopened, unassigned] + push: + branches: + - master + - release/* + workflow_dispatch: + +# For setup-miniconda, see https://github.com/conda-incubator/setup-miniconda/issues/179 +defaults: + run: + shell: bash -x -e -l {0} +env: + BUILD_ENVIRONMENT: ios-12-5-1-x86-64-full-jit + IN_CI: 1 + IS_GHA: 1 + +jobs: + + ciflow_should_run: + runs-on: ubuntu-18.04 + env: + IS_PROBOT_TRIGGER_EVENT: ${{ (github.event.action == 'unassigned') && (github.event.assigneed.login == 'pytorchbot') }} + LABEL_CONDITIONS: ${{ contains(github.event.pull_request.labels.*.name, 'ciflow/all') || contains(github.event.pull_request.labels.*.name, 'ciflow/ios') || contains(github.event.pull_request.labels.*.name, 'ciflow/macos') }} + LABELS: ${{ toJson(github.event.pull_request.labels.*.name) }} + if: ${{ (github.repository == 'pytorch/pytorch') && ( + (github.event_name == 'push') || + (github.event_name == 'schedule') || + (contains(github.event.pull_request.labels.*.name, 'ciflow/all') || contains(github.event.pull_request.labels.*.name, 'ciflow/ios') || contains(github.event.pull_request.labels.*.name, 'ciflow/macos')) || + (false)) + }} + steps: + - name: noop + run: echo running ciflow_should_run + - name: print labels + run: echo "${LABELS}" + + build: + runs-on: macos-10.15 + needs: [ciflow_should_run] + env: + JOB_BASE_NAME: ios-12-5-1-x86-64-full-jit-build + IOS_CERT_KEY_2022: ${{ secrets.IOS_CERT_KEY_2022 }} + IOS_SIGN_KEY_2022: ${{ secrets.IOS_SIGN_KEY_2022 }} + steps: + - name: Checkout PyTorch + uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9 + with: + # deep clone, to allow use of git merge-base + fetch-depth: 0 + submodules: recursive + - name: Setup miniconda + uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + python-version: 3.8 + activate-environment: build + - name: Install ios / conda Dependencies + run: | + # Install dependencies + brew install libtool + conda install numpy ninja pyyaml mkl mkl-include setuptools cmake cffi requests typing_extensions --yes + - name: Run Fastlane + shell: bash -e {0} + run: | + set -x + cd ios/TestApp + # install fastlane + sudo gem install bundler && bundle install + # install certificates + echo "${IOS_CERT_KEY_2022}" >> cert.txt + base64 --decode cert.txt -o Certificates.p12 + rm cert.txt + bundle exec fastlane install_root_cert + bundle exec fastlane install_dev_cert + # install the provisioning profile + PROFILE=PyTorch_CI_2022.mobileprovision + PROVISIONING_PROFILES=~/Library/MobileDevice/Provisioning\ Profiles + mkdir -pv "${PROVISIONING_PROFILES}" + cd "${PROVISIONING_PROFILES}" + echo "${IOS_SIGN_KEY_2022}" >> cert.txt + base64 --decode cert.txt -o ${PROFILE} + rm cert.txt + - name: Build + run: | + export TCLLIBPATH="/usr/local/lib" + python -VV + export CMAKE_PREFIX_PATH=${CONDA_PREFIX:-"$(dirname "$(which conda)")/../"} + scripts/build_ios.sh + + +concurrency: + group: ios-12-5-1-x86-64-full-jit-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }} + cancel-in-progress: true diff --git a/.github/workflows/generated-ios-12-5-1-x86-64.yml b/.github/workflows/generated-ios-12-5-1-x86-64.yml new file mode 100644 index 00000000000..f3561868a1e --- /dev/null +++ b/.github/workflows/generated-ios-12-5-1-x86-64.yml @@ -0,0 +1,100 @@ +# @generated DO NOT EDIT MANUALLY +# Template is at: .github/templates/ios_ci_workflow.yml.j2 +# Generation script: .github/scripts/generate_ci_workflows.py +name: ios-12-5-1-x86-64 + +on: + pull_request: + types: [opened, synchronize, reopened, unassigned] + push: + branches: + - master + - release/* + workflow_dispatch: + +# For setup-miniconda, see https://github.com/conda-incubator/setup-miniconda/issues/179 +defaults: + run: + shell: bash -x -e -l {0} +env: + BUILD_ENVIRONMENT: ios-12-5-1-x86-64 + IN_CI: 1 + IS_GHA: 1 + +jobs: + + ciflow_should_run: + runs-on: ubuntu-18.04 + env: + IS_PROBOT_TRIGGER_EVENT: ${{ (github.event.action == 'unassigned') && (github.event.assigneed.login == 'pytorchbot') }} + LABEL_CONDITIONS: ${{ contains(github.event.pull_request.labels.*.name, 'ciflow/all') || contains(github.event.pull_request.labels.*.name, 'ciflow/ios') || contains(github.event.pull_request.labels.*.name, 'ciflow/macos') }} + LABELS: ${{ toJson(github.event.pull_request.labels.*.name) }} + if: ${{ (github.repository == 'pytorch/pytorch') && ( + (github.event_name == 'push') || + (github.event_name == 'schedule') || + (contains(github.event.pull_request.labels.*.name, 'ciflow/all') || contains(github.event.pull_request.labels.*.name, 'ciflow/ios') || contains(github.event.pull_request.labels.*.name, 'ciflow/macos')) || + (false)) + }} + steps: + - name: noop + run: echo running ciflow_should_run + - name: print labels + run: echo "${LABELS}" + + build: + runs-on: macos-10.15 + needs: [ciflow_should_run] + env: + JOB_BASE_NAME: ios-12-5-1-x86-64-build + IOS_CERT_KEY_2022: ${{ secrets.IOS_CERT_KEY_2022 }} + IOS_SIGN_KEY_2022: ${{ secrets.IOS_SIGN_KEY_2022 }} + steps: + - name: Checkout PyTorch + uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9 + with: + # deep clone, to allow use of git merge-base + fetch-depth: 0 + submodules: recursive + - name: Setup miniconda + uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + python-version: 3.8 + activate-environment: build + - name: Install ios / conda Dependencies + run: | + # Install dependencies + brew install libtool + conda install numpy ninja pyyaml mkl mkl-include setuptools cmake cffi requests typing_extensions --yes + - name: Run Fastlane + shell: bash -e {0} + run: | + set -x + cd ios/TestApp + # install fastlane + sudo gem install bundler && bundle install + # install certificates + echo "${IOS_CERT_KEY_2022}" >> cert.txt + base64 --decode cert.txt -o Certificates.p12 + rm cert.txt + bundle exec fastlane install_root_cert + bundle exec fastlane install_dev_cert + # install the provisioning profile + PROFILE=PyTorch_CI_2022.mobileprovision + PROVISIONING_PROFILES=~/Library/MobileDevice/Provisioning\ Profiles + mkdir -pv "${PROVISIONING_PROFILES}" + cd "${PROVISIONING_PROFILES}" + echo "${IOS_SIGN_KEY_2022}" >> cert.txt + base64 --decode cert.txt -o ${PROFILE} + rm cert.txt + - name: Build + run: | + export TCLLIBPATH="/usr/local/lib" + python -VV + export CMAKE_PREFIX_PATH=${CONDA_PREFIX:-"$(dirname "$(which conda)")/../"} + scripts/build_ios.sh + + +concurrency: + group: ios-12-5-1-x86-64-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }} + cancel-in-progress: true diff --git a/scripts/build_ios.sh b/scripts/build_ios.sh index 8c8aca5c22e..7c5669ee852 100755 --- a/scripts/build_ios.sh +++ b/scripts/build_ios.sh @@ -7,6 +7,55 @@ # using ios-cmake. This is very similar to the android-cmake - see # build_android.sh for more details. +# For CI purposes +populate_ci_build_options() { + # For use within CI, should be a no-op for everyone else + + # BUILD_ENVIRONMENT's should look somewhat like pytorch_ios_12_5_1_arm64_coreml + BUILD_ENVIRONMENT=${BUILD_ENVIRONMENT:-} + + case ${BUILD_ENVIRONMENT} in + *x86_64*) + export IOS_ARCH="x86_64" + export IOS_PLATFORM="SIMULATOR" + ;; + *arm64*) + export IOS_ARCH="arm64" + export IOS_PLATFORM="OS" + ;; + esac + + # Most builds use the lite interpreter, if certain builds shouldn't + # build the lite interpreter this env variable should get over-written + # in the following case statement + export BUILD_LITE_INTERPRETER="1" + + case ${BUILD_ENVIRONMENT} in + *metal*) + export USE_PYTORCH_METAL=1 + ;; + *full_jit*) + export BUILD_LITE_INTERPRETER="0" + ;; + *custom*) + PROJ_ROOT=$(git rev-parse --show-toplevel) + export SELECTED_OP_LIST="${PROJ_ROOT}/ios/TestApp/custom_build/mobilenetv2.yaml" + ;; + *coreml*) + export USE_COREML_DELEGATE="1" + ;; + esac + if [[ -n ${BUILD_ENVIRONMENT} ]]; then + echo "IOS_ARCH: ${IOS_ARCH}" + echo "IOS_PLATFORM: ${IOS_PLATFORM}" + echo "BUILD_LITE_INTERPRETER": "${BUILD_LITE_INTERPRETER}" + echo "USE_PYTORCH_METAL": "${USE_METAL:-}" + echo "USE_COREML_DELEGATE": "${USE_COREML_DELEGATE:-}" + fi +} + +populate_ci_build_options + CAFFE2_ROOT="$( cd "$(dirname "$0")"/.. ; pwd -P)" CMAKE_ARGS=()