File tree Expand file tree Collapse file tree 5 files changed +48
-9
lines changed Expand file tree Collapse file tree 5 files changed +48
-9
lines changed Original file line number Diff line number Diff line change @@ -57,10 +57,28 @@ install_buck() {
57
57
fi
58
58
}
59
59
60
+ # This is the same rpath fix copied from PyTorch macos setup script
61
+ # https://github.com/pytorch/pytorch/blob/main/.ci/pytorch/macos-common.sh
62
+ print_cmake_info () {
63
+ CMAKE_EXEC=$( which cmake)
64
+ echo " $CMAKE_EXEC "
65
+
66
+ export CMAKE_EXEC
67
+ # Explicitly add conda env lib folder to cmake rpath to address the flaky issue
68
+ # where cmake dependencies couldn't be found. This seems to point to how conda
69
+ # links $CMAKE_EXEC to its package cache when cloning a new environment
70
+ install_name_tool -add_rpath @executable_path/../lib " ${CMAKE_EXEC} " || true
71
+ # Adding the rpath will invalidate cmake signature, so signing it again here
72
+ # to trust the executable. EXC_BAD_ACCESS (SIGKILL (Code Signature Invalid))
73
+ # with an exit code 137 otherwise
74
+ codesign -f -s - " ${CMAKE_EXEC} " || true
75
+ }
76
+
60
77
# NB: we need buck2 in all cases because cmake build also depends on calling
61
78
# buck2 atm
62
79
install_buck
63
80
install_conda
64
81
install_pip_dependencies
82
+ print_cmake_info
65
83
install_executorch
66
84
build_executorch_runner " ${BUILD_TOOL} "
Original file line number Diff line number Diff line change 5
5
# This source code is licensed under the BSD-style license found in the
6
6
# LICENSE file in the root directory of this source tree.
7
7
8
+ reset_buck () {
9
+ # On MacOS, buck2 daemon can get into a weird non-responsive state
10
+ buck2 kill && buck2 clean
11
+ rm -rf ~ /.buck/buckd
12
+ }
13
+
14
+ retry () {
15
+ " $@ " || (sleep 30 && reset_buck && " $@ " ) || (sleep 60 && reset_buck && " $@ " )
16
+ }
17
+
8
18
install_executorch () {
9
19
which pip
10
20
# Install executorch, this assumes that Executorch is checked out in the
@@ -40,8 +50,8 @@ install_pip_dependencies() {
40
50
}
41
51
42
52
build_executorch_runner_buck2 () {
43
- # Build executorch runtime
44
- buck2 build //examples/executor_runner:executor_runner
53
+ # Build executorch runtime with retry as this step is flaky on macos CI
54
+ retry buck2 build //examples/executor_runner:executor_runner
45
55
}
46
56
47
57
build_executorch_runner_cmake () {
@@ -50,7 +60,9 @@ build_executorch_runner_cmake() {
50
60
rm -rf " ${CMAKE_OUTPUT_DIR} " && mkdir " ${CMAKE_OUTPUT_DIR} "
51
61
52
62
pushd " ${CMAKE_OUTPUT_DIR} " || return
53
- cmake -DBUCK2=buck2 -DPYTHON_EXECUTABLE=" ${PYTHON_EXECUTABLE} " ..
63
+ # This command uses buck2 to gather source files and buck2 could crash flakily
64
+ # on MacOS
65
+ retry cmake -DBUCK2=buck2 -DPYTHON_EXECUTABLE=" ${PYTHON_EXECUTABLE} " ..
54
66
popd || return
55
67
56
68
if [ " $( uname) " == " Darwin" ]; then
Original file line number Diff line number Diff line change 11
11
12
12
set -e
13
13
14
+ # shellcheck source=/dev/null
15
+ source " $( dirname " ${BASH_SOURCE[0]} " ) /../../.ci/scripts/utils.sh"
16
+
14
17
test_buck2_custom_op_1 () {
15
18
local model_name=' custom_ops_1'
16
19
echo " Exporting ${model_name} .pte"
@@ -34,7 +37,7 @@ test_cmake_custom_op_1() {
34
37
(rm -rf cmake-out \
35
38
&& mkdir cmake-out \
36
39
&& cd cmake-out \
37
- && cmake -DBUCK2=buck2 \
40
+ && retry cmake -DBUCK2=buck2 \
38
41
-DREGISTER_EXAMPLE_CUSTOM_OP=1 \
39
42
-DPYTHON_EXECUTABLE=" $PYTHON_EXECUTABLE " ..)
40
43
@@ -85,7 +88,7 @@ test_cmake_custom_op_2() {
85
88
(rm -rf cmake-out \
86
89
&& mkdir cmake-out \
87
90
&& cd cmake-out \
88
- && cmake -DBUCK2=buck2 \
91
+ && retry cmake -DBUCK2=buck2 \
89
92
-DREGISTER_EXAMPLE_CUSTOM_OP=2 \
90
93
-DCMAKE_PREFIX_PATH=" $CMAKE_PREFIX_PATH " \
91
94
-DPYTHON_EXECUTABLE=" $PYTHON_EXECUTABLE " ..)
Original file line number Diff line number Diff line change 9
9
10
10
set -e
11
11
12
+ # shellcheck source=/dev/null
13
+ source " $( dirname " ${BASH_SOURCE[0]} " ) /../../.ci/scripts/utils.sh"
14
+
12
15
get_shared_lib_ext () {
13
16
UNAME=$( uname)
14
17
if [[ $UNAME == " Darwin" ]];
@@ -47,7 +50,7 @@ test_cmake_quantization() {
47
50
(rm -rf cmake-out \
48
51
&& mkdir cmake-out \
49
52
&& cd cmake-out \
50
- && cmake -DBUCK2=buck2 \
53
+ && retry cmake -DBUCK2=buck2 \
51
54
-DREGISTER_QUANTIZED_OPS=ON \
52
55
-DCMAKE_PREFIX_PATH=" $CMAKE_PREFIX_PATH " \
53
56
-DPYTHON_EXECUTABLE=" $PYTHON_EXECUTABLE " ..)
Original file line number Diff line number Diff line change 12
12
# 4. (TODO) Select from a serialized model (.pte)
13
13
set -e
14
14
15
+ # shellcheck source=/dev/null
16
+ source " $( dirname " ${BASH_SOURCE[0]} " ) /../../.ci/scripts/utils.sh"
17
+
15
18
test_buck2_select_all_ops () {
16
19
echo " Exporting MobilenetV3"
17
20
${PYTHON_EXECUTABLE} -m examples.export.export_example --model_name=" mv3"
@@ -57,7 +60,7 @@ test_cmake_select_all_ops() {
57
60
(rm -rf cmake-out \
58
61
&& mkdir cmake-out \
59
62
&& cd cmake-out \
60
- && cmake -DBUCK2=" $BUCK " \
63
+ && retry cmake -DBUCK2=" $BUCK " \
61
64
-DBUILD_SELECTIVE_BUILD_TEST=ON \
62
65
-DCMAKE_BUILD_TYPE=Release \
63
66
-DSELECT_ALL_OPS=ON \
@@ -81,7 +84,7 @@ test_cmake_select_ops_in_list() {
81
84
(rm -rf cmake-out \
82
85
&& mkdir cmake-out \
83
86
&& cd cmake-out \
84
- && cmake -DBUCK2=" $BUCK " \
87
+ && retry cmake -DBUCK2=" $BUCK " \
85
88
-DMAX_KERNEL_NUM=16 \
86
89
-DBUILD_SELECTIVE_BUILD_TEST=ON \
87
90
-DCMAKE_BUILD_TYPE=Release \
@@ -108,7 +111,7 @@ test_cmake_select_ops_in_yaml() {
108
111
(rm -rf cmake-out \
109
112
&& mkdir cmake-out \
110
113
&& cd cmake-out \
111
- && cmake -DBUCK2=" $BUCK " \
114
+ && retry cmake -DBUCK2=" $BUCK " \
112
115
-DBUILD_SELECTIVE_BUILD_TEST=ON \
113
116
-DCMAKE_BUILD_TYPE=Release \
114
117
-DSELECT_OPS_YAML=ON \
You can’t perform that action at this time.
0 commit comments