1- name : ' Setup Linux Environment '
1+ name : ' Setup Linux environment '
22description : ' Install dependencies for Linux builds'
33
44inputs :
@@ -18,6 +18,11 @@ inputs:
1818 required : false
1919 default : ' ccache'
2020
21+ outputs :
22+ cmake-args :
23+ description : ' The args for generating CMake project'
24+ value : ${{ steps.cmake-args.outputs.cmakeArgs }}
25+
2126runs :
2227 using : " composite"
2328 steps :
2732 echo "::group::Install common dependencies"
2833 sudo apt-get update
2934 sudo apt-get install -y --no-install-recommends \
30- gdb zip \
35+ cmake gdb ninja-build zip \
3136 libblas-dev liblapack-dev liblapacke-dev \
3237 openmpi-bin openmpi-common libopenmpi-dev
3338 echo "::endgroup::"
@@ -50,17 +55,14 @@ runs:
5055 ptx-${{ runner.os }}-${{ runner.arch }}-${{ inputs.toolkit }}-
5156 ${{ hashFiles('mlx/backend/cuda/**') }}
5257
53- - uses : actions/setup-python@v6
54- with :
55- python-version : ${{ inputs.python-version }}
58+ - uses : astral-sh/setup-uv@v7
5659
5760 - name : Setup Python venv
5861 shell : bash
5962 run : |
6063 echo "::group::Setup Python venv"
61- python -m venv .venv
64+ uv venv --python ${{ inputs.python-version }} --managed-python
6265 source .venv/bin/activate
63- pip install setuptools cmake typing_extensions
6466 echo PATH=$PATH >> $GITHUB_ENV
6567 # Search python packages in .venv
6668 echo PYTHONPATH=`python -c 'import sys; print(sys.path[-1])'` >> $GITHUB_ENV
@@ -109,3 +111,29 @@ runs:
109111 echo "::group::NVIDIA-SMI Status"
110112 nvidia-smi || true
111113 echo "::endgroup::"
114+
115+ - name : Generate CMake args
116+ id : cmake-args
117+ shell : bash
118+ run : |
119+ echo "::group::Generate CMake args"
120+ cmakeArgs=(
121+ "-G Ninja"
122+ "-DCMAKE_COMPILE_WARNING_AS_ERROR=ON"
123+ )
124+ if ${{ startsWith(inputs.toolkit, 'cuda') }} ; then
125+ cmakeArgs+=("-DMLX_BUILD_CUDA=ON")
126+ if ${{ runner.arch == 'arm64' }} ; then
127+ # There is no GPU in arm64 runner, use a common arch.
128+ cmakeArgs+=("-DMLX_CUDA_ARCHITECTURES=80")
129+ # Can not build tests and stubs when the built executables can not run.
130+ cmakeArgs+=("-DMLX_BUILD_TESTS=OFF")
131+ cmakeArgs+=("-DMLX_BUILD_PYTHON_STUBS=OFF")
132+ fi
133+ else
134+ cmakeArgs+=("-DMLX_BUILD_CUDA=OFF")
135+ fi
136+ # Pass to following steps.
137+ IFS=" "
138+ echo "cmakeArgs=${cmakeArgs[*]}" >> $GITHUB_OUTPUT
139+ echo "::endgroup::"
0 commit comments