Skip to content

Commit 95674e2

Browse files
committed
[Task] : Add cache build for macos.
1 parent 007d3a1 commit 95674e2

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

.github/actions/setup-build/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ runs:
4040
- name: Install PyTorch nightly depends
4141
if: ${{ runner.os != 'Linux' }}
4242
run: |
43-
python -m pip install --no-cache-dir torch torchvision --index-url https://download.pytorch.org/whl/cpu
43+
python -m pip install -r build-requirements.txt
4444
shell: bash
4545

4646
- name: Install prerequisites (Linux)

build_tools/ci/install_python_deps.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ case $torch_version in
1919
;;
2020
stable)
2121
echo "::group::installing stable torch"
22-
python3 -m pip install --no-cache-dir torch torchvision --index-url https://download.pytorch.org/whl/cpu
22+
# python3 -m pip install --no-cache-dir torch torchvision --index-url https://download.pytorch.org/whl/cpu
2323
python3 -m pip install --no-cache-dir -r $repo_root/build-requirements.txt
2424
echo "::endgroup::"
2525
;;

build_tools/python_deploy/build_macos_packages.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,22 @@ repo_root="$(cd "$this_dir"/../../ && pwd)"
2323
python_versions="${TORCH_MLIR_PYTHON_VERSIONS:-3.9 3.10 3.11}"
2424
output_dir="${output_dir:-${this_dir}/wheelhouse}"
2525
packages="${packages:-torch-mlir}"
26+
cache_dir="${cache_dir:-}"
27+
28+
# Setup cache dir.
29+
if [ -z "${cache_dir}" ]; then
30+
cache_dir="${repo_root}/.build-cache"
31+
mkdir -p "${cache_dir}"
32+
cache_dir="$(cd ${cache_dir} && pwd)"
33+
fi
34+
echo "Caching to ${cache_dir}"
35+
mkdir -p "${cache_dir}/ccache"
36+
mkdir -p "${cache_dir}/pip"
37+
38+
export CCACHE_DIR="${cache_dir}/ccache"
39+
export CCACHE_MAXSIZE="350M"
40+
export CMAKE_C_COMPILER_LAUNCHER=ccache
41+
export CMAKE_CXX_COMPILER_LAUNCHER=ccache
2642

2743
PKG_VER_FILE="${repo_root}"/torch_mlir_package_version ; [ -f "$PKG_VER_FILE" ] && . "$PKG_VER_FILE"
2844
export TORCH_MLIR_PYTHON_PACKAGE_VERSION="${TORCH_MLIR_PYTHON_PACKAGE_VERSION:-0.0.1}"

0 commit comments

Comments
 (0)