Skip to content

Commit

Permalink
Revert D18641413: add unit tests to iOS CI jobs
Browse files Browse the repository at this point in the history
Test Plan: revert-hammer

Differential Revision:
D18641413

Original commit changeset: 12942206f1de

fbshipit-source-id: 4fa76d50fb897db4342d10a4e46a9887e37ef233
  • Loading branch information
Hao Lu authored and facebook-github-bot committed Nov 22, 2019
1 parent 6c9b188 commit 9fb8799
Show file tree
Hide file tree
Showing 10 changed files with 70 additions and 121 deletions.
58 changes: 19 additions & 39 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,7 @@ jobs:
binary_ios_build:
<<: *pytorch_ios_params
macos:
xcode: "11.2.1"
xcode: "10.2.1"
steps:
- attach_workspace:
at: ~/workspace
Expand Down Expand Up @@ -879,7 +879,7 @@ jobs:
binary_ios_upload:
<<: *pytorch_ios_params
macos:
xcode: "11.2.1"
xcode: "10.2.1"
steps:
- attach_workspace:
at: ~/workspace
Expand Down Expand Up @@ -1298,14 +1298,14 @@ jobs:
pytorch_ios_build:
<<: *pytorch_ios_params
macos:
xcode: "11.2.1"
xcode: "10.2.1"
steps:
# See Note [Workspace for CircleCI scripts] in job-specs-setup.yml
- should_run_job
- checkout
- run_brew_for_ios_build
- run_brew_for_ios_build
- run:
name: Run Fastlane
name: cert install
no_output_timeout: "1h"
command: |
set -e
Expand Down Expand Up @@ -1335,6 +1335,7 @@ jobs:
WORKSPACE=/Users/distiller/workspace
PROJ_ROOT=/Users/distiller/project
export TCLLIBPATH="/usr/local/lib"
# Install conda
curl -o ~/Downloads/conda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh
chmod +x ~/Downloads/conda.sh
Expand All @@ -1358,7 +1359,7 @@ jobs:
export IOS_PLATFORM=${IOS_PLATFORM}
unbuffer ${PROJ_ROOT}/scripts/build_ios.sh 2>&1 | ts
- run:
name: Run Build Tests
name: Test
no_output_timeout: "30m"
command: |
set -e
Expand All @@ -1375,28 +1376,7 @@ jobs:
echo 'xcodebuild failed!'
exit 1
fi
- run:
name: Run Simulator Tests
no_output_timeout: "2h"
command: |
set -e
if [ ${IOS_PLATFORM} != "SIMULATOR" ]; then
echo "not SIMULATOR build, skip it."
exit 0
fi
WORKSPACE=/Users/distiller/workspace
PROJ_ROOT=/Users/distiller/project
source ~/anaconda/bin/activate
#install the latest version of PyTorch and TorchVision
pip install torch torchvision
#run unit test
cd ${PROJ_ROOT}/ios/TestApp/benchmark
python trace_model.py
ruby setup.rb
cd ${PROJ_ROOT}/ios/TestApp
instruments -s -devices
fastlane scan
# update_s3_htmls job
# These jobs create html files for every cpu/cu## folder in s3. The html
# files just store the names of all the files in that folder (which are
Expand Down Expand Up @@ -1930,17 +1910,17 @@ workflows:
- pytorch_linux_xenial_py3_clang5_android_ndk_r19c_arm_v8a_build
# Pytorch iOS PR builds
- pytorch_ios_build:
name: pytorch_ios_11_2_1_x86_64_build
name: pytorch_ios_10_2_1_x86_64_build
context: org-member
build_environment: "pytorch-ios-11.2.1-x86_64_build"
build_environment: "pytorch-ios-10.2.1-x86_64_build"
ios_arch: "x86_64"
ios_platform: "SIMULATOR"
requires:
- setup
- pytorch_ios_build:
name: pytorch_ios_11_2_1_arm64_build
name: pytorch_ios_10_2_1_arm64_build
context: org-member
build_environment: "pytorch-ios-11.2.1-arm64_build"
build_environment: "pytorch-ios-10.2.1-arm64_build"
ios_arch: "arm64"
ios_platform: "OS"
requires:
Expand Down Expand Up @@ -3787,8 +3767,8 @@ workflows:
only: nightly
# Pytorch iOS binary builds
- binary_ios_build:
name: pytorch_ios_11_2_1_nightly_x86_64_build
build_environment: "libtorch-ios-11.2.1-nightly-x86_64-build"
name: pytorch_ios_10_2_1_nightly_x86_64_build
build_environment: "libtorch-ios-10.2.1-nightly-x86_64-build"
context: org-member
ios_platform: "SIMULATOR"
ios_arch: "x86_64"
Expand All @@ -3798,8 +3778,8 @@ workflows:
branches:
only: nightly
- binary_ios_build:
name: pytorch_ios_11_2_1_nightly_arm64_build
build_environment: "libtorch-ios-11.2.1-nightly-arm64-build"
name: pytorch_ios_10_2_1_nightly_arm64_build
build_environment: "libtorch-ios-10.2.1-nightly-arm64-build"
context: org-member
ios_arch: "arm64"
ios_platform: "OS"
Expand All @@ -3809,12 +3789,12 @@ workflows:
branches:
only: nightly
- binary_ios_upload:
build_environment: "libtorch-ios-11.2.1-nightly-binary-build-upload"
build_environment: "libtorch-ios-10.2.1-nightly-binary-build-upload"
context: org-member
requires:
- setup
- pytorch_ios_11_2_1_nightly_x86_64_build
- pytorch_ios_11_2_1_nightly_arm64_build
- pytorch_ios_10_2_1_nightly_x86_64_build
- pytorch_ios_10_2_1_nightly_arm64_build
filters:
branches:
only: nightly
Expand Down
10 changes: 5 additions & 5 deletions .circleci/scripts/should_run_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
'libtorch 2.7m cpu devtoolset7',
'libtorch 2.7m cpu gcc5.4_cxx11-abi',
'libtorch 2.7 cpu',
'libtorch-ios-11.2.1-nightly-x86_64-build',
'libtorch-ios-11.2.1-nightly-arm64-build',
'libtorch-ios-11.2.1-nightly-binary-build-upload',
'libtorch-ios-10.2.1-nightly-x86_64-build',
'libtorch-ios-10.2.1-nightly-arm64-build',
'libtorch-ios-10.2.1-nightly-binary-build-upload',

# Caffe2 Android
'caffe2-py2-android-ubuntu16.04',
Expand All @@ -56,8 +56,8 @@
# PyTorch Android gradle
'pytorch-linux-xenial-py3-clang5-android-ndk-r19c-gradle-build-only-x86_32',
# Pytorch iOS builds
'pytorch-ios-11.2.1-x86_64_build',
'pytorch-ios-11.2.1-arm64_build',
'pytorch-ios-10.2.1-x86_64_build',
'pytorch-ios-10.2.1-arm64_build',
# PyTorch Mobile builds
'pytorch-linux-xenial-py3-clang5-mobile-build',

Expand Down
4 changes: 2 additions & 2 deletions .circleci/verbatim-sources/binary-job-specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@
binary_ios_build:
<<: *pytorch_ios_params
macos:
xcode: "11.2.1"
xcode: "10.2.1"
steps:
- attach_workspace:
at: ~/workspace
Expand Down Expand Up @@ -251,7 +251,7 @@
binary_ios_upload:
<<: *pytorch_ios_params
macos:
xcode: "11.2.1"
xcode: "10.2.1"
steps:
- attach_workspace:
at: ~/workspace
Expand Down
31 changes: 5 additions & 26 deletions .circleci/verbatim-sources/job-specs-custom.yml
Original file line number Diff line number Diff line change
Expand Up @@ -373,14 +373,14 @@
pytorch_ios_build:
<<: *pytorch_ios_params
macos:
xcode: "11.2.1"
xcode: "10.2.1"
steps:
# See Note [Workspace for CircleCI scripts] in job-specs-setup.yml
- should_run_job
- checkout
- run_brew_for_ios_build
- run_brew_for_ios_build
- run:
name: Run Fastlane
name: cert install
no_output_timeout: "1h"
command: |
set -e
Expand Down Expand Up @@ -410,6 +410,7 @@
WORKSPACE=/Users/distiller/workspace
PROJ_ROOT=/Users/distiller/project
export TCLLIBPATH="/usr/local/lib"
# Install conda
curl -o ~/Downloads/conda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh
chmod +x ~/Downloads/conda.sh
Expand All @@ -433,7 +434,7 @@
export IOS_PLATFORM=${IOS_PLATFORM}
unbuffer ${PROJ_ROOT}/scripts/build_ios.sh 2>&1 | ts
- run:
name: Run Build Tests
name: Test
no_output_timeout: "30m"
command: |
set -e
Expand All @@ -450,25 +451,3 @@
echo 'xcodebuild failed!'
exit 1
fi
- run:
name: Run Simulator Tests
no_output_timeout: "2h"
command: |
set -e
if [ ${IOS_PLATFORM} != "SIMULATOR" ]; then
echo "not SIMULATOR build, skip it."
exit 0
fi
WORKSPACE=/Users/distiller/workspace
PROJ_ROOT=/Users/distiller/project
source ~/anaconda/bin/activate
#install the latest version of PyTorch and TorchVision
pip install torch torchvision
#run unit test
cd ${PROJ_ROOT}/ios/TestApp/benchmark
python trace_model.py
ruby setup.rb
cd ${PROJ_ROOT}/ios/TestApp
instruments -s -devices
fastlane scan
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Pytorch iOS binary builds
- binary_ios_build:
name: pytorch_ios_11_2_1_nightly_x86_64_build
build_environment: "libtorch-ios-11.2.1-nightly-x86_64-build"
name: pytorch_ios_10_2_1_nightly_x86_64_build
build_environment: "libtorch-ios-10.2.1-nightly-x86_64-build"
context: org-member
ios_platform: "SIMULATOR"
ios_arch: "x86_64"
Expand All @@ -11,8 +11,8 @@
branches:
only: nightly
- binary_ios_build:
name: pytorch_ios_11_2_1_nightly_arm64_build
build_environment: "libtorch-ios-11.2.1-nightly-arm64-build"
name: pytorch_ios_10_2_1_nightly_arm64_build
build_environment: "libtorch-ios-10.2.1-nightly-arm64-build"
context: org-member
ios_arch: "arm64"
ios_platform: "OS"
Expand All @@ -22,12 +22,12 @@
branches:
only: nightly
- binary_ios_upload:
build_environment: "libtorch-ios-11.2.1-nightly-binary-build-upload"
build_environment: "libtorch-ios-10.2.1-nightly-binary-build-upload"
context: org-member
requires:
- setup
- pytorch_ios_11_2_1_nightly_x86_64_build
- pytorch_ios_11_2_1_nightly_arm64_build
- pytorch_ios_10_2_1_nightly_x86_64_build
- pytorch_ios_10_2_1_nightly_arm64_build
filters:
branches:
only: nightly
8 changes: 4 additions & 4 deletions .circleci/verbatim-sources/workflows-pytorch-ios-builds.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Pytorch iOS PR builds
- pytorch_ios_build:
name: pytorch_ios_11_2_1_x86_64_build
name: pytorch_ios_10_2_1_x86_64_build
context: org-member
build_environment: "pytorch-ios-11.2.1-x86_64_build"
build_environment: "pytorch-ios-10.2.1-x86_64_build"
ios_arch: "x86_64"
ios_platform: "SIMULATOR"
requires:
- setup
- pytorch_ios_build:
name: pytorch_ios_11_2_1_arm64_build
name: pytorch_ios_10_2_1_arm64_build
context: org-member
build_environment: "pytorch-ios-11.2.1-arm64_build"
build_environment: "pytorch-ios-10.2.1-arm64_build"
ios_arch: "arm64"
ios_platform: "OS"
requires:
Expand Down
2 changes: 0 additions & 2 deletions ios/TestApp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ This will pull the latest version of `LibTorch` from Cocoapods. To run the app,

The TestApp is currently being used as a dummy app by Circle CI for nightly jobs. The challenge comes when testing the arm64 build as we don't have a way to code-sign our TestApp. This is where Fastlane came to rescue. [Fastlane](https://fastlane.tools/) is a trendy automation tool for building and managing iOS applications. It also works seamlessly with Circle CI. We are going to leverage the `import_certificate` action, which can install developer certificates on CI machines. See `Fastfile` for more details.

For simulator build, we run unit test as the last step of our CI workflow. Those unit tests can also be run manually via the `fastlane scan` command.

### Benchmark

The benchmark folder contains two scripts that help you setup the benchmark project. The `setup.rb` does the heavy-lifting jobs of setting up the XCode project, whereas the `trace_model.py` is a Python script that you can tweak to generate your model for benchmarking. Simply follow the steps below to setup the project
Expand Down
10 changes: 3 additions & 7 deletions ios/TestApp/TestApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 52;
objectVersion = 50;
objects = {

/* Begin PBXBuildFile section */
Expand All @@ -14,7 +14,7 @@
A06D4CBD232F0DB200763E16 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A06D4CBC232F0DB200763E16 /* Assets.xcassets */; };
A06D4CC0232F0DB200763E16 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A06D4CBE232F0DB200763E16 /* LaunchScreen.storyboard */; };
A06D4CC3232F0DB200763E16 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = A06D4CC2232F0DB200763E16 /* main.m */; };
A0EA3B0A237FCB72007CEA34 /* TestAppTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = A0EA3B09237FCB72007CEA34 /* TestAppTests.mm */; platformFilter = ios; };
A0EA3B0A237FCB72007CEA34 /* TestAppTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = A0EA3B09237FCB72007CEA34 /* TestAppTests.mm */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -404,9 +404,7 @@
A0EA3B06237FCB08007CEA34 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
DEVELOPMENT_TEAM = "";
CODE_SIGN_STYLE = Automatic;
INFOPLIST_FILE = TestAppTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.4;
LD_RUNPATH_SEARCH_PATHS = (
Expand All @@ -416,8 +414,6 @@
);
PRODUCT_BUNDLE_IDENTIFIER = com.pytorch.ios.TestAppTests;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = "";
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand Down
2 changes: 1 addition & 1 deletion ios/TestApp/TestAppTests/TestAppTests.mm
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ + (void)setUp {
if (std::find(qengines.begin(), qengines.end(), at::QEngine::QNNPACK) != qengines.end()) {
at::globalContext().setQEngine(at::QEngine::QNNPACK);
}
torch::autograd::AutoGradMode guard(false);
}

- (void)setUp {
Expand All @@ -31,7 +32,6 @@ - (void)testForward {
_module.eval();
std::vector<c10::IValue> inputs;
inputs.push_back(torch::ones({1, 3, 224, 224}, at::ScalarType::Float));
torch::autograd::AutoGradMode guard(false);
auto outputTensor = _module.forward(inputs).toTensor();
float* outputBuffer = outputTensor.data_ptr<float>();
XCTAssertTrue(outputBuffer != nullptr, @"");
Expand Down
Loading

0 comments on commit 9fb8799

Please sign in to comment.