mirror of
https://github.com/ml-explore/mlx.git
synced 2025-12-12 15:29:01 +08:00
Use ccache in GitHub Actions (#2773)
* Remove unnecessary steps * Use ccache * Log when using ccache * Set max-size to 1GB * Pass --no-build-isolation * Remove more unused things
This commit is contained in:
2
.github/actions/build-cuda/action.yml
vendored
2
.github/actions/build-cuda/action.yml
vendored
@@ -15,7 +15,7 @@ runs:
|
|||||||
env:
|
env:
|
||||||
DEBUG: 1
|
DEBUG: 1
|
||||||
CMAKE_ARGS: -DMLX_BUILD_CUDA=ON -DCMAKE_COMPILE_WARNING_AS_ERROR=ON -DCMAKE_CUDA_COMPILER=${{ inputs.nvcc-location }}
|
CMAKE_ARGS: -DMLX_BUILD_CUDA=ON -DCMAKE_COMPILE_WARNING_AS_ERROR=ON -DCMAKE_CUDA_COMPILER=${{ inputs.nvcc-location }}
|
||||||
run: pip install -e ".[dev]" -v
|
run: pip install --no-build-isolation -e ".[dev]" -v
|
||||||
|
|
||||||
- name: Build CPP only
|
- name: Build CPP only
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|||||||
2
.github/actions/build-linux/action.yml
vendored
2
.github/actions/build-linux/action.yml
vendored
@@ -9,7 +9,7 @@ runs:
|
|||||||
env:
|
env:
|
||||||
CMAKE_ARGS: "-DCMAKE_COMPILE_WARNING_AS_ERROR=ON"
|
CMAKE_ARGS: "-DCMAKE_COMPILE_WARNING_AS_ERROR=ON"
|
||||||
DEBUG: 1
|
DEBUG: 1
|
||||||
run: pip install -e ".[dev]" -v
|
run: pip install --no-build-isolation -e ".[dev]" -v
|
||||||
|
|
||||||
- name: Generate package stubs
|
- name: Generate package stubs
|
||||||
shell: sh
|
shell: sh
|
||||||
|
|||||||
23
.github/actions/setup-linux/action.yml
vendored
23
.github/actions/setup-linux/action.yml
vendored
@@ -18,42 +18,39 @@ inputs:
|
|||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
steps:
|
steps:
|
||||||
- name: Free disk space
|
- name: Use ccache
|
||||||
shell: sh
|
uses: hendrikmuhs/ccache-action@v1.2
|
||||||
if: inputs.runner-type == 'linux'
|
with:
|
||||||
run: sudo rm -rf "$AGENT_TOOLSDIRECTORY"
|
key: ccache-${{ inputs.runner-type }}-${{ runner.arch }}-py${{ inputs.python-version }}
|
||||||
|
max-size: 1GB
|
||||||
|
|
||||||
- name: Install common dependencies
|
- name: Install common dependencies
|
||||||
env:
|
|
||||||
TZ: Etc/UTC
|
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y libblas-dev liblapack-dev liblapacke-dev tzdata zip
|
sudo apt-get install -y libblas-dev liblapack-dev liblapacke-dev zip
|
||||||
sudo apt autoremove -y
|
|
||||||
|
|
||||||
- uses: actions/setup-python@v6
|
- uses: actions/setup-python@v6
|
||||||
with:
|
with:
|
||||||
python-version: ${{ inputs.python-version }}
|
python-version: ${{ inputs.python-version }}
|
||||||
cache: 'pip'
|
cache: 'pip'
|
||||||
|
|
||||||
- name: setup python venv
|
- name: Setup Python venv
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
python -m venv .venv
|
python -m venv .venv
|
||||||
source .venv/bin/activate
|
source .venv/bin/activate
|
||||||
|
pip install cmake nanobind==2.4.0
|
||||||
echo PATH=$PATH >> $GITHUB_ENV
|
echo PATH=$PATH >> $GITHUB_ENV
|
||||||
pip install --upgrade pip cmake
|
# Make cmake search .venv for nanobind
|
||||||
|
echo PYTHONPATH=`python -c 'import sys; print(sys.path[-1])'` >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Install MPI
|
- name: Install MPI
|
||||||
shell: bash
|
shell: bash
|
||||||
run: sudo apt-get install -y openmpi-bin openmpi-common libopenmpi-dev
|
run: sudo apt-get install -y openmpi-bin openmpi-common libopenmpi-dev
|
||||||
|
|
||||||
- name: Network CUDA installation from packages
|
- name: Network CUDA installation from packages
|
||||||
id: install-cuda
|
|
||||||
if: inputs.runner-type == 'cuda'
|
if: inputs.runner-type == 'cuda'
|
||||||
env:
|
|
||||||
TZ: Etc/UTC
|
|
||||||
shell: bash ## Specific to Ubuntu 22.04 & Architecture x86_64
|
shell: bash ## Specific to Ubuntu 22.04 & Architecture x86_64
|
||||||
run: |
|
run: |
|
||||||
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb
|
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ endif()
|
|||||||
if(MLX_USE_CCACHE)
|
if(MLX_USE_CCACHE)
|
||||||
find_program(CCACHE_PROGRAM ccache)
|
find_program(CCACHE_PROGRAM ccache)
|
||||||
if(CCACHE_PROGRAM)
|
if(CCACHE_PROGRAM)
|
||||||
|
message(STATUS "Found CCache: ${CCACHE_PROGRAM}")
|
||||||
set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
|
set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
|
||||||
set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
|
set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
|
||||||
set(CMAKE_CUDA_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
|
set(CMAKE_CUDA_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
|
||||||
|
|||||||
Reference in New Issue
Block a user