mirror of
https://github.com/ml-explore/mlx.git
synced 2025-12-12 07:18:52 +08:00
Linux on arm (#2751)
Some checks failed
Nightly Build / build_linux_release (3.10) (push) Has been cancelled
Nightly Build / build_linux_release (3.14) (push) Has been cancelled
Nightly Build / build_linux_with_tests (3.10, ubuntu-22.04) (push) Has been cancelled
Nightly Build / build_linux_with_tests (3.10, ubuntu-22.04-arm) (push) Has been cancelled
Nightly Build / build_linux_with_tests (3.11, ubuntu-22.04) (push) Has been cancelled
Nightly Build / build_linux_with_tests (3.11, ubuntu-22.04-arm) (push) Has been cancelled
Nightly Build / build_linux_with_tests (3.12, ubuntu-22.04) (push) Has been cancelled
Nightly Build / build_linux_with_tests (3.12, ubuntu-22.04-arm) (push) Has been cancelled
Nightly Build / build_linux_with_tests (3.13, ubuntu-22.04) (push) Has been cancelled
Nightly Build / build_linux_with_tests (3.13, ubuntu-22.04-arm) (push) Has been cancelled
Nightly Build / build_linux_with_tests (3.14, ubuntu-22.04) (push) Has been cancelled
Nightly Build / build_linux_with_tests (3.14, ubuntu-22.04-arm) (push) Has been cancelled
Nightly Build / build_mac_release (3.10) (push) Has been cancelled
Nightly Build / build_mac_release (3.13) (push) Has been cancelled
Nightly Build / build_cuda_with_tests (push) Has been cancelled
Nightly Build / build_cuda_release (push) Has been cancelled
Nightly Build / Linux Fedora CPP Build (aarch64) (push) Has been cancelled
Nightly Build / Linux Fedora CPP Build (x86_64) (push) Has been cancelled
Some checks failed
Nightly Build / build_linux_release (3.10) (push) Has been cancelled
Nightly Build / build_linux_release (3.14) (push) Has been cancelled
Nightly Build / build_linux_with_tests (3.10, ubuntu-22.04) (push) Has been cancelled
Nightly Build / build_linux_with_tests (3.10, ubuntu-22.04-arm) (push) Has been cancelled
Nightly Build / build_linux_with_tests (3.11, ubuntu-22.04) (push) Has been cancelled
Nightly Build / build_linux_with_tests (3.11, ubuntu-22.04-arm) (push) Has been cancelled
Nightly Build / build_linux_with_tests (3.12, ubuntu-22.04) (push) Has been cancelled
Nightly Build / build_linux_with_tests (3.12, ubuntu-22.04-arm) (push) Has been cancelled
Nightly Build / build_linux_with_tests (3.13, ubuntu-22.04) (push) Has been cancelled
Nightly Build / build_linux_with_tests (3.13, ubuntu-22.04-arm) (push) Has been cancelled
Nightly Build / build_linux_with_tests (3.14, ubuntu-22.04) (push) Has been cancelled
Nightly Build / build_linux_with_tests (3.14, ubuntu-22.04-arm) (push) Has been cancelled
Nightly Build / build_mac_release (3.10) (push) Has been cancelled
Nightly Build / build_mac_release (3.13) (push) Has been cancelled
Nightly Build / build_cuda_with_tests (push) Has been cancelled
Nightly Build / build_cuda_release (push) Has been cancelled
Nightly Build / Linux Fedora CPP Build (aarch64) (push) Has been cancelled
Nightly Build / Linux Fedora CPP Build (x86_64) (push) Has been cancelled
* try linux on arm * ssh * fix
This commit is contained in:
11
.github/actions/build-linux-release/action.yml
vendored
11
.github/actions/build-linux-release/action.yml
vendored
@@ -7,6 +7,13 @@ inputs:
|
|||||||
type: boolean
|
type: boolean
|
||||||
required: false
|
required: false
|
||||||
default: false
|
default: false
|
||||||
|
arch:
|
||||||
|
description: 'Platform architecture tag'
|
||||||
|
required: true
|
||||||
|
type: choice
|
||||||
|
options:
|
||||||
|
- x86_64
|
||||||
|
- aarch64
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
@@ -23,11 +30,11 @@ runs:
|
|||||||
pip install auditwheel patchelf build
|
pip install auditwheel patchelf build
|
||||||
python setup.py clean --all
|
python setup.py clean --all
|
||||||
MLX_BUILD_STAGE=1 python -m build -w
|
MLX_BUILD_STAGE=1 python -m build -w
|
||||||
bash python/scripts/repair_linux.sh
|
bash python/scripts/repair_linux.sh ${{ inputs.arch }}
|
||||||
- name: Build backend package
|
- name: Build backend package
|
||||||
if: ${{ inputs.build-backend }}
|
if: ${{ inputs.build-backend }}
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
python setup.py clean --all
|
python setup.py clean --all
|
||||||
MLX_BUILD_STAGE=2 python -m build -w
|
MLX_BUILD_STAGE=2 python -m build -w
|
||||||
auditwheel repair dist/mlx_cpu*.whl --plat manylinux_2_35_x86_64
|
auditwheel repair dist/mlx_cpu*.whl --plat manylinux_2_35_${{ inputs.arch }}
|
||||||
|
|||||||
6
.github/workflows/nightly.yml
vendored
6
.github/workflows/nightly.yml
vendored
@@ -21,6 +21,7 @@ jobs:
|
|||||||
- uses: ./.github/actions/build-linux-release
|
- uses: ./.github/actions/build-linux-release
|
||||||
with:
|
with:
|
||||||
build-backend: ${{ matrix.python-version == '3.10' }}
|
build-backend: ${{ matrix.python-version == '3.10' }}
|
||||||
|
arch: "x86_64"
|
||||||
- name: Upload mlx artifacts
|
- name: Upload mlx artifacts
|
||||||
uses: actions/upload-artifact@v5
|
uses: actions/upload-artifact@v5
|
||||||
with:
|
with:
|
||||||
@@ -40,7 +41,10 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
python_version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
|
python_version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
|
||||||
runs-on: ubuntu-22.04
|
runner:
|
||||||
|
- ubuntu-22.04
|
||||||
|
- ubuntu-22.04-arm
|
||||||
|
runs-on: ${{ matrix.runner }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- uses: ./.github/actions/setup-linux
|
- uses: ./.github/actions/setup-linux
|
||||||
|
|||||||
8
.github/workflows/pull_request.yml
vendored
8
.github/workflows/pull_request.yml
vendored
@@ -14,7 +14,13 @@ jobs:
|
|||||||
- uses: pre-commit/action@v3.0.1
|
- uses: pre-commit/action@v3.0.1
|
||||||
|
|
||||||
linux_build_and_test:
|
linux_build_and_test:
|
||||||
runs-on: ubuntu-22.04
|
strategy:
|
||||||
|
matrix:
|
||||||
|
runner:
|
||||||
|
- ubuntu-22.04
|
||||||
|
- ubuntu-22.04-arm
|
||||||
|
fail-fast: false
|
||||||
|
runs-on: ${{ matrix.runner }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- uses: ./.github/actions/setup-linux
|
- uses: ./.github/actions/setup-linux
|
||||||
|
|||||||
8
.github/workflows/release.yml
vendored
8
.github/workflows/release.yml
vendored
@@ -45,7 +45,12 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
python_version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
|
python_version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
|
||||||
runs-on: ubuntu-22.04
|
include:
|
||||||
|
- runner: ubuntu-24.04
|
||||||
|
arch: x64
|
||||||
|
- runner: ubuntu-24.04-arm64
|
||||||
|
arch: arm64
|
||||||
|
runs-on: ${{ matrix.runner }}
|
||||||
env:
|
env:
|
||||||
PYPI_RELEASE: 1
|
PYPI_RELEASE: 1
|
||||||
steps:
|
steps:
|
||||||
@@ -56,6 +61,7 @@ jobs:
|
|||||||
- uses: ./.github/actions/build-linux-release
|
- uses: ./.github/actions/build-linux-release
|
||||||
with:
|
with:
|
||||||
build-backend: ${{ matrix.python-version == '3.10' }}
|
build-backend: ${{ matrix.python-version == '3.10' }}
|
||||||
|
arch: ${{ matrix.arch }}
|
||||||
- name: Upload MLX artifacts
|
- name: Upload MLX artifacts
|
||||||
uses: actions/upload-artifact@v5
|
uses: actions/upload-artifact@v5
|
||||||
with:
|
with:
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
auditwheel repair dist/* \
|
auditwheel repair dist/* \
|
||||||
--plat manylinux_2_35_x86_64 \
|
--plat manylinux_2_35_${1} \
|
||||||
--only-plat \
|
--only-plat \
|
||||||
--exclude libmlx* \
|
--exclude libmlx* \
|
||||||
-w wheel_tmp
|
-w wheel_tmp
|
||||||
|
|||||||
@@ -425,9 +425,11 @@ TEST_CASE("test matrix pseudo-inverse") {
|
|||||||
const auto A = array({1.0, 2.0, 3.0, 4.0}, {2, 2});
|
const auto A = array({1.0, 2.0, 3.0, 4.0}, {2, 2});
|
||||||
const auto A_pinv = linalg::pinv(A, Device::cpu);
|
const auto A_pinv = linalg::pinv(A, Device::cpu);
|
||||||
const auto A_again = matmul(matmul(A, A_pinv), A);
|
const auto A_again = matmul(matmul(A, A_pinv), A);
|
||||||
CHECK(allclose(A_again, A).item<bool>());
|
CHECK(allclose(A_again, A, /* rtol = */ 1e-5, /* atol = */ 1e-5)
|
||||||
|
.item<bool>());
|
||||||
const auto A_pinv_again = matmul(matmul(A_pinv, A), A_pinv);
|
const auto A_pinv_again = matmul(matmul(A_pinv, A), A_pinv);
|
||||||
CHECK(allclose(A_pinv_again, A_pinv).item<bool>());
|
CHECK(allclose(A_pinv_again, A_pinv, /* rtol = */ 1e-5, /* atol = */ 1e-5)
|
||||||
|
.item<bool>());
|
||||||
}
|
}
|
||||||
{ // Rectangular matrix m < n
|
{ // Rectangular matrix m < n
|
||||||
const auto prng_key = random::key(42);
|
const auto prng_key = random::key(42);
|
||||||
@@ -437,9 +439,11 @@ TEST_CASE("test matrix pseudo-inverse") {
|
|||||||
CHECK_FALSE(allclose(zeros, A_pinv, /* rtol = */ 0, /* atol = */ 1e-6)
|
CHECK_FALSE(allclose(zeros, A_pinv, /* rtol = */ 0, /* atol = */ 1e-6)
|
||||||
.item<bool>());
|
.item<bool>());
|
||||||
const auto A_again = matmul(matmul(A, A_pinv), A);
|
const auto A_again = matmul(matmul(A, A_pinv), A);
|
||||||
CHECK(allclose(A_again, A).item<bool>());
|
CHECK(allclose(A_again, A, /* rtol = */ 1e-5, /* atol = */ 1e-5)
|
||||||
|
.item<bool>());
|
||||||
const auto A_pinv_again = matmul(matmul(A_pinv, A), A_pinv);
|
const auto A_pinv_again = matmul(matmul(A_pinv, A), A_pinv);
|
||||||
CHECK(allclose(A_pinv_again, A_pinv).item<bool>());
|
CHECK(allclose(A_pinv_again, A_pinv, /* rtol = */ 1e-5, /* atol = */ 1e-5)
|
||||||
|
.item<bool>());
|
||||||
}
|
}
|
||||||
{ // Rectangular matrix m > n
|
{ // Rectangular matrix m > n
|
||||||
const auto prng_key = random::key(10);
|
const auto prng_key = random::key(10);
|
||||||
@@ -449,9 +453,11 @@ TEST_CASE("test matrix pseudo-inverse") {
|
|||||||
CHECK_FALSE(allclose(zeros2, A_pinv, /* rtol = */ 0, /* atol = */ 1e-6)
|
CHECK_FALSE(allclose(zeros2, A_pinv, /* rtol = */ 0, /* atol = */ 1e-6)
|
||||||
.item<bool>());
|
.item<bool>());
|
||||||
const auto A_again = matmul(matmul(A, A_pinv), A);
|
const auto A_again = matmul(matmul(A, A_pinv), A);
|
||||||
CHECK(allclose(A_again, A).item<bool>());
|
CHECK(allclose(A_again, A, /* rtol = */ 1e-5, /* atol = */ 1e-5)
|
||||||
|
.item<bool>());
|
||||||
const auto A_pinv_again = matmul(matmul(A_pinv, A), A_pinv);
|
const auto A_pinv_again = matmul(matmul(A_pinv, A), A_pinv);
|
||||||
CHECK(allclose(A_pinv_again, A_pinv).item<bool>());
|
CHECK(allclose(A_pinv_again, A_pinv, /* rtol = */ 1e-5, /* atol = */ 1e-5)
|
||||||
|
.item<bool>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user