-
Notifications
You must be signed in to change notification settings - Fork 6
240 lines (229 loc) · 7.41 KB
/
main.yml
File metadata and controls
240 lines (229 loc) · 7.41 KB
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
name: build
on:
push:
branches:
- master
tags:
- v*
pull_request:
branches:
- master
env:
OMP_PROC_BIND: false
jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run clang-format
run: |
git ls-files '*.hpp' '*.cpp' | xargs clang-format -i
git diff --exit-code
build-linux-gpu:
strategy:
matrix:
cxx: [g++-11]
fail-fast: false
runs-on: ubuntu-latest
container:
image: nvidia/cuda:12.4.0-devel-ubuntu22.04
steps:
- name: Install dependencies
run: |
apt-get update
apt-get install -y cmake git libhdf5-dev
env:
DEBIAN_FRONTEND: noninteractive
- uses: actions/checkout@v4
- name: Build kEDM
run: |
mkdir build
cd build
cmake \
-DCMAKE_BUILD_TYPE=Debug \
-DKEDM_ENABLE_GPU=ON \
-DKEDM_ENABLE_TESTS=OFF \
-DKokkos_ARCH_AMPERE80=ON ..
make -j $(nproc)
env:
NVCC_WRAPPER_DEFAULT_COMPILER: ${{ matrix.cxx }}
build-linux-cpu:
strategy:
matrix:
cxx: [clang++-14, g++-12]
fail-fast: false
runs-on: ubuntu-22.04
env:
CXX: ${{ matrix.cxx }}
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libhdf5-dev libopenblas-serial-dev liblapacke-dev libomp-14-dev
- name: Build kEDM
run: |
mkdir build
cd build
cmake \
-DCMAKE_BUILD_TYPE=Debug \
-DKokkos_ARCH_HSW=ON \
-DKEDM_ENABLE_CPU=ON \
..
make -j $(nproc)
- name: Run C++ unit tests
run: ctest
working-directory: build
- name: Build and install Python wheel
run: |
pip3 install -U pip
pip3 install -v '.[test]'
- name: Run Python unit tests
run: pytest python
build-macos:
strategy:
matrix:
cxx: [clang++, g++-12]
fail-fast: false
runs-on: macOS-14
env:
CXX: ${{ matrix.cxx }}
steps:
- uses: actions/checkout@v4
- name: Install HDF5
run: brew install hdf5
- name: Install libomp
run: brew install libomp
- name: Install GCC
if: startsWith(matrix.cxx, 'g++')
run: brew install gcc@12
- name: Build kEDM (gcc)
if: startsWith(matrix.cxx, 'g++')
run: |
mkdir build
cd build
cmake \
-DCMAKE_BUILD_TYPE=Debug \
-DKEDM_ENABLE_CPU=ON \
..
make -j $(sysctl -n hw.physicalcpu_max)
- name: Build kEDM (clang)
if: startsWith(matrix.cxx, 'clang++')
run: |
mkdir build
cd build
cmake \
-DCMAKE_BUILD_TYPE=Debug \
-DKEDM_ENABLE_CPU=ON \
..
make -j $(sysctl -n hw.physicalcpu_max)
- name: Run C++ unit tests
run: ctest
working-directory: build
build-wheels-cuda12x:
runs-on: ubuntu-22.04
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v4
- name: Replace project name with kedm-cuda12x
run: sed -i 's/name = "kedm"/name = "kedm-cuda12x"/' pyproject.toml
- name: Build wheels
uses: pypa/cibuildwheel@v3.3.0
env:
CIBW_BUILD: cp3*-manylinux_x86_64
CIBW_SKIP: cp38-* cp39-*
CIBW_BEFORE_ALL_LINUX: >
yum install -y yum-utils &&
yum-config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel8/x86_64/cuda-rhel8.repo &&
yum install -y cuda-compiler-12-9 libcublas-devel-12-9 cuda-cudart-devel-12-9 cuda-driver-devel-12-9 gcc-toolset-12-gcc-c++
CIBW_TEST_SKIP: "*"
CIBW_ENVIRONMENT: >
CMAKE_ARGS='-DKEDM_ENABLE_GPU=ON -DKokkos_ARCH_AMPERE80=ON'
PATH=/usr/local/cuda/bin:$PATH
CXX=/opt/rh/gcc-toolset-12/root/bin/g++
CIBW_REPAIR_WHEEL_COMMAND_LINUX: auditwheel repair -w {dest_dir} --exclude libcublas.so.12 --exclude libcublasLt.so.12 --exclude libcuda.so.1 {wheel}
- uses: actions/upload-artifact@v4
with:
name: wheels-cuda12x
path: ./wheelhouse/*.whl
build-wheels-cuda13x:
runs-on: ubuntu-22.04
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v4
- name: Replace project name with kedm-cuda13x
run: sed -i 's/name = "kedm"/name = "kedm-cuda13x"/' pyproject.toml
- name: Build wheels
uses: pypa/cibuildwheel@v3.3.0
env:
CIBW_BUILD: cp3*-manylinux_x86_64
CIBW_SKIP: cp38-* cp39-*
CIBW_BEFORE_ALL_LINUX: >
yum install -y yum-utils &&
yum-config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel8/x86_64/cuda-rhel8.repo &&
yum install -y cuda-compiler-13-0 libcublas-devel-13-0 cuda-cudart-devel-13-0 cuda-driver-devel-13-0 gcc-toolset-12-gcc-c++
CIBW_TEST_SKIP: "*"
CIBW_ENVIRONMENT: >
CMAKE_ARGS='-DKEDM_ENABLE_GPU=ON -DKokkos_ARCH_AMPERE80=ON'
PATH=/usr/local/cuda/bin:$PATH
CXX=/opt/rh/gcc-toolset-12/root/bin/g++
CIBW_REPAIR_WHEEL_COMMAND_LINUX: auditwheel repair -w {dest_dir} --exclude libcublas.so.13 --exclude libcublasLt.so.13 --exclude libcuda.so.1 {wheel}
- uses: actions/upload-artifact@v4
with:
name: wheels-cuda13x
path: ./wheelhouse/*.whl
build-wheels-linux:
runs-on: ubuntu-22.04
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v4
- name: Build wheels
uses: pypa/cibuildwheel@v3.3.0
env:
CIBW_BUILD: cp3*-manylinux_x86_64
CIBW_SKIP: cp38-* cp39-*
CIBW_BEFORE_ALL: >
yum install -y openblas-devel &&
ln -sf /usr/lib64/libopenblaso.so /usr/lib64/libopenblas.so
CIBW_ENVIRONMENT: CMAKE_ARGS='-DKokkos_ARCH_HSW=ON'
CIBW_TEST_REQUIRES: pytest
CIBW_TEST_COMMAND: pytest {project}/python
- uses: actions/upload-artifact@v4
with:
name: wheels-linux
path: ./wheelhouse/*.whl
build-wheels-macos:
runs-on: macOS-14
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v4
- name: Build wheels
uses: pypa/cibuildwheel@v3.3.0
env:
CIBW_BUILD: cp3*-macosx*
CIBW_SKIP: cp38-* cp39-*
CIBW_ARCHS: arm64
CIBW_BEFORE_ALL: ./scripts/install_libomp.sh
CIBW_TEST_REQUIRES: pytest
CIBW_TEST_COMMAND: pytest {project}/python
CIBW_ENVIRONMENT: DYLD_LIBRARY_PATH=/opt/homebrew/opt/libomp/lib
- uses: actions/upload-artifact@v4
with:
name: wheels-macos
path: ./wheelhouse/*.whl
publish-wheels:
needs: [build-wheels-linux, build-wheels-macos, build-wheels-cuda12x, build-wheels-cuda13x]
runs-on: ubuntu-latest
permissions:
id-token: write
environment:
name: pypi
url: https://pypi.org/p/kedm
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
steps:
- uses: actions/download-artifact@v4
with:
path: dist
pattern: wheels-*
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@release/v1