Skip to content

Commit

Permalink
fix build pip (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
makslevental authored Jun 5, 2023
1 parent 5107d4a commit 95ac141
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 11 deletions.
33 changes: 27 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ on:
workflow_dispatch:
branches:
- main
pull_request:
branches:
- main

jobs:

Expand All @@ -29,14 +32,32 @@ jobs:
with:
python-version: "3.10"

- name: Install cibuildwheel
run: pip install cibuildwheel
- name: Install Ninja
uses: llvm/actions/install-ninja@6a57890d0e3f9f35dfc72e7e48bc5e1e527cdd6c # Jan 17

- name: Ccache for C++ compilation
uses: hendrikmuhs/ccache-action@621a41397ed83711c72862638d9ff6e63fca3041 # v1.2.3
with:
key: ${{ matrix.os }}-${{ matrix.arch }}-torch-mlir
# LLVM needs serious cache size
max-size: 6G

- name: Install terminfo
if: contains(matrix.os, 'ubuntu')
run: |
sudo apt-get update
sudo apt -y install terminfo
- name: Build wheels
run: |
cibuildwheel --output-dir wheelhouse
if [ x"${{ matrix.os }}" == x"ubuntu-latest" ]; then
CMAKE_GENERATOR=Ninja pip wheel . -w wheelhouse -v
else
pip install -r requirements.txt
cibuildwheel --platform macos
fi
mkdir -p ${{ github.sha }}
mv wheelhouse/PI*.whl ${{ github.sha }}/
mv wheelhouse/pi*.whl ${{ github.sha }}/
- name: Upload an artifact
uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -72,8 +93,8 @@ jobs:
tag_name="$PI_VERSION"
release_title="PI $PI_VERSION"
echo "PI $PI_VERSION created at $(date)" > body.md
echo "::set-output name=tag_name::${tag_name}"
echo "::set-output name=release_title::${release_title}"
echo "tag_name=${tag_name}" | tee -a $GITHUB_OUTPUT
echo "release_title=${release_title}" | tee -a $GITHUB_OUTPUT
- name: Upload tarballs
uses: ncipollo/release-action@v1
Expand Down
5 changes: 5 additions & 0 deletions TorchMLIRConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64|arm64)")
set(ARCH AArch64)
endif()

if (CMAKE_OSX_ARCHITECTURES MATCHES "arm64")
set(ARCH AArch64)
endif()

message(STATUS "os: ${OS} arch: ${ARCH}")

set(TORCH_MLIR_COMMIT
Expand Down Expand Up @@ -112,6 +116,7 @@ else()
FATAL_ERROR "Python requirements install failed because ${RESVAR} ${LOG1}"
)
endif()

execute_process(
COMMAND
${CMAKE_COMMAND} -G ${CMAKE_GENERATOR}
Expand Down
8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ before-build = "pip install -r requirements.txt -v"
environment = { PIP_NO_BUILD_ISOLATION = "false" }
build-verbosity = "3"

[tool.cibuildwheel.linux]
archs = ["x86_64"]
build = "cp311-manylinux_x86_64"
#[tool.cibuildwheel.linux]
#archs = ["x86_64"]
#build = "cp311-manylinux_x86_64"

[tool.cibuildwheel.macos]
build = "cp311-*"
archs = ["arm64"]
environment = { PIP_NO_BUILD_ISOLATION = "false", LIB_ARCH = "arm64" }
environment = { PIP_NO_BUILD_ISOLATION = "false", ARCHFLAGS = "-arch arm64" , MACOSX_DEPLOYMENT_TARGET= 12.6 }
repair-wheel-command = "delocate-wheel --ignore-missing-dependencies --require-archs {delocate_archs} -w {dest_dir} -v {wheel}"
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def build_extension(self, ext: CMakeExtension) -> None:
f"{PACKAGE_NAME}.*",
],
)
VERSION = "0.0.3"
VERSION = "0.0.4"

if len(sys.argv) > 1 and sys.argv[1] == "--version":
print(VERSION)
Expand Down

0 comments on commit 95ac141

Please sign in to comment.