-
Notifications
You must be signed in to change notification settings - Fork 23
750 lines (681 loc) · 28.8 KB
/
build.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
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
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
name: build
on:
push:
branches: [ master ]
tags:
- v*
- p*
pull_request:
branches: [ master ]
workflow_dispatch:
permissions:
contents: write
pages: write
id-token: write
jobs:
test:
name: test ${{ matrix.python }} ${{ matrix.os }} ${{ matrix.parallel }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-20.04, macos-13, macos-14, windows-2022 ]
python: [ '3.13-dev' ]
plat: [ x86_64 ]
parallel: [ mpi, serial, serial-pytest, any-symm-pytest, main-test ]
exclude:
- os: macos-13
parallel: mpi
- os: macos-14
parallel: mpi
- os: windows-2022
parallel: mpi
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: install requirements (linux / macos)
if: matrix.os == 'macos-13' || matrix.os == 'ubuntu-20.04'
env:
MKLROOT: ~/.local
run: |
python -m pip install pip build twine setuptools --upgrade
python -m pip install mkl==2021.4 mkl-include intel-openmp numpy 'cmake>=3.19' pybind11==2.12.0
- name: install requirements (linux / macos)
if: matrix.os == 'macos-14'
run: |
python -m pip install pip build twine setuptools --upgrade
python -m pip install numpy 'cmake>=3.19' pybind11==2.12.0
- name: install requirements (linux / mpi)
if: matrix.parallel == 'mpi' && matrix.os == 'ubuntu-20.04'
run: |
sudo apt-get install libopenmpi-dev
python -m pip install mpi4py
- name: install requirements (windows)
if: matrix.os == 'windows-2022'
run: |
python -m pip install pip build twine setuptools --upgrade
python -m pip install intel-openmp==2024.1.0 numpy 'cmake>=3.19' pybind11==2.12.0
- name: Download OpenBLAS (windows)
if: matrix.os == 'windows-2022'
env:
BLAS_ROOT: D:\a\openblas
run: |
$file = "https://github.com/OpenMathLib/OpenBLAS/releases/download/v0.3.27/OpenBLAS-0.3.27-x64.zip"
Invoke-WebRequest -Uri $file -OutFile "OpenBLAS-0.3.27-x64.zip"
Expand-Archive -Path "OpenBLAS-0.3.27-x64.zip" -DestinationPath $env:BLAS_ROOT
- name: build gtest (windows)
if: matrix.os == 'windows-2022' && matrix.parallel == 'serial'
env:
GTEST_ROOT: D:\a\gtest
run: |
Get-WmiObject -Class Win32_Processor
git clone -b release-1.8.0 https://github.com/google/googletest.git
cd googletest
cmake -G "Visual Studio 17 2022" -S . -B . -DCMAKE_CXX_FLAGS="-D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING" -Dgtest_force_shared_crt=ON
cmake --build . -j 2 --config Release
cmake --install . --prefix $env:GTEST_ROOT
- name: build gtest (linux)
if: matrix.os == 'ubuntu-20.04'
env:
CC: gcc-9
CXX: g++-9
run: |
lscpu
sudo apt-get install libgtest-dev
cd /usr/src/gtest
sudo cmake CMakeLists.txt
sudo make
sudo cp lib/*.a /usr/lib
- name: fix mkl for amd cpu
if: matrix.os == 'ubuntu-20.04'
env:
CC: gcc-9
CXX: g++-9
run: |
lscpu
export CPUTYPE=$(lscpu | grep 'Vendor ID' | awk '{print $3}')
echo $CPUTYPE
if [ "$CPUTYPE" = "AuthenticAMD" ]; then
echo "int mkl_serv_intel_cpu_true() { return 1; }" > fixcpu.c
$CC -shared -fPIC -o libfixcpu.so fixcpu.c
fi
getconf LONG_BIT
- name: build gtest (macos)
if: matrix.os == 'macos-13'
env:
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
run: |
git clone -b release-1.8.0 https://github.com/google/googletest
cd googletest
cmake CMakeLists.txt
make
make install
brew update
brew install libomp
cp /usr/local/opt/libomp/include/*.h /usr/local/include/
- name: build gtest (macos)
if: matrix.os == 'macos-14'
env:
GTESTROOT: ~/gtest
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
run: |
git clone -b release-1.8.0 https://github.com/google/googletest
cd googletest
cmake CMakeLists.txt -DCMAKE_INSTALL_PREFIX=${GTESTROOT}
make
make install
brew update
brew install libomp
- name: build test (serial-pytest, linux | macos)
if: (matrix.parallel == 'serial-pytest' || matrix.parallel == 'main-test') && (matrix.os == 'ubuntu-20.04' || matrix.os == 'macos-13')
env:
MKLROOT: ~/.local
MACOSX_DEPLOYMENT_TARGET: '11.0'
CC: gcc-9
CXX: g++-9
run: |
mkdir build
cd build
cmake --version
cmake .. -DUSE_MKL=ON -DBUILD_LIB=ON -DLARGE_BOND=ON -DUSE_COMPLEX=ON -DUSE_SG=ON
make -j 2
- name: build test (serial-pytest, macos-arm64)
if: (matrix.parallel == 'serial-pytest' || matrix.parallel == 'main-test') && matrix.os == 'macos-14'
env:
MACOSX_DEPLOYMENT_TARGET: '11.0'
CC: gcc-9
CXX: g++-9
run: |
mkdir build
cd build
cmake --version
export OMPROOT=$(brew --prefix libomp)
cmake .. -DUSE_MKL=OFF -DARCH_ARM64=ON -DCMAKE_CXX_FLAGS=-I${OMPROOT}/include -DOMP_LIB=OMP \
-DBUILD_LIB=ON -DLARGE_BOND=ON -DUSE_COMPLEX=ON -DUSE_SG=ON -DFORCE_LIB_ABS_PATH=OFF \
-DAPPLE_ACC_SINGLE_PREC=OFF
make -j 2
- name: build test (serial-pytest, windows)
if: (matrix.parallel == 'serial-pytest' || matrix.parallel == 'main-test') && matrix.os == 'windows-2022'
env:
BLAS_ROOT: D:\a\openblas
run: |
${env:OMPROOT} = "${env:Python_ROOT_DIR}\Library"
mkdir build
cd build
cmake --version
cmake -G "Visual Studio 17 2022" -S .. -B . -DUSE_MKL=OFF -DBUILD_LIB=ON -DLARGE_BOND=ON -DUSE_COMPLEX=ON -DUSE_SG=ON
cmake --build . -j 2 --config Release -- '/v:d'
- name: build test (any-symm-pytest, linux | macos)
if: matrix.parallel == 'any-symm-pytest' && (matrix.os == 'ubuntu-20.04' || matrix.os == 'macos-13')
env:
MKLROOT: ~/.local
MACOSX_DEPLOYMENT_TARGET: '11.0'
CC: gcc-9
CXX: g++-9
run: |
mkdir build
cd build
cmake --version
cmake .. -DUSE_MKL=ON -DBUILD_LIB=ON -DLARGE_BOND=ON -DUSE_COMPLEX=ON -DUSE_SU2SZ=OFF -DUSE_SANY=ON
make -j 2
- name: build test (any-symm-pytest, macos-arm64)
if: matrix.parallel == 'any-symm-pytest' && matrix.os == 'macos-14'
env:
MACOSX_DEPLOYMENT_TARGET: '11.0'
CC: gcc-9
CXX: g++-9
run: |
mkdir build
cd build
cmake --version
export OMPROOT=$(brew --prefix libomp)
cmake .. -DUSE_MKL=OFF -DARCH_ARM64=ON -DCMAKE_CXX_FLAGS=-I${OMPROOT}/include -DBUILD_LIB=ON -DOMP_LIB=OMP \
-DLARGE_BOND=ON -DUSE_COMPLEX=ON -DUSE_SU2SZ=OFF -DUSE_SANY=ON -DFORCE_LIB_ABS_PATH=OFF \
-DAPPLE_ACC_SINGLE_PREC=OFF
make -j 2
- name: build test (any-symm-pytest, windows)
if: matrix.parallel == 'any-symm-pytest' && matrix.os == 'windows-2022'
env:
BLAS_ROOT: D:\a\openblas
run: |
${env:OMPROOT} = "${env:Python_ROOT_DIR}\Library"
mkdir build
cd build
cmake --version
cmake -G "Visual Studio 17 2022" -S .. -B . -DUSE_MKL=OFF -DBUILD_LIB=ON -DLARGE_BOND=ON -DUSE_COMPLEX=ON -DUSE_SU2SZ=OFF -DUSE_SANY=ON
cmake --build . -j 2 --config Release -- '/v:d'
- name: build test (serial, windows)
if: matrix.parallel == 'serial' && matrix.os == 'windows-2022'
env:
GTEST_ROOT: D:\a\gtest
BLAS_ROOT: D:\a\openblas
run: |
${env:OMPROOT} = "${env:Python_ROOT_DIR}\Library"
mkdir build_test
cd build_test
cmake -G "Visual Studio 17 2022" -S .. -B . -DUSE_MKL=OFF -DBUILD_TEST=ON -DLARGE_BOND=ON -DUSE_COMPLEX=ON -DUSE_SG=ON
cmake --build . -j 2 --config Release -- '/v:d'
- name: build test (serial, linux)
if: matrix.parallel == 'serial' && matrix.os == 'ubuntu-20.04'
env:
MKLROOT: ~/.local
CC: gcc-9
CXX: g++-9
run: |
mkdir build_test
cd build_test
cmake --version
cmake .. -DUSE_MKL=ON -DBUILD_TEST=ON -DLARGE_BOND=ON -DUSE_COMPLEX=ON -DUSE_SINGLE_PREC=ON -DUSE_SG=ON
make -j 2
- name: build test (serial, macos)
if: matrix.parallel == 'serial' && matrix.os == 'macos-13'
env:
MKLROOT: ~/.local
MACOSX_DEPLOYMENT_TARGET: '11.0'
run: |
mkdir build_test
cd build_test
cmake --version
cmake .. -DUSE_MKL=ON -DBUILD_TEST=ON -DLARGE_BOND=ON -DUSE_COMPLEX=ON -DUSE_SINGLE_PREC=ON -DUSE_SG=ON
make -j 2
- name: build test (serial, macos-arm64)
if: matrix.parallel == 'serial' && matrix.os == 'macos-14'
env:
GTESTROOT: ~/gtest
MACOSX_DEPLOYMENT_TARGET: '11.0'
run: |
mkdir build_test
cd build_test
cmake --version
export OMPROOT=$(brew --prefix libomp)
cmake .. -DUSE_MKL=OFF -DARCH_ARM64=ON -DCMAKE_CXX_FLAGS=-I${OMPROOT}/include -DBUILD_TEST=ON -DOMP_LIB=OMP \
-DLARGE_BOND=ON -DUSE_COMPLEX=ON -DUSE_SINGLE_PREC=OFF -DUSE_SG=ON -DGTEST_ROOT=${GTESTROOT} \
-DFORCE_LIB_ABS_PATH=OFF -DSIMPLE_TEST=ON
make -j 2
- name: run test (serial, windows)
if: matrix.parallel == 'serial' && matrix.os == 'windows-2022'
env:
GTEST_ROOT: D:\a\gtest
BLAS_ROOT: D:\a\openblas
run: |
cd build_test/Release
Copy-Item -Path "..\data" -Destination ".\" -Recurse
$env:PATH = "${env:BLAS_ROOT}\bin;" + $env:PATH
$env:PATH = "${env:Python_ROOT_DIR}\Library\bin;" + $env:PATH
$vcpath = Get-ChildItem 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC'
$dumpbin = "$($vcpath[0].FullName)\bin\Hostx64\x64\dumpbin.exe"
& $dumpbin /DEPENDENTS .\block2_tests.exe
.\block2_tests.exe
- name: run test (serial, linux)
if: matrix.parallel == 'serial' && matrix.os == 'ubuntu-20.04'
run: |
export CPUTYPE=$(lscpu | grep 'Vendor ID' | awk '{print $3}')
if [ "$CPUTYPE" = "AuthenticAMD" ]; then
export LD_PRELOAD=$PWD/libfixcpu.so
fi
cd build_test
./block2_tests
- name: run test (serial, macos)
if: matrix.parallel == 'serial' && (matrix.os == 'macos-13' || matrix.os == 'macos-14')
run: |
cd build_test
./block2_tests
- name: run test (serial-pytest, windows)
if: matrix.parallel == 'serial-pytest' && matrix.os == 'windows-2022'
env:
BLAS_ROOT: D:\a\openblas
run: |
$vcpath = Get-ChildItem 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC'
$dumpbin = "$($vcpath[0].FullName)\bin\Hostx64\x64\dumpbin.exe"
& $dumpbin /DEPENDENTS .\build\Release\block2.cp313-win_amd64.pyd
$xpwd = Get-Location
$env:PYTHONPATH = "${xpwd};${xpwd}\build\Release;" + $env:PYTHONPATH
$env:PATH = "${env:BLAS_ROOT}\bin;" + $env:PATH
$env:PATH = "${env:Python_ROOT_DIR}\Library\bin;" + $env:PATH
$env:PATH = "${env:Python_ROOT_DIR};" + $env:PATH
$env:PATH = "$($vcpath[0].FullName)\bin\Hostx64\x64;" + $env:PATH
python -m pip install pytest
python -m pytest -s pyblock2/unit_test/dmrg.py pyblock2/unit_test/dmrg_mpo.py pyblock2/unit_test/dmrg_npdm.py --fd_data=${xpwd}/data
- name: run test (serial-pytest, linux)
if: matrix.parallel == 'serial-pytest' && matrix.os == 'ubuntu-20.04'
run: |
python -m pip install pytest 'pyscf==2.6.2' 'scipy==1.14.1'
export PYTHONPATH=$(pwd)/build:$(pwd):${PYTHONPATH}
export CPUTYPE=$(lscpu | grep 'Vendor ID' | awk '{print $3}')
if [ "$CPUTYPE" = "AuthenticAMD" ]; then
export LD_PRELOAD=$PWD/libfixcpu.so
fi
echo $LD_PRELOAD
py.test -s pyblock2/unit_test/*.py
- name: run test (serial-pytest, macos)
if: matrix.parallel == 'serial-pytest' && (matrix.os == 'macos-13' || matrix.os == 'macos-14')
run: |
python -m pip install pytest 'pyscf==2.6.2' 'scipy==1.14.1'
export PYTHONPATH=$(pwd)/build:$(pwd):${PYTHONPATH}
py.test -s pyblock2/unit_test/*.py
- name: run test (main-test, windows)
if: matrix.parallel == 'main-test' && matrix.os == 'windows-2022'
env:
BLAS_ROOT: D:\a\openblas
run: |
$vcpath = Get-ChildItem 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC'
$dumpbin = "$($vcpath[0].FullName)\bin\Hostx64\x64\dumpbin.exe"
& $dumpbin /DEPENDENTS .\build\Release\block2.cp313-win_amd64.pyd
$xpwd = Get-Location
$env:PYTHONPATH = "${xpwd};${xpwd}\build\Release;" + $env:PYTHONPATH
$env:PATH = "${env:BLAS_ROOT}\bin;" + $env:PATH
$env:PATH = "${env:Python_ROOT_DIR}\Library\bin;" + $env:PATH
$env:PATH = "${env:Python_ROOT_DIR};" + $env:PATH
$env:PATH = "$($vcpath[0].FullName)\bin\Hostx64\x64;" + $env:PATH
$env:block2main = "${xpwd}\pyblock2\driver\block2main"
python -m pip install 'scipy==1.14.1'
cd pyblock2\main_test
.\run-test.ps1
- name: run test (main-test, linux)
if: matrix.parallel == 'main-test' && matrix.os == 'ubuntu-20.04'
run: |
python -m pip install pytest 'pyscf==2.6.2' 'scipy==1.14.1'
export PYTHONPATH=$(pwd)/build:$(pwd):${PYTHONPATH}
export PATH=$(pwd)/pyblock2/driver:$PATH
export CPUTYPE=$(lscpu | grep 'Vendor ID' | awk '{print $3}')
if [ "$CPUTYPE" = "AuthenticAMD" ]; then
export LD_PRELOAD=$PWD/libfixcpu.so
fi
echo $LD_PRELOAD
cd pyblock2/main_test
./run-test.sh
- name: run test (main-test, macos)
if: matrix.parallel == 'main-test' && (matrix.os == 'macos-13' || matrix.os == 'macos-14')
run: |
python -m pip install pytest 'pyscf==2.6.2' 'scipy==1.14.1'
export PYTHONPATH=$(pwd)/build:$(pwd):${PYTHONPATH}
export PATH=$(pwd)/pyblock2/driver:$PATH
cd pyblock2/main_test
./run-test.sh
- name: run test (any-symm-pytest, windows)
if: matrix.parallel == 'any-symm-pytest' && matrix.os == 'windows-2022'
env:
BLAS_ROOT: D:\a\openblas
run: |
$vcpath = Get-ChildItem 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC'
$dumpbin = "$($vcpath[0].FullName)\bin\Hostx64\x64\dumpbin.exe"
& $dumpbin /DEPENDENTS .\build\Release\block2.cp313-win_amd64.pyd
$xpwd = Get-Location
$env:PYTHONPATH = "${xpwd};${xpwd}\build\Release;" + $env:PYTHONPATH
$env:PATH = "${env:BLAS_ROOT}\bin;" + $env:PATH
$env:PATH = "${env:Python_ROOT_DIR}\Library\bin;" + $env:PATH
$env:PATH = "${env:Python_ROOT_DIR};" + $env:PATH
$env:PATH = "$($vcpath[0].FullName)\bin\Hostx64\x64;" + $env:PATH
python -m pip install pytest
python -m pytest -s pyblock2/unit_test/dmrg.py pyblock2/unit_test/dmrg_mpo.py pyblock2/unit_test/dmrg_npdm.py --symm sany --fd_data=${xpwd}/data
- name: run test (any-symm-pytest, linux)
if: matrix.parallel == 'any-symm-pytest' && matrix.os == 'ubuntu-20.04'
run: |
python -m pip install pytest 'pyscf==2.6.2' 'scipy==1.14.1'
export PYTHONPATH=$(pwd)/build:$(pwd):${PYTHONPATH}
export CPUTYPE=$(lscpu | grep 'Vendor ID' | awk '{print $3}')
if [ "$CPUTYPE" = "AuthenticAMD" ]; then
export LD_PRELOAD=$PWD/libfixcpu.so
fi
echo $LD_PRELOAD
py.test -s pyblock2/unit_test/*.py --symm sany
- name: run test (any-symm-pytest, macos)
if: matrix.parallel == 'any-symm-pytest' && (matrix.os == 'macos-13' || matrix.os == 'macos-14')
run: |
python -m pip install pytest 'pyscf==2.6.2' 'scipy==1.14.1'
export PYTHONPATH=$(pwd)/build:$(pwd):${PYTHONPATH}
py.test -s pyblock2/unit_test/*.py --symm sany
- name: build test (mpi)
if: matrix.parallel == 'mpi'
env:
MKLROOT: ~/.local
run: |
sed -i "s|unit_test/test_|unit_test/mpi/test_|" CMakeLists.txt
mkdir build_test
cd build_test
cmake .. -DUSE_MKL=ON -DBUILD_TEST=ON -DLARGE_BOND=ON -DMPI=ON -DUSE_COMPLEX=ON -DUSE_SINGLE_PREC=ON -DUSE_SG=ON
make -j 1 # memory issue of mpi compiler
- name: run test (mpi)
if: matrix.parallel == 'mpi'
run: |
export CPUTYPE=$(lscpu | grep 'Vendor ID' | awk '{print $3}')
if [ "$CPUTYPE" = "AuthenticAMD" ]; then
export LD_PRELOAD=$PWD/libfixcpu.so
fi
cd build_test
mpirun -n 2 ./block2_tests
build:
name: build ${{ matrix.python }} ${{ matrix.os }} ${{ matrix.plat }} ${{ matrix.parallel }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-20.04, macos-13, windows-2022, macos-14 ]
python: [ '3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13-dev' ]
manylinux: [ 2014 ]
plat: [ x86_64, arm64 ]
parallel: [ mpi, serial ]
exclude:
- os: macos-13
parallel: mpi
- os: macos-14
parallel: mpi
- os: macos-13
plat: arm64
- os: macos-14
plat: x86_64
- os: macos-14
python: '3.7'
- os: ubuntu-20.04
plat: arm64
- os: windows-2022
parallel: mpi
- os: windows-2022
plat: arm64
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: install requirements (linux / macos)
if: matrix.os == 'macos-13' || matrix.os == 'ubuntu-20.04'
env:
MKLROOT: ~/.local
run: |
export PYT=$(which python)
python -m pip install pip build twine setuptools --upgrade
python -m pip install mkl==2021.4 mkl-include intel-openmp numpy 'cmake>=3.19' pybind11==2.12.0
- name: install requirements (linux / macos)
if: matrix.os == 'macos-14'
env:
MKLROOT: ~/.local
run: |
export PYT=$(which python)
python -m pip install pip build twine setuptools --upgrade
python -m pip install numpy 'cmake>=3.19' pybind11==2.12.0
- name: install requirements (windows)
if: matrix.os == 'windows-2022'
env:
BLAS_ROOT: D:\a\openblas
run: |
python -m pip install pip build twine setuptools --upgrade
python -m pip install intel-openmp==2024.1.0 numpy 'cmake>=3.19' pybind11==2.12.0
$file = "https://github.com/OpenMathLib/OpenBLAS/releases/download/v0.3.27/OpenBLAS-0.3.27-x64.zip"
Invoke-WebRequest -Uri $file -OutFile "OpenBLAS-0.3.27-x64.zip"
Expand-Archive -Path "OpenBLAS-0.3.27-x64.zip" -DestinationPath $env:BLAS_ROOT
- name: build wheels (windows)
if: startsWith(github.ref, 'refs/tags/') && matrix.os == 'windows-2022'
env:
TAG_STRING: ${{ github.event.ref }}
BLAS_ROOT: D:\a\openblas
run: |
$tagstr = ${env:TAG_STRING}.Substring(11)
echo $tagstr
sed -i "s/version=.*/version=`"${tagstr}`",/" setup.py
sed -i "/mkl/d" setup.py
sed -i "/scipy/d" setup.py
sed -i "/DUSE_SINGLE_PREC/d" setup.py
sed -i "/DUSE_MKL/c \ '-DUSE_MKL=OFF'," setup.py
sed -i "/DBUILD_EXE/c \ '-DBUILD_EXE=OFF'," setup.py
sed -i "/ `"block2`"/d" setup.py
${env:OMPROOT} = "${env:Python_ROOT_DIR}\Library"
cmake --version
python -m pip install wheel delvewheel==1.7.1
python -m pip wheel . -w ./dist --no-deps
$env:PATH = "${env:BLAS_ROOT}\bin;" + $env:PATH
$env:PATH = "${env:Python_ROOT_DIR}\Library\bin;" + $env:PATH
$env:PATH = "${env:Python_ROOT_DIR};" + $env:PATH
$vcpath = Get-ChildItem 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC'
$env:PATH = "$($vcpath[0].FullName)\bin\Hostx64\x64;" + $env:PATH
$rr = Get-ChildItem -Path dist/*.whl
Write-Output "$($rr[0].FullName)"
delvewheel repair "$($rr[0].FullName)" -v -w dist
- name: build wheels (macos-x86_64)
if: startsWith(github.ref, 'refs/tags/') && matrix.os == 'macos-13' && matrix.plat == 'x86_64'
env:
TAG_STRING: ${{ github.event.ref }}
MACOSX_DEPLOYMENT_TARGET: '11.0'
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
run: |
brew update
brew install libomp
cp /usr/local/opt/libomp/include/*.h /usr/local/include/
brew install gnu-sed
export PATH=/usr/local/opt/gnu-sed/bin:$PATH
echo ${TAG_STRING:11}
gsed -i "s/version=.*/version='${TAG_STRING:11}',/" setup.py
# if use mkl, will need iomp5
gsed -i "/DUSE_MKL/a \ '-DOMP_LIB=OMP'," setup.py
gsed -i "/mkl/d" setup.py
gsed -i "/intel-openmp/d" setup.py
gsed -i "/DUSE_MKL/c \ '-DUSE_MKL=OFF'," setup.py
gsed -i "/DUSE_MKL/a \ '-DFORCE_LIB_ABS_PATH=OFF'," setup.py
export OMPROOT=$(brew --prefix libomp)
echo ${OMPROOT}
cmake --version
python -m pip install wheel delocate==0.10.7
python -m pip wheel . -w ./dist --no-deps
export DYLD_LIBRARY_PATH=$(python -c "import site;print(':'.join(x+'/../..' for x in site.getsitepackages()))")
# prevent delocating libomp
export DELO_PY=$(cat $(which delocate-wheel) | head -1 | awk -F'!' '{print $2}')
export DELO_DE=$(${DELO_PY} -c "from delocate import delocating;print(delocating.__file__)")
gsed -i '/r_ed_base = base/a \ if "libomp" in required: needs_delocating.add(required); continue' ${DELO_DE}
gsed -i '/new_install_name =/a \ if "libomp" in required: new_install_name = "/usr/local/opt/libomp/lib/libomp.dylib"' ${DELO_DE}
delocate-wheel -k dist/*.whl
- name: build wheels (macos-arm64)
if: startsWith(github.ref, 'refs/tags/') && matrix.os == 'macos-14' && matrix.plat == 'arm64'
env:
TAG_STRING: ${{ github.event.ref }}
MACOSX_DEPLOYMENT_TARGET: '11.0'
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
run: |
brew update
brew install libomp
brew install gnu-sed
export PATH=/opt/homebrew/opt/gnu-sed/libexec/gnubin:$PATH
echo ${TAG_STRING:11}
export OMPROOT=$(brew --prefix libomp)
echo ${OMPROOT}
gsed -i "s/version=.*/version='${TAG_STRING:11}',/" setup.py
gsed -i "/DUSE_MKL/a \ '-DOMP_LIB=OMP'," setup.py
gsed -i "/DUSE_MKL/a \ '-DARCH_ARM64=ON'," setup.py
gsed -i "/DUSE_MKL/a \ '-DFORCE_LIB_ABS_PATH=OFF'," setup.py
gsed -i "/DUSE_MKL/a \ '-DCMAKE_CXX_FLAGS=-I${OMPROOT}/include'," setup.py
gsed -i "/mkl/d" setup.py
gsed -i "/intel-openmp/d" setup.py
gsed -i "/DUSE_MKL/c \ '-DUSE_MKL=OFF'," setup.py
cmake --version
python -m pip install wheel delocate==0.10.7
export _PYTHON_HOST_PLATFORM="macosx-14.0-arm64"
export SDKROOT=/Applications/Xcode_14.3.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
export PLAT="arm64"
python -m pip wheel . -w ./dist --no-deps
delocate-wheel --require-archs=arm64 -k dist/*.whl
- name: prepare build wheels (manylinux)
if: startsWith(github.ref, 'refs/tags/') && matrix.os == 'ubuntu-20.04'
env:
TAG_STRING: ${{ github.event.ref }}
run: |
echo ${TAG_STRING:11}
sed -i "s/version=.*/version='${TAG_STRING:11}',/" setup.py
cp ./.github/actions/build-wheel/Dockerfile.manylinux${{ matrix.manylinux }} ./.github/actions/build-wheel/Dockerfile
- name: build wheels (manylinux)
if: startsWith(github.ref, 'refs/tags/') && matrix.os == 'ubuntu-20.04'
uses: ./.github/actions/build-wheel
with:
python-version: ${{ matrix.python }}
parallel: ${{ matrix.parallel }}
- name: release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v2
with:
files: dist/*
- name: upload artifacts
if: startsWith(github.ref, 'refs/tags/')
uses: actions/upload-artifact@v4
with:
name: dist-${{ matrix.parallel }}-${{ matrix.python }}-${{ matrix.os }}-${{ matrix.plat }}
path: dist
retention-days: 2
pypi:
name: pypi
needs: [build, test]
runs-on: ubuntu-20.04
if: startsWith(github.ref, 'refs/tags/')
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.13-dev'
- name: build source dist (serial)
env:
TAG_STRING: ${{ github.event.ref }}
run: |
echo ${TAG_STRING:11}
sed -i "s/version=.*/version='${TAG_STRING:11}',/" setup.py
python -m pip install pip build twine setuptools --upgrade
python -m build --sdist
- name: release (serial)
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v2
with:
files: dist/*
- name: build source dist (mpi)
env:
TAG_STRING: ${{ github.event.ref }}
run: |
rm -r dist
echo ${TAG_STRING:11}
sed -i "/DUSE_MKL/a \ '-DMPI=ON'," setup.py
sed -i "s/name=\"block2\"/name=\"block2-mpi\"/g" setup.py
sed -i "s/version=.*/version='${TAG_STRING:11}',/" setup.py
python -m build --sdist
stat dist/block2_mpi-${TAG_STRING:11}.tar.gz
- name: release (mpi)
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v2
with:
files: dist/*
- name: build index
env:
REPO: ${{ github.repository }}
run: |
python .github/workflows/build_pypi.py ${REPO} ./idx-dist/pypi
- name: setup pages
uses: actions/configure-pages@v5
- name: upload artifacts
uses: actions/upload-pages-artifact@v3
with:
path: './idx-dist'
- name: deploy to gitHub pages
id: deployment
uses: actions/deploy-pages@v4
publish:
name: publish
needs: [build, test]
runs-on: ubuntu-20.04
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.13-dev'
- name: build source dist (serial)
env:
TAG_STRING: ${{ github.event.ref }}
run: |
echo ${TAG_STRING:11}
sed -i "s/version=.*/version='${TAG_STRING:11}',/" setup.py
python -m pip install pip build twine setuptools --upgrade
python -m build --sdist
- name: download wheels (serial)
uses: actions/download-artifact@v4
with:
pattern: dist-serial-*
path: dist
merge-multiple: true
- name: publish to pypi (serial)
uses: pypa/gh-action-pypi-publish@release/v1
- name: build source dist (mpi)
env:
TAG_STRING: ${{ github.event.ref }}
run: |
rm -r dist
echo ${TAG_STRING:11}
sed -i "/DUSE_MKL/a \ '-DMPI=ON'," setup.py
sed -i "s/name=\"block2\"/name=\"block2-mpi\"/g" setup.py
sed -i "s/version=.*/version='${TAG_STRING:11}',/" setup.py
python -m build --sdist
- name: download wheels (mpi)
uses: actions/download-artifact@v4
with:
pattern: dist-mpi-*
path: dist
merge-multiple: true
- name: publish to pypi (mpi)
uses: pypa/gh-action-pypi-publish@release/v1