Skip to content

sh clean.sh script that does cleaning #7108

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .ci/scripts/build_llama_android.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ source "$(dirname "${BASH_SOURCE[0]}")/utils.sh"

install_executorch_and_backend_lib() {
echo "Installing executorch and xnnpack backend"
rm -rf cmake-android-out && mkdir cmake-android-out
clean_executorch_install_folders
mkdir cmake-android-out
ANDROID_NDK=/opt/ndk
BUCK2=buck2
ANDROID_ABI=arm64-v8a
Expand Down
2 changes: 1 addition & 1 deletion .ci/scripts/test_llama.sh
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ which "${PYTHON_EXECUTABLE}"

cmake_install_executorch_libraries() {
echo "Installing libexecutorch.a, libextension_module.so, libportable_ops_lib.a"
rm -rf cmake-out
clean_executorch_install_folders
retry cmake \
-DCMAKE_INSTALL_PREFIX=cmake-out \
-DCMAKE_BUILD_TYPE="$CMAKE_BUILD_TYPE" \
Expand Down
9 changes: 7 additions & 2 deletions .ci/scripts/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ retry () {
"$@" || (sleep 30 && reset_buck && "$@") || (sleep 60 && reset_buck && "$@")
}

clean_executorch_install_folders() {
./install_requirements.sh --clean
}

install_executorch() {
which pip
# Install executorch, this assumes that Executorch is checked out in the
Expand Down Expand Up @@ -74,7 +78,8 @@ build_executorch_runner_buck2() {
build_executorch_runner_cmake() {
CMAKE_OUTPUT_DIR=cmake-out
# Build executorch runtime using cmake
rm -rf "${CMAKE_OUTPUT_DIR}" && mkdir "${CMAKE_OUTPUT_DIR}"
clean_executorch_install_folders
mkdir "${CMAKE_OUTPUT_DIR}"

pushd "${CMAKE_OUTPUT_DIR}" || return
# This command uses buck2 to gather source files and buck2 could crash flakily
Expand Down Expand Up @@ -103,7 +108,7 @@ build_executorch_runner() {

cmake_install_executorch_lib() {
echo "Installing libexecutorch.a and libportable_kernels.a"
rm -rf cmake-out
clean_executorch_install_folders
retry cmake -DBUCK2="$BUCK" \
-DCMAKE_INSTALL_PREFIX=cmake-out \
-DCMAKE_BUILD_TYPE=Release \
Expand Down
7 changes: 4 additions & 3 deletions docs/source/getting-started-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ to ExecuTorch.
>
> ```bash
> # From the root of the executorch repo:
> rm -rf cmake-out pip-out
> ./install_requirements.sh --clean
> git submodule sync
> git submodule update --init
> ```
Expand Down Expand Up @@ -196,7 +196,8 @@ The ExecuTorch repo uses CMake to build its C++ code. Here, we'll configure it t
```bash
# Clean and configure the CMake build system. Compiled programs will
# appear in the executorch/cmake-out directory we create here.
(rm -rf cmake-out && mkdir cmake-out && cd cmake-out && cmake ..)
./install_requirements.sh --clean
(mkdir cmake-out && cd cmake-out && cmake ..)

# Build the executor_runner target
cmake --build cmake-out --target executor_runner -j9
Expand All @@ -213,7 +214,7 @@ The ExecuTorch repo uses CMake to build its C++ code. Here, we'll configure it t
>
> ```bash
> # From the root of the executorch repo:
> rm -rf cmake-out pip-out
> ./install_requirements.sh --clean
> git submodule sync
> git submodule update --init
> ```
Expand Down
6 changes: 4 additions & 2 deletions docs/source/runtime-build-and-cross-compilation.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ cd executorch

# Clean and configure the CMake build system. It's good practice to do this
# whenever cloning or pulling the upstream repo.
(rm -rf cmake-out && mkdir cmake-out && cd cmake-out && cmake ..)
./install_requirements.sh --clean
(mkdir cmake-out && cd cmake-out && cmake ..)
```

Once this is done, you don't need to do it again until you pull from the upstream repo again, or if you modify any CMake-related files.
Expand Down Expand Up @@ -121,7 +122,8 @@ Following are instruction on how to perform cross compilation for Android and iO
Assuming Android NDK is available, run:
```bash
# Run the following lines from the `executorch/` folder
rm -rf cmake-android-out && mkdir cmake-android-out && cd cmake-android-out
./install_requirements.sh --clean
mkdir cmake-android-out && cd cmake-android-out

# point -DCMAKE_TOOLCHAIN_FILE to the location where ndk is installed
cmake -DCMAKE_TOOLCHAIN_FILE=/Users/{user_name}/Library/Android/sdk/ndk/25.2.9519653/build/cmake/android.toolchain.cmake -DANDROID_ABI=arm64-v8a ..
Expand Down
7 changes: 5 additions & 2 deletions examples/demo-apps/android/ExecuTorchDemo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ We build the required ExecuTorch runtime library to run the model.
export ANDROID_NDK=<path-to-android-ndk>
export ANDROID_ABI=arm64-v8a

rm -rf cmake-android-out && mkdir cmake-android-out
# Run the following lines from the `executorch/` folder
./install_requirements.sh --clean
mkdir cmake-android-out

# Build the core executorch library
cmake . -DCMAKE_INSTALL_PREFIX=cmake-android-out \
Expand Down Expand Up @@ -112,7 +114,8 @@ export ANDROID_NDK=<path-to-android-ndk>
export ANDROID_ABI=arm64-v8a
export QNN_SDK_ROOT=<path-to-qnn-sdk>

rm -rf cmake-android-out && mkdir cmake-android-out && cd cmake-android-out
./install_requirements.sh --clean
mkdir cmake-android-out && cd cmake-android-out
cmake . -DCMAKE_INSTALL_PREFIX=cmake-android-out \
-DCMAKE_TOOLCHAIN_FILE="${ANDROID_NDK}/build/cmake/android.toolchain.cmake" \
-DANDROID_ABI="${ANDROID_ABI}" \
Expand Down
2 changes: 1 addition & 1 deletion examples/devtools/build_example_runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ done
main() {
cd "${EXECUTORCH_ROOT}"

rm -rf cmake-out
./install_requirements.sh --clean

if [[ "${BUILD_COREML}" == "ON" ]]; then
cmake -DCMAKE_INSTALL_PREFIX=cmake-out \
Expand Down
2 changes: 1 addition & 1 deletion examples/devtools/test_example_runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ source "$(dirname "${BASH_SOURCE[0]}")/../../.ci/scripts/utils.sh"

cmake_install_executorch_devtools_lib() {
echo "Installing libexecutorch.a, libportable_kernels.a, libetdump.a, libbundled_program.a"
rm -rf cmake-out
clean_executorch_install_folders

retry cmake -DCMAKE_INSTALL_PREFIX=cmake-out \
-DCMAKE_BUILD_TYPE=Release \
Expand Down
5 changes: 3 additions & 2 deletions examples/xnnpack/quantization/test_quantize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ test_cmake_quantization() {
SITE_PACKAGES="$(${PYTHON_EXECUTABLE} -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())')"
CMAKE_PREFIX_PATH="${SITE_PACKAGES}/torch"

(rm -rf cmake-out \
&& mkdir cmake-out \
clean_executorch_install_folders

(mkdir cmake-out \
&& cd cmake-out \
&& retry cmake \
-DCMAKE_BUILD_TYPE=Release \
Expand Down
2 changes: 1 addition & 1 deletion install_requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def python_is_compatible():
print("Cleaning build artifacts...")
print("Cleaning pip-out/...")
shutil.rmtree("pip-out/", ignore_errors=True)
dirs = glob.glob("cmake-out*/")
dirs = glob.glob("cmake-out*/") + glob.glob("cmake-android-out/")
for d in dirs:
print(f"Cleaning {d}...")
shutil.rmtree(d, ignore_errors=True)
Expand Down
2 changes: 1 addition & 1 deletion test/build_size_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ source "$(dirname "${BASH_SOURCE[0]}")/../.ci/scripts/utils.sh"

cmake_install_executorch_lib() {
echo "Installing libexecutorch.a"
rm -rf cmake-out
clean_executorch_install_folders

retry cmake -DBUCK2="$BUCK2" \
-DCMAKE_CXX_STANDARD_REQUIRED=ON \
Expand Down
Loading