forked from evangelistalab/forte
-
Notifications
You must be signed in to change notification settings - Fork 0
231 lines (209 loc) · 7.66 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
name: build
on:
push:
pull_request:
schedule:
- cron: '0 15 * * *'
jobs:
build-linux:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -el {0}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: 'true'
- name: Setup Conda
uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: forte
environment-file: environment.yml
channels: conda-forge
show-channel-urls: true
python-version: '3.11'
auto-activate-base: false
add-pip-as-python-dependency: true
- name: Get ambit cache key
id: get-ambit-key
run: |
echo "key=$(git ls-remote https://github.com/jturney/ambit.git refs/heads/master | awk '{print $1}')" >> $GITHUB_OUTPUT
shell: bash
- name: Restore ambit
uses: actions/cache/restore@v4
id: cache-restore-ambit
with:
path: |
~/bin/ambit
key: ${{ runner.os }}-${{ runner.arch }}-ambit-${{ steps.get-ambit-key.outputs.key }}
- name: Install ambit
if: steps.cache-restore-ambit.outputs.cache-hit != 'true'
run: |
conda info
conda list
cd $HOME
git clone https://github.com/jturney/ambit.git
cd ambit
cmake -H. -Bobjdir -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$HOME/bin/ambit
cd objdir
make -j4
make install
- name: Cache ambit
uses: actions/cache/save@v4
with:
path: |
~/bin/ambit
key: ${{ runner.os }}-${{ runner.arch }}-ambit-${{ steps.get-ambit-key.outputs.key }}
- name: Get Psi4 cache key
id: get-psi4-key
run: |
echo "key=$(git ls-remote https://github.com/psi4/psi4.git refs/heads/master | awk '{print $1}')" >> $GITHUB_OUTPUT
shell: bash
- name: Restore Psi4
uses: actions/cache/restore@v4
id: cache-restore-psi4
with:
path: |
~/psi4
key: ${{ runner.os }}-${{ runner.arch }}-psi4-${{ steps.get-psi4-key.outputs.key }}
- name: Compile Psi4
if: steps.cache-restore-psi4.outputs.cache-hit != 'true'
run: |
cd $HOME
git clone https://github.com/psi4/psi4.git
cd psi4
git pull origin master --tags
git fetch origin "refs/tags/*:refs/tags/*"
cmake -H. -Bobjdir -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$HOME/psi4bin -DENABLE_ecpint=ON
cd objdir
make -j4
- name: Cache Psi4
uses: actions/cache/save@v4
with:
path: |
~/psi4
key: ${{ runner.os }}-${{ runner.arch }}-psi4-${{ steps.get-psi4-key.outputs.key }}
- name: Get block2 cache key
id: get-block2-key
run: |
echo "key=$(git ls-remote https://github.com/block-hczhai/block2-preview.git refs/heads/master | awk '{print $1}')" >> $GITHUB_OUTPUT
shell: bash
- name: Restore block2
uses: actions/cache/restore@v4
id: cache-restore-block2
with:
path: |
~/block2-bin
~/block2-preview
key: ${{ runner.os }}-${{ runner.arch }}-block2-${{ steps.get-block2-key.outputs.key }}
- name: Compile block2
if: steps.cache-restore-block2.outputs.cache-hit != 'true'
env:
BLAS_ROOT: $
run: |
cd $HOME
git clone https://github.com/block-hczhai/block2-preview.git
mkdir -p block2-preview/build
cd block2-preview/build
cmake .. -DBUILD_CLIB=ON \
-DCMAKE_BUILD_TYPE=Release \
-DLARGE_BOND=ON \
-DMPI=OFF \
-DCMAKE_INSTALL_PREFIX=${HOME}/block2-bin
make -j4 install
- name: Cache block2
uses: actions/cache/save@v4
with:
path: |
~/block2-bin
~/block2-preview
key: ${{ runner.os }}-${{ runner.arch }}-block2-${{ steps.get-block2-key.outputs.key }}
- name: Compile Forte
id: compile-forte
run: |
export PYTHONPATH=$PYTHONPATH:$HOME/psi4/objdir/stage/lib:$HOME/bin/ambit/lib
export AMBITPATH=$HOME/bin/ambit
export PATH=$PATH:$HOME/psi4/objdir/stage/bin
ambit_dir=$HOME/bin/ambit/share/cmake/ambit/
build_type=Release
cd $HOME/work/forte/forte
cmake_psi4=`psi4 --plugin-compile`
$cmake_psi4 \
-Dambit_DIR=$ambit_dir \
-DCMAKE_BUILD_TYPE=$build_type \
-Dblock2_DIR=${HOME}/block2-bin/share/cmake/block2 \
-DENABLE_block2=ON \
-DMAX_DET_ORB=128 \
-DPYTHON_EXECUTABLE="${CONDA_PREFIX}/bin/python" \
-DENABLE_ForteTests=TRUE
make -j4
pip list
- name: Run Forte methods tests
if: steps.compile-forte.outcome == 'success' && '!cancelled()'
run: |
export PYTHONPATH=$PYTHONPATH:$HOME/psi4/objdir/stage/lib:$HOME/bin/ambit/lib:$PYTHONPATH:$HOME/work/forte/forte
export AMBITPATH=$HOME/bin/ambit
export PATH=$PATH:$HOME/psi4/objdir/stage/bin
export OPENBLAS_NUM_THREADS=1
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
gcc -shared -fPIC -o libfixcpu.so fixcpu.c
fi
export CPUTYPE=$(lscpu | grep 'Vendor ID' | awk '{print $3}')
if [ "$CPUTYPE" = "AuthenticAMD" ]; then
export LD_PRELOAD=$PWD/libfixcpu.so
fi
cd $HOME/work/forte/forte/tests/methods
python run_forte_tests.py --failed_dump --bw
- name: Run Forte pytest tests
if: steps.compile-forte.outcome == 'success' && '!cancelled()'
run: |
export PYTHONPATH=$PYTHONPATH:$HOME/psi4/objdir/stage/lib:$HOME/bin/ambit/lib:$PYTHONPATH:$HOME/work/forte/forte
export AMBITPATH=$HOME/bin/ambit
export PATH=$PATH:$HOME/psi4/objdir/stage/bin
export OPENBLAS_NUM_THREADS=1
cd $HOME/work/forte/forte/tests/pytest
pytest -v
- name: Run Forte pytest methods tests
if: steps.compile-forte.outcome == 'success' && '!cancelled()'
run: |
export PYTHONPATH=$PYTHONPATH:$HOME/psi4/objdir/stage/lib:$HOME/bin/ambit/lib:$PYTHONPATH:$HOME/work/forte/forte
export AMBITPATH=$HOME/bin/ambit
export PATH=$PATH:$HOME/psi4/objdir/stage/bin
export OPENBLAS_NUM_THREADS=1
cd $HOME/work/forte/forte/tests/pytest-methods
pytest -v
- name: Run Forte pytest block2 test
if: steps.compile-forte.outcome == 'success' && '!cancelled()'
run: |
export PYTHONPATH=$PYTHONPATH:$HOME/psi4/objdir/stage/lib:$HOME/bin/ambit/lib:$PYTHONPATH:$HOME/work/forte/forte
export AMBITPATH=$HOME/bin/ambit
export PATH=$PATH:$HOME/psi4/objdir/stage/bin
export OPENBLAS_NUM_THREADS=1
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
gcc -shared -fPIC -o libfixcpu.so fixcpu.c
fi
export CPUTYPE=$(lscpu | grep 'Vendor ID' | awk '{print $3}')
if [ "$CPUTYPE" = "AuthenticAMD" ]; then
export LD_PRELOAD=$PWD/libfixcpu.so
fi
cd $HOME/work/forte/forte/tests/pytest-block2
pytest -v
- name: Upload artifacts
if: failure()
uses: actions/upload-artifact@v4
with:
name: forte-test-outputs
path: |
~/work/forte/forte/tests/methods/*/output.dat
~/work/forte/forte/tests/methods/*/output.log
~/work/forte/forte/tests/pytest*/output.dat
~/work/forte/forte/tests/pytest*/output.log