From 4e71cdcf2efcfcf71a40e0bc8a94a51176a36c18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Sok=C3=B3=C5=82?= Date: Mon, 28 Oct 2024 12:56:29 +0000 Subject: [PATCH] Add wheel test step --- .github/workflows/ci.yml | 53 +++---------------- CMakeLists.txt | 1 + ci/environment.yml | 12 ----- pyproject.toml | 46 +++++----------- .../requirements.txt | 0 requirements/test_requirements.txt | 5 ++ 6 files changed, 24 insertions(+), 93 deletions(-) delete mode 100644 ci/environment.yml rename requirements.txt => requirements/requirements.txt (100%) create mode 100644 requirements/test_requirements.txt diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cfa6678..0ffb4d6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,11 +23,11 @@ jobs: build-wheel: strategy: matrix: - os: ['ubuntu-24.04', 'macos-12', 'macos-14'] #'macos-13', 'windows-2022' + os: ['ubuntu-24.04', 'macos-12', 'macos-14'] # TODO: 'windows-2022' arch: ['x86_64', 'aarch64'] - python: ['3.10'] # , '3.11', '3.12' + python: ['3.10'] exclude: - - os: 'ubuntu-24.04' # needs qemu setup + - os: 'ubuntu-24.04' # TODO: needs qemu setup arch: 'aarch64' - os: 'macos-12' arch: 'aarch64' @@ -57,15 +57,14 @@ jobs: uses: hendrikmuhs/ccache-action@v1 with: key: ${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.python }} - max-size: "1G" + max-size: "2G" verbose: 2 variant: ccache - - name: Configure ccache + - name: Configure ccache - ubuntu & macos if: contains(matrix.os, 'ubuntu') || contains(matrix.os, 'macos') shell: bash run: | - if [ x"${{ contains(matrix.os, 'macos') }}" == x"true" ]; then echo "/usr/local/opt/ccache/libexec:/opt/homebrew/opt/ccache/libexec" >> $GITHUB_PATH else @@ -75,25 +74,12 @@ jobs: - name: Configure ccache shell: bash run: | - ccache -p ccache -z # See https://github.com/hendrikmuhs/ccache-action/issues/146 ccache --set-config=compiler_check=content ccache --set-config=sloppiness=locale,time_macros - # - name: Setup env - # uses: mamba-org/setup-micromamba@v2 - # with: - # environment-file: Finch-mlir/ci/environment.yml - # init-shell: >- - # bash - # cache-environment: true - # cache-downloads: true - # post-cleanup: 'all' - # create-args: >- - # python=${{ matrix.python }} - - name: pip install standard tools shell: bash run: pip install cibuildwheel wheel @@ -102,47 +88,24 @@ jobs: run: | echo "HOST_CCACHE_DIR="$(ccache --get-config cache_dir)"" >> $GITHUB_ENV - - name: set ENV macos + - name: set env variables - macos if: contains(matrix.os, 'macos') shell: bash run: | echo "MACOSX_DEPLOYMENT_TARGET=11.0" | tee -a $GITHUB_ENV - # - name: Build wheel - # run: | - # cp Finch-mlir/setup.py . - # python -m build --wheel - - # - name: Install cross-compilation toolchain - # shell: bash - # if: ${{ inputs.MATRIX_OS == 'ubuntu-24.04' && inputs.MATRIX_ARCH == 'aarch64' }} - # run: | - - # sudo apt-get update - # sudo apt-get install -y binutils-aarch64-linux-gnu \ - # g++-aarch64-linux-gnu gcc-aarch64-linux-gnu - - # - name: Set up QEMU - # if: ${{ matrix.os == 'ubuntu-24.04' && matrix.arch == 'aarch64' }} - # uses: docker/setup-qemu-action@v2 - # with: - # platforms: ${{ matrix.arch }} - - name: cibuildwheel run run: | mv ./Finch-mlir/setup.py . - mv ./Finch-mlir/requirements.txt . mv ./Finch-mlir/pyproject.toml . cibuildwheel --output-dir ./wheelhouse - name: Download cache from container ubuntu if: (matrix.os == 'ubuntu-24.04' && matrix.arch == 'x86_64') && (success() || failure()) - #working-directory: ${{ steps.setup_base.outputs.WORKSPACE_ROOT }} run: | ccache -s rm -rf $HOST_CCACHE_DIR mv ./wheelhouse/.ccache $HOST_CCACHE_DIR - # shouldn't be /output/.ccache? ls -la $HOST_CCACHE_DIR ccache -s @@ -152,10 +115,6 @@ jobs: path: wheelhouse/*.whl name: artifact_finch_mlir-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.python }} - # TODO: run pydata/sparse MLIR tests - # run-tests: - # ... - release-wheel: runs-on: 'ubuntu-latest' needs: build-wheel diff --git a/CMakeLists.txt b/CMakeLists.txt index 673793e..7c54d7a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,6 +5,7 @@ set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON) set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to conform to") +# https://github.com/iree-org/iree/blob/c96372348654eea8548509d38df5c8e8b179aef3/CMakeLists.txt#L275-L280 find_package(Python3 COMPONENTS Interpreter Development) find_package(Python3 COMPONENTS Interpreter Development.Module REQUIRED) diff --git a/ci/environment.yml b/ci/environment.yml deleted file mode 100644 index 1efd040..0000000 --- a/ci/environment.yml +++ /dev/null @@ -1,12 +0,0 @@ -name: Finch-mlir-dev -channels: - - conda-forge - - nodefaults -dependencies: - - python - - cmake - - ninja - - pybind11 - - pip: - - build - - cibuildwheel diff --git a/pyproject.toml b/pyproject.toml index 7db7b7c..7bbfc9b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,55 +8,33 @@ requires = [ "numpy", "PyYAML", ] -#build-backend = "setuptools.build_meta" [tool.cibuildwheel] build-verbosity = 1 -# manylinux-aarch64-image = "manylinux_2_28" -# manylinux-x86_64-image = "sameli/manylinux_2_28_x86_64_cuda_12.3" +test-requires = [ + "pytest", + "pytest-cov", + "PyYAML", + "scipy", + "sparse@git+https://github.com/pydata/sparse@updated-llvm-nightly-test" +] +test-command = "SPARSE_BACKEND=MLIR pytest --pyargs sparse.mlir_backend" [tool.cibuildwheel.linux] build = "cp310-* cp311-* cp312-*" skip = ["*-manylinux_i686", "*-musllinux*"] environment = { PATH = "/usr/lib/ccache:/usr/lib64/ccache:/usr/lib/ccache/bin:$PATH" } before-build = [ - "pip install -r requirements.txt", + "pip install -r {project}/Finch-mlir/requirements/requirements.txt", "{project}/Finch-mlir/scripts/docker_prepare_ccache.sh" ] -environment-pass = [ - # "CIBW_ARCHS", - "HOST_CCACHE_DIR", -] -# environment-pass = [ -# "APPLY_PATCHES", -# "BUILD_CUDA", -# "BUILD_AMDGPU", -# "BUILD_OPENMP", -# "BUILD_VULKAN", -# "CIBW_ARCHS", -# "CMAKE_ARGS", -# "CMAKE_GENERATOR", -# "DATETIME", -# "DEBUG_CI_FAST_BUILD", -# "HOST_CCACHE_DIR", -# "LLVM_PROJECT_COMMIT", -# "MATRIX_OS", -# "MLIR_LIT_PYTHONPATH", -# "PARALLEL_LEVEL", -# "PIP_FIND_LINKS", -# "PIP_NO_BUILD_ISOLATION", -# "RUN_TESTS", -# "USE_CMAKE_NAMESPACES", -# ] -# repair-wheel-command = [ -# "auditwheel repair -w {dest_dir} {wheel} --exclude libcuda.so.1 --exclude libvulkan.so.1 --exclude libomp.so --exclude libompd.so" -# ] +environment-pass = ["HOST_CCACHE_DIR"] [tool.cibuildwheel.macos] build = "cp310-* cp311-* cp312-*" environment = { PATH = "/usr/local/opt/ccache/libexec:$PATH" } before-build = [ - "pip install -r requirements.txt", + "pip install -r {project}/Finch-mlir/requirements/requirements.txt", ] repair-wheel-command = [ "delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel} --ignore-missing-dependencies" @@ -66,5 +44,5 @@ repair-wheel-command = [ build = "cp310-* cp311-* cp312-*" before-build = [ "pip install delvewheel", - "pip install -r requirements.txt", + "pip install -r {project}/Finch-mlir/requirements/requirements.txt", ] diff --git a/requirements.txt b/requirements/requirements.txt similarity index 100% rename from requirements.txt rename to requirements/requirements.txt diff --git a/requirements/test_requirements.txt b/requirements/test_requirements.txt new file mode 100644 index 0000000..fd43eba --- /dev/null +++ b/requirements/test_requirements.txt @@ -0,0 +1,5 @@ +pytest +pytest-cov +PyYAML +scipy +sparse @ git+https://github.com/pydata/sparse@updated-llvm-nightly-test