Skip to content

Commit e34ecdd

Browse files
huydhnfacebook-github-bot
authored andcommitted
Upgrade flatbuffers version to 23.5.26 (#465)
Summary: `23.5.26` from conda-forge https://anaconda.org/conda-forge/flatbuffers matches the third-party commit. This is to avoid compilation issue when the version of `flatbuffers` from conda (used by CI) is different than the third-party commit (used when compiling). Pull Request resolved: #465 Reviewed By: cccclai Differential Revision: D49567226 Pulled By: huydhn fbshipit-source-id: 8926631eebf5faad3d0aaaa288fd369c18b472f7
1 parent c3a6a6a commit e34ecdd

File tree

6 files changed

+32
-10
lines changed

6 files changed

+32
-10
lines changed

.ci/docker/conda-env-ci.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
# TODO: We might need to update this to install flatbuffers from the pinned commit
2-
# in fbcode/executorch/third-party/flatbuffers.submodule.txt
3-
flatbuffers=2.0.0
41
cmake=3.22.1

.ci/scripts/setup-linux.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,6 @@ fi
2020

2121
# As Linux job is running inside a Docker container, all of its dependencies
2222
# have already been installed
23+
install_flatc_from_source
2324
install_executorch
2425
build_executorch_runner "${BUILD_TOOL}"

.ci/scripts/setup-macos.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,5 +80,6 @@ install_buck
8080
install_conda
8181
install_pip_dependencies
8282
print_cmake_info
83+
install_flatc_from_source
8384
install_executorch
8485
build_executorch_runner "${BUILD_TOOL}"

.ci/scripts/utils.sh

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ install_executorch() {
2727
install_conda() {
2828
pushd .ci/docker || return
2929
# Install conda dependencies like flatbuffer
30-
conda install --file conda-env-ci.txt
30+
conda install -y --file conda-env-ci.txt
3131
popd || return
3232
}
3333

@@ -49,6 +49,25 @@ install_pip_dependencies() {
4949
popd || return
5050
}
5151

52+
install_flatc_from_source() {
53+
# NB: This function could be used to install flatbuffer from source
54+
pushd third-party/flatbuffers || return
55+
56+
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release
57+
if [ "$(uname)" == "Darwin" ]; then
58+
CMAKE_JOBS=$(( $(sysctl -n hw.ncpu) - 1 ))
59+
else
60+
CMAKE_JOBS=$(( $(nproc) - 1 ))
61+
fi
62+
cmake --build . -j "${CMAKE_JOBS}"
63+
64+
# Copy the flatc binary to conda path
65+
EXEC_PATH=$(dirname "$(which python)")
66+
cp flatc "${EXEC_PATH}"
67+
68+
popd || return
69+
}
70+
5271
build_executorch_runner_buck2() {
5372
# Build executorch runtime with retry as this step is flaky on macos CI
5473
retry buck2 build //examples/executor_runner:executor_runner

.github/workflows/_unittest.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ on:
1515
jobs:
1616
linux:
1717
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main
18+
strategy:
19+
matrix:
20+
include:
21+
- build-tool: buck2
1822
with:
1923
runner: linux.2xlarge
2024
docker-image: ${{ inputs.docker-image }}
@@ -28,8 +32,10 @@ jobs:
2832
CONDA_ENV=$(conda env list --json | jq -r ".envs | .[-1]")
2933
conda activate "${CONDA_ENV}"
3034
31-
# Just need to install executorch, everything else has been setup
32-
pip install .
35+
BUILD_TOOL=${{ matrix.build-tool }}
36+
# Setup MacOS dependencies as there is no Docker support on MacOS atm
37+
PYTHON_EXECUTABLE=python bash .ci/scripts/setup-linux.sh "${BUILD_TOOL}"
38+
3339
# Run pytest with coverage
3440
pytest -n auto --cov=./ --cov-report=xml
3541
@@ -53,8 +59,6 @@ jobs:
5359
# Setup MacOS dependencies as there is no Docker support on MacOS atm
5460
PYTHON_EXECUTABLE=python bash .ci/scripts/setup-macos.sh "${BUILD_TOOL}"
5561
56-
# Just need to install executorch, everything else has been setup
57-
pip install .
5862
# Run pytest with coverage
5963
pytest -n auto --cov=./ --cov-report=xml
6064
# Run gtest

.github/workflows/pull.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,12 @@ jobs:
130130
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
131131
script: |
132132
WORKSPACE=$(pwd)
133-
134133
pushd "${WORKSPACE}/pytorch/executorch"
135134
136135
BUILD_TOOL=${{ matrix.build-tool }}
137136
# Setup MacOS dependencies as there is no Docker support on MacOS atm
138137
PYTHON_EXECUTABLE=python bash .ci/scripts/setup-macos.sh "${BUILD_TOOL}"
138+
139139
# Build and test custom ops
140140
PYTHON_EXECUTABLE=python bash examples/custom_ops/test_custom_ops.sh "${BUILD_TOOL}"
141141
popd
@@ -179,12 +179,12 @@ jobs:
179179
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
180180
script: |
181181
WORKSPACE=$(pwd)
182-
183182
pushd "${WORKSPACE}/pytorch/executorch"
184183
185184
BUILD_TOOL=${{ matrix.build-tool }}
186185
# Setup MacOS dependencies as there is no Docker support on MacOS atm
187186
PYTHON_EXECUTABLE=python bash .ci/scripts/setup-macos.sh "${BUILD_TOOL}"
187+
188188
# Build and test selective build
189189
PYTHON_EXECUTABLE=python bash examples/selective_build/test_selective_build.sh "${BUILD_TOOL}"
190190
popd

0 commit comments

Comments
 (0)