Skip to content

Commit bf70ba2

Browse files
Merge pull request #370 from puneetmatharu/add-cleanup-to-build-force
2 parents 439e29d + 9761553 commit bf70ba2

2 files changed

Lines changed: 25 additions & 5 deletions

File tree

ML-Frameworks/pytorch-aarch64/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ where `YY` is the year, and `MM` the month of the increment.
1919
- TORCH_AO_HASH to 8e2ca35ea603349e71c2467e10fd371e34bf52bc, from main, September 23rd.
2020
- KLEIDIAI_HASH to bd2e6ae060014035e25bf4986be682762c446c2d, v1.14 from main.
2121
- Update torchvision from 0.23.0 to a nightly build, 0.25.0.dev20250923
22+
- Change of flag name in `./build.sh` from `--force` to `--fresh`
2223

2324
### Removed
2425
- Removes WIP ComputeLibrary patch https://review.mlplatform.org/c/ml/ComputeLibrary/+/12818/1.

ML-Frameworks/pytorch-aarch64/build.sh

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,33 @@ build_log=build-$(git rev-parse --short=7 HEAD)-$(date '+%Y-%m-%dT%H-%M-%S').log
2424
exec &> >(tee -a $build_log)
2525

2626
# Bail out if sources are already there
27-
if [ -d pytorch ] || [ -d builder ] || [ -d ComputeLibrary ] ; then
28-
echo "You appear to have sources already (pytorch/builder/ComputeLibrary)" \
27+
if [ -f .torch_build_container_id ] || [ -f .torch_ao_build_container_id ] || \
28+
[ -d ao ] || [ -d ComputeLibrary ] || [ -d pytorch ]; then
29+
printf "\n\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n\n\n" \
30+
"You appear to have artefacts from a previous build lying around." \
31+
"Check for any of the following:" \
32+
" - .torch_build_container_id" \
33+
" - .torch_ao_build_container_id" \
34+
" - ao" \
35+
" - ComputeLibrary" \
36+
" - pytorch"
2937

30-
if ! ([[ $* == *--force* ]] || [[ $* == *--use-existing-sources* ]]) ; then
31-
>&2 echo "rerun with --force to overwrite sources or with" \
32-
"--use-existing-sources to build your existing sources."
38+
if [[ "$*" != *--fresh* ]] && [[ "$*" != *--use-existing-sources* ]]; then
39+
>&2 printf "\n\n%s\n%s\n%s\n\n\n" \
40+
"Rerun with one of the following options:" \
41+
" - '--fresh': wipe the pre-existing sources and do a fresh build" \
42+
" - '--use-existing-sources': reuse the sources as is"
3343
exit 1
3444
fi
45+
46+
# Wipe old build artefacts
47+
if [[ $* == *--fresh* ]]; then
48+
if [ -f .torch_build_container_id ]; then rm -f .torch_build_container_id; fi
49+
if [ -f .torch_ao_build_container_id ]; then rm -f .torch_ao_build_container_id; fi
50+
if [ -d ao ]; then rm -rf ao; fi
51+
if [ -d ComputeLibrary ]; then rm -rf ComputeLibrary; fi
52+
if [ -d pytorch ]; then rm -rf pytorch; fi
53+
fi
3554
fi
3655

3756
if ! [[ $* == *--use-existing-sources* ]]; then

0 commit comments

Comments
 (0)