-
Notifications
You must be signed in to change notification settings - Fork 1
129 lines (110 loc) · 4.55 KB
/
windows-arm64-wheels.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: Build Windows ARM64 wheels
on: [push]
env:
MLPACK_COMMIT: 4.3.0
CIBW_TEST_COMMAND: python -c 'import mlpack; import numpy as np; x = np.random.rand(100, 10); o = mlpack.pca(input_=x, new_dimensionality=5, verbose=True)'
jobs:
windows_arm_build_wheels:
# Note: this job is currently disabled, because we cannot install any ARM64
# version of LAPACK. Ideally, we can enable this when we have vcpkg support
# for ARM64 gfortran.
if: ${{ false }}
name: Build wheel for ${{ matrix.py_ver }}-win_arm64
runs-on: windows-latest
strategy:
matrix:
py_ver: [cp39, cp310, cp311]
env:
CIBW_BUILD: ${{ matrix.py_ver }}-win_arm64
steps:
- uses: actions/checkout@v3
- name: "Set up Visual Studio"
uses: microsoft/[email protected]
with:
vs-version: '16'
- uses: lukka/get-cmake@latest
- name: Setup vcpkg
uses: lukka/run-vcpkg@v10
with:
# I guess this will go out of date...
vcpkgGitCommitId: 'bdf073a835ebea07e1d039cd9cff4f650014e4ce'
- name: Install OpenBLAS via vcpkg
run: vcpkg install openblas:arm64-windows lapack-reference:arm64-windows
- name: Download Armadillo
shell: bash
run: |
curl -O -L https://files.mlpack.org/armadillo-11.4.1.tar.gz
tar -xvzf armadillo-11.4.1.tar.gz
- name: Configure and build Armadillo
shell: powershell
run: |
$rootdir = $pwd
cd armadillo-11.4.1/
cmake -G "Visual Studio 17 2022" `
-A "ARM64" `
-DBLAS_LIBRARY:FILEPATH="C:\vcpkg\packages\openblas_arm64-windows\lib\openblas.lib" `
-DLAPACK_LIBRARY:FILEPATH="C:\vcpkg\packages\openblas_arm64-windows\lib\openblas.lib" `
-DBUILD_SHARED_LIBS=OFF `
-DCMAKE_BUILD_TYPE=Release .
cmake --build . --target armadillo --config Release
- name: Download ensmallen
shell: bash
run: |
curl -O -L https://www.ensmallen.org/files/ensmallen-2.19.0.tar.gz
tar -xvzf ensmallen-2.19.0.tar.gz
# No build needed---it's header-only.
- name: Download cereal
shell: bash
run: |
curl -O -L https://github.com/USCILab/cereal/archive/refs/tags/v1.3.2.tar.gz
tar -xvzf v1.3.2.tar.gz
- name: Download STB
shell: bash
run: |
curl -O -L https://www.mlpack.org/files/stb.tar.gz
tar -xvzf stb.tar.gz
- name: Install Python dependencies
run: python -m pip install cython numpy pandas
- name: Clone mlpack
shell: bash
run: |
git clone https://github.com/mlpack/mlpack
cd mlpack
git checkout $MLPACK_VERSION
# Apply patches to install Python headers.
cp ../ConfigureFileOnly.cmake CMake/
cp ../mlpack.pc.in src/mlpack/bindings/python/
patch -p1 < ../python-install-headers.patch
- name: Generate setup.py
shell: powershell
run: |
$rootdir = $pwd
cd mlpack
mkdir build
cd build
cmake -G "Visual Studio 17 2022" `
-DBLAS_LIBRARIES:FILEPATH="C:\vcpkg\packages\openblas_arm64-windows\lib\openblas.lib" `
-DLAPACK_LIBRARIES:FILEPATH="C:\vcpkg\packages\openblas_arm64-windows\lib\openblas.lib" `
-DARMADILLO_INCLUDE_DIR="$rootdir\armadillo-11.4.1\tmp\include" `
-DARMADILLO_LIBRARY="$rootdir\armadillo-11.4.1\Release\armadillo.lib" `
-DCEREAL_INCLUDE_DIR="$rootdir\cereal-1.3.2\include" `
-DENSMALLEN_INCLUDE_DIR="$rootdir\ensmallen-2.19.0\include\" `
-DBUILD_JULIA_BINDINGS=OFF `
-DBUILD_PYTHON_BINDINGS=ON `
-DCMAKE_BUILD_TYPE=Release ..
cmake --build . --target python_configured --config Release
- name: Build wheel
uses: pypa/[email protected]
with:
package-dir: mlpack/build/src/mlpack/bindings/python/
env:
CIBW_ARCHS_WINDOWS: "ARM64"
CIBW_BEFORE_BUILD: "build_mlpack.bat"
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "delvewheel repair --add-path C:/vcpkg/packages/openblas_arm64-windows/bin/ -w {dest_dir} {wheel}"
VS_GENERATOR: "Visual Studio 17 2022"
WIN_ARCH: "ARM64"
OPENBLAS_LIB: "C:/vcpkg/packages/openblas_arm64-windows/lib/openblas.lib"
OPENBLAS_DLL: "C:/vcpkg/packages/openblas_arm64-windows/bin/openblas.dll"
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl