From 11d2c8f7a18cf97e2aba0985b16e0e91fe833576 Mon Sep 17 00:00:00 2001 From: Angelos Katharopoulos Date: Fri, 9 Feb 2024 18:17:04 -0800 Subject: [PATCH] Linux build for CI of other packages (#660) --- .circleci/config.yml | 60 ++++++++++++++++++++++++++++++++++++++++++++ CMakeLists.txt | 6 ++--- 2 files changed, 63 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 26aa21ce8..c0cbb6e9a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -7,6 +7,9 @@ parameters: weekly_build: type: boolean default: false + test_release: + type: boolean + default: false jobs: linux_build_and_test: @@ -170,12 +173,61 @@ jobs: - store_artifacts: path: dist/ + build_linux_test_release: + parameters: + python_version: + type: string + default: "3.9" + extra_env: + type: string + default: "DEV_RELEASE=1" + docker: + - image: ubuntu:20.04 + steps: + - checkout + - run: + name: Build wheel + command: | + PYTHON=python<< parameters.python_version >> + apt-get update + apt-get upgrade -y + DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install tzdata + apt-get install -y apt-utils + apt-get install -y software-properties-common + add-apt-repository -y ppa:deadsnakes/ppa + apt-get install -y $PYTHON $PYTHON-dev $PYTHON-full + apt-get install -y libblas-dev liblapack-dev liblapacke-dev + apt-get install -y build-essential git + $PYTHON -m venv env + source env/bin/activate + pip install --upgrade pip + pip install --upgrade cmake + pip install --upgrade pybind11[global] + pip install --upgrade setuptools + pip install pybind11-stubgen + pip install numpy + pip install auditwheel + pip install patchelf + pip install build + << parameters.extra_env >> \ + CMAKE_BUILD_PARALLEL_LEVEL="" \ + pip install . -v + python setup.py generate_stubs + << parameters.extra_env >> \ + CMAKE_BUILD_PARALLEL_LEVEL="" \ + python -m build --wheel + auditwheel show dist/* + auditwheel repair dist/* --plat manylinux_2_31_x86_64 + - store_artifacts: + path: wheelhouse/ + workflows: build_and_test: when: and: - not: << pipeline.parameters.nightly_build >> - not: << pipeline.parameters.weekly_build >> + - not: << pipeline.parameters.test_release >> jobs: - mac_build_and_test - linux_build_and_test @@ -207,3 +259,11 @@ workflows: python_version: ["3.8", "3.9", "3.10", "3.11", "3.12"] xcode_version: ["14.3.1", "15.2.0"] build_env: ["DEV_RELEASE=1"] + linux_test_release: + when: << pipeline.parameters.test_release >> + jobs: + - build_linux_test_release: + matrix: + parameters: + python_version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + extra_env: ["PYPI_RELEASE=1"] diff --git a/CMakeLists.txt b/CMakeLists.txt index b008e10e6..e889353ce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -123,8 +123,8 @@ else() /usr/include /usr/local/include $ENV{BLAS_HOME}/include) - message(STATUS "Blas lib" ${BLAS_LIBRARIES}) - message(STATUS "Blas include" ${BLAS_INCLUDE_DIRS}) + message(STATUS "Blas lib " ${BLAS_LIBRARIES}) + message(STATUS "Blas include " ${BLAS_INCLUDE_DIRS}) target_include_directories(mlx PRIVATE ${BLAS_INCLUDE_DIRS}) target_link_libraries(mlx ${BLAS_LIBRARIES}) find_package(LAPACK REQUIRED) @@ -134,7 +134,7 @@ else() find_path(LAPACK_INCLUDE_DIRS lapacke.h /usr/include /usr/local/include) - message(STATUS "Lapack lib" ${LAPACK_LIBRARIES}) + message(STATUS "Lapack lib " ${LAPACK_LIBRARIES}) message(STATUS "Lapack include " ${LAPACK_INCLUDE_DIRS}) target_include_directories(mlx PRIVATE ${LAPACK_INCLUDE_DIRS}) target_link_libraries(mlx ${LAPACK_LIBRARIES})