Skip to content

Commit 5ce0b4b

Browse files
tohtskytohtsky
and
tohtsky
authored
Improve wheel build (#88)
* Try it * Fix knn's argsort * Fix argsort in util.hpp * Let's see what happens for cp > 38 * Use manylinux2010 * Skil i686 build for cp36 * aarch wheels requires too much time. * It seems to work * Fix Readme Co-authored-by: tohtsky <you@example.com>
1 parent 33a9877 commit 5ce0b4b

File tree

4 files changed

+96
-11
lines changed

4 files changed

+96
-11
lines changed

.github/workflows/wheels.yml

Lines changed: 93 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ on:
66
release:
77
types:
88
- created
9+
env:
10+
cibuildwheel_version: "2.2.2"
911
jobs:
1012
build_sdist:
1113
name: Build source distribution
@@ -26,26 +28,109 @@ jobs:
2628
build_wheels:
2729
name: Build wheels on ${{ matrix.os }}
2830
runs-on: ${{ matrix.os }}
31+
env:
32+
MACOSX_DEPLOYMENT_TARGET: "10.9"
33+
CIBW_BUILD_VERBOSITY: "1"
34+
CIBW_BUILD: "${{ matrix.cibw.build || '*' }}"
35+
CIBW_SKIP: "${{ matrix.cibw.skip || '' }}"
36+
CIBW_ENVIRONMENT: "${{ matrix.cibw.env || '' }}"
37+
CIBW_TEST_COMMAND: pytest {project}/tests
38+
CIBW_TEST_REQUIRES: pytest
39+
CIBW_MANYLINUX_X86_64_IMAGE: "${{ matrix.cibw.manylinux_image }}"
40+
CIBW_MANYLINUX_I686_IMAGE: "${{ matrix.cibw.manylinux_image }}"
41+
CIBW_MANYLINUX_AARCH64_IMAGE: "${{ matrix.cibw.manylinux_image }}"
42+
CIBW_ARCHS_LINUX: "${{ matrix.cibw.arch || 'auto' }}"
43+
CIBW_ARCHS_MACOS: "${{ matrix.cibw.arch || 'auto' }}"
2944
strategy:
3045
matrix:
31-
os: [ubuntu-20.04, macOS-10.15, windows-2019]
46+
include:
47+
- os: macos-10.15
48+
name: mac
49+
cibw:
50+
arch: x86_64
51+
env: CFLAGS='-march=core-avx-i'
52+
build: "cp37* cp38*"
53+
54+
- os: macos-10.15
55+
name: mac-arm
56+
cibw:
57+
arch: universal2
58+
build: "cp39* cp310*"
59+
env: ''
60+
61+
- os: ubuntu-20.04
62+
name: manylinux1
63+
cibw:
64+
# include python 3.6 because I want to run it on sagemaker notebook instance.
65+
build: "cp36* cp37*"
66+
skip: "*musllinux*"
67+
manylinux_image: manylinux2010
68+
env: CFLAGS='-march=core-avx-i'
69+
arch: auto64
70+
71+
- os: ubuntu-20.04
72+
name: manylinux2014
73+
cibw:
74+
build: "cp38* cp39* cp310"
75+
skip: "*musllinux*"
76+
manylinux_image: manylinux2014
77+
env: CFLAGS='-march=core-avx-i'
78+
arch: auto64
79+
80+
- os: ubuntu-20.04
81+
name: manylinux_aarch64_cp37
82+
cibw:
83+
build: "cp37*"
84+
skip: "*musllinux*"
85+
manylinux_image: manylinux2014
86+
arch: aarch64
87+
88+
- os: ubuntu-20.04
89+
name: manylinux_aarch64_cp38
90+
cibw:
91+
build: "cp38*"
92+
skip: "*musllinux*"
93+
manylinux_image: manylinux2014
94+
arch: aarch64
95+
96+
- os: ubuntu-20.04
97+
name: manylinux_aarch64_cp39
98+
cibw:
99+
build: "cp39*"
100+
skip: "*musllinux*"
101+
manylinux_image: manylinux2014
102+
arch: aarch64
103+
104+
- os: ubuntu-20.04
105+
name: manylinux_aarch64_cp310
106+
cibw:
107+
build: "cp310*"
108+
skip: "*musllinux*"
109+
manylinux_image: manylinux2014
110+
arch: aarch64
111+
112+
- os: windows-2019
113+
name: win_amd64
114+
architecture: x64
115+
cibw:
116+
build: "cp*win_amd64"
117+
env: "CL='/arch:AVX'"
32118

33119
steps:
34120
- uses: actions/checkout@v2
35121
with:
36122
fetch-depth: 0
37123
- uses: actions/setup-python@v2
38124
name: Install Python
125+
- name: register qemu
126+
if: contains(matrix.cibw.arch, 'aarch64')
127+
run: |
128+
docker run --rm --privileged hypriot/qemu-register:v4.2.0
39129
- name: Install cibuildwheel
40-
run: python -m pip install cibuildwheel==1.7.4
41-
130+
run: python -m pip install cibuildwheel=="${{env.cibuildwheel_version}}"
42131
- name: Build wheels
43132
run: python -m cibuildwheel --output-dir wheelhouse
44-
env:
45-
CIBW_BUILD: "cp36-* cp37-* cp38-* cp39-*"
46-
CIBW_ENVIRONMENT: "CFLAGS='-march=core-avx-i' CXXFLAGS='-march=core-avx-i' CL='/arch:AVX'"
47-
CIBW_TEST_COMMAND: pytest {project}/tests
48-
CIBW_TEST_REQUIRES: pytest
133+
49134

50135
- uses: actions/upload-artifact@v2
51136
with:

Readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# irspack
22

3-
[![Python](https://img.shields.io/badge/python-3.6%20%7C%203.7%20%7C%203.8%20%7C%203.9-blue)](https://www.python.org)
3+
[![Python](https://img.shields.io/badge/python-3.7%20%7C%203.8%20%7C%203.9%20%7C%203.10-blue)](https://www.python.org)
44
[![pypi](https://img.shields.io/pypi/v/irspack.svg)](https://pypi.python.org/pypi/irspack)
55
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/tohtsky/irspack)
66
[![Build](https://github.com/tohtsky/irspack/workflows/Build/badge.svg?branch=main)](https://github.com/tohtsky/irspack)

cpp_source/knn/knn.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ template <typename Real, class SimilarityType> struct KNNComputer {
116116
buffer[i] = i;
117117
}
118118
std::sort(buffer.begin(), buffer.begin() + nz_size,
119-
[&data_start](IndexType &col1, IndexType &col2) {
119+
[&data_start](IndexType col1, IndexType col2) {
120120
return data_start[col1] > data_start[col2];
121121
});
122122
std::sort(buffer.begin(), buffer.begin() + col_size);

cpp_source/util.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ inline CSCMatrix<Real> SLIM(const CSRMatrix<Real> &X, size_t n_threads,
393393
int64_t n_taken_coeffs = nnz;
394394
if (nnz > top_k) {
395395
std::sort(argsort_buffer.begin(), argsort_buffer.end(),
396-
[](RealAndIndex &val1, RealAndIndex &val2) {
396+
[](RealAndIndex val1, RealAndIndex val2) {
397397
return val1.first > val2.first;
398398
});
399399
n_taken_coeffs = top_k;

0 commit comments

Comments
 (0)