forked from psi4/psi4
-
Notifications
You must be signed in to change notification settings - Fork 0
329 lines (292 loc) · 13.3 KB
/
ecosystem.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
name: Eco
on:
push:
branches:
- master
pull_request:
merge_group:
permissions:
contents: read # to fetch code (actions/checkout)
jobs:
ecosystem:
strategy:
fail-fast: false
matrix:
cfg:
- label: "Conda GNU (L)"
runs-on: ubuntu-latest
python-version: "3.12"
mkl-version: ""
platform: linux-64
pytest-marker-expr: "addon and not (medlong or long)"
cmargs: >
-D CMAKE_VERBOSE_MAKEFILE=OFF
-D ENABLE_v2rdm_casscf=ON
-D CMAKE_DISABLE_FIND_PACKAGE_v2rdm_casscf=ON
# Notes:
# * for all three lanes, can consider:
# -D BUILD_SHARED_LIBS=ON
# -D ENABLE_XHOST=OFF
- label: "Conda Clang (M-Intel)"
runs-on: macos-13 # ensures py!=27 in base OS
python-version: "3.9"
mkl-version: ""
platform: osx-64
pytest-marker-expr: "addon and not (medlong or long)"
target-sdk: "10.10"
cmargs: >
-D CMAKE_VERBOSE_MAKEFILE=OFF
-D ENABLE_v2rdm_casscf=ON
-D CMAKE_DISABLE_FIND_PACKAGE_v2rdm_casscf=ON
# Notes:
# * libiomp5 is picking up naturally but left here as guide
# -D OpenMP_C_FLAG="-fopenmp=libiomp5"
# -D OpenMP_CXX_FLAG="-fopenmp=libiomp5"
# * as long as we're using mac to test legacy QCFractal, stick with py39
# * Once upon a time, this GHA absolutely needed the SDK. I don't know
# why not now, but left here in case it shows up again.
# -D CMAKE_Fortran_FLAGS="-isysroot /opt/MacOSX${{ matrix.cfg.target-sdk }}.sdk" \
# -D CMAKE_OSX_DEPLOYMENT_TARGET=${{ matrix.cfg.target-sdk }} \
# -D CMAKE_OSX_SYSROOT="/opt/MacOSX${{ matrix.cfg.target-sdk }}.sdk" \
- label: "Conda Clang (M-Silicon)"
runs-on: macos-latest
python-version: "3.10"
mkl-version: ""
platform: osx-64
pytest-marker-expr: "addon and not (medlong or long)"
target-sdk: "10.10"
cmargs: >
-D CMAKE_VERBOSE_MAKEFILE=OFF
-D ENABLE_v2rdm_casscf=ON
-D CMAKE_DISABLE_FIND_PACKAGE_v2rdm_casscf=ON
- label: "LLVM clang-cl (W)"
runs-on: windows-latest
python-version: "3.12"
mkl-version: "=2022.1"
llvm-version: "17.0.6"
platform: win-64
pytest-marker-expr: "addon and not (medlong or long) and not d2ints"
cmargs: >
-D CMAKE_VERBOSE_MAKEFILE=OFF
-D psi4_SKIP_ENABLE_Fortran=ON
-D CMAKE_CXX_FLAGS="-IC:\Miniconda\envs\p4build\opt\compiler\include"
# Notes:
# * When not using cache file, need to additionally specify the following:
# -D CMAKE_C_COMPILER=clang-cl
# -D CMAKE_CXX_COMPILER=clang-cl
# * "not d2ints" allows Windows accessing c-f L2 to pass
# * Older computers may need -D ENABLE_XHOST=OFF & -D CMAKE_CXX_FLAGS="/arch:AVX"
# * See mkl-version notes at end
# * If building certain addons from src (i.e., L2), need
# -D BUILD_SHARED_LIBS=OFF
# * See OpenMP_LIBRARY_DIRS below. no longer needed
# -D OpenMP_LIBRARY_DIRS="D:/a/psi4/psi4/iomp5md/conda/win/2019.1"
name: "Eco • 🐍 ${{ matrix.cfg.python-version }} • ${{ matrix.cfg.label }}"
runs-on: ${{ matrix.cfg.runs-on }}
defaults:
run:
shell: bash -l {0}
steps:
# fetch-depth: 0 gets git history so Psi4 version is computable
- name: Checkout Psi4
uses: actions/checkout@v4
with:
fetch-depth: 0
# see CMAKE_OSX_SYSROOT and CMAKE_Fortran_FLAGS for use
# mac_ver line returns, e.g., "10.15" for Catalina & "11.6" for Big Sur. but phracker doesn't support all minor, so some logic to hardcode.
- name: Prepare compiler environment, SDK (M)
#if: runner.os == 'macOS'
if: false
run: |
macos_Mm=$(SYSTEM_VERSION_COMPAT=0 python -c "import platform; Mmp = platform.mac_ver()[0]; Mm = '.'.join(Mmp.split('.')[:2]); print(Mm)")
macos_M=$(SYSTEM_VERSION_COMPAT=0 python -c "import platform; Mmp = platform.mac_ver()[0]; M = '.'.join(Mmp.split('.')[:1]); print(M)")
echo $macos_Mm $macos_M
if [[ "${macos_M}" == "11" ]]; then
macos_Mm=11.3
elif [[ "${macos_M}" == "12" ]]; then
# until phracker merges and releases 12 via https://github.com/phracker/MacOSX-SDKs/pull/44
macos_Mm=11.3
elif [[ "${macos_M}" == "13" ]]; then
macos_Mm=11.3
fi
echo $macos_Mm
curl -L https://github.com/phracker/MacOSX-SDKs/releases/download/${macos_Mm}/MacOSX${{ matrix.cfg.target-sdk }}.sdk.tar.xz | sudo tar xf - -C /opt/
# equivalent to `call vcvarsall.bat x64`. see Azure script to follow cmdline.
- name: Prepare compiler environment, vcvarsall (W)
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
# see OpenMP_LIBRARY_DIRS for use
# no longer needed since intel-openmp conda package now provides dll & lib
- name: Prepare OpenMP build environment, libiomp5md.lib (W)
#if: runner.os == 'Windows'
if: false
run: git clone https://github.com/psi4/iomp5md.git
- name: Write Conda environment files
run: |
#
# Buildtime/Runtime (L, M, W)
#
echo "::group::Prepare OS Python"
which python
python --version
pip install PyYAML
echo "::endgroup::"
#
conda/psi4-path-advisor.py \
env \
--name p4build \
--python ${{ matrix.cfg.python-version }} \
--disable docs \
--offline-conda
echo "::group::View Env Spec File for Conda (from advisor)"
printf "\n<<< env_p4build.yaml >>>\n"
cat env_p4build.yaml
echo "::endgroup::"
#
if [[ "${{ runner.os }}" == "Linux" ]]; then
:
# not for py312
sed -i "s;- cppe;#- cppe;g" env_p4build.yaml
fi
if [[ "${{ runner.os }}" == "macOS" && "${{ matrix.cfg.label }}" == "Conda Clang (M-Intel)" ]]; then
:
# sed -E -i.bak "s;;;g" env_p4build.yaml
fi
if [[ "${{ runner.os }}" == "macOS" && "${{ matrix.cfg.label }}" == "Conda Clang (M-Silicon)" ]]; then
:
sed -E -i.bak "s;- adcc;#- adcc;g" env_p4build.yaml
sed -E -i.bak "s;- einsums;#- einsums;g" env_p4build.yaml
sed -E -i.bak "s;accelerate;openblas;g" env_p4build.yaml
sed -E -i.bak "s;- memory_profiler;#- memory_profiler;g" env_p4build.yaml
# memory leaks. accelerate is fine but openblas matches the scf-cholesky stored values
fi
if [[ "${{ runner.os }}" == "Windows" ]]; then
:
sed -i "s;#- dpcpp_linux-64;- clangdev ${{ matrix.cfg.llvm-version }};g" env_p4build.yaml
#sed -i "s;- intel-openmp;- intel-openmp=2024.2.0=h57928b3_978;g" env_p4build.yaml
fi
echo " - pygments" >> env_p4build.yaml
echo "::group::View Env Spec File for Conda (Edited)"
printf "\n<<< env_p4build.yaml >>>\n"
cat env_p4build.yaml
echo "::endgroup::"
- name: Setup Conda
uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: p4build
environment-file: env_p4build.yaml
show-channel-urls: true
python-version: ${{ matrix.cfg.python-version }}
auto-activate-base: false
add-pip-as-python-dependency: true
channels: conda-forge
- name: Buildtime Conda environment
run: |
conda info
conda list
- name: Configure Psi4, ${{ matrix.cfg.label }}
run: |
conda/psi4-path-advisor.py \
cache \
--objdir objdir \
--insist
echo "::group::View Cache File for CMake"
printf "\n<<< cache_p4build@objdir.cmake >>>\n"
pygmentize -g -O style=friendly,linenos=1 cache_p4build@objdir.cmake
echo "::endgroup::"
#
# Note: using the cache file (-C below) is optional. See cmargs above.
# The cache file is doing the -D ENABLE_<addon>=ON work.
cmake \
-S. \
-B objdir \
-G Ninja \
-C "${{ github.workspace }}/cache_p4build@objdir.cmake" \
-D CMAKE_INSTALL_PREFIX=./install \
${{ matrix.cfg.cmargs }}
- name: Compile & Install Psi4
run: |
if [[ "${{ runner.os }}" == "Linux" ]]; then
# limit to avoid GHA OOM errors in libmints
export CMAKE_BUILD_PARALLEL_LEVEL=2
fi
cmake --build objdir --config Release --target install
- name: Linked dependencies, ldd (L)
if: runner.os == 'Linux'
run: ldd objdir/stage/lib/psi4/core.*.so
- name: Linked dependencies, otool (M)
if: runner.os == 'macOS'
run: otool -L objdir/stage/lib/psi4/core.*.so
- name: Linked dependencies, objdump (W)
if: runner.os == 'Windows'
shell: cmd /C CALL {0}
run: objdump.exe -p objdir\stage\lib\psi4\core.*.pyd | grep dll
- name: Special Config - QCElemental Dep
if: false
run: |
conda remove qcelemental --force
python -m pip install git+https://github.com/MolSSI/QCElemental.git@v0.29.0.dev2 --no-deps
- name: Special Config - QCFractal Dep
if: false
run: |
conda remove qcfractal --force
python -m pip install -e 'git+https://github.com/MolSSI/QCFractal.git@main#egg=qcfractal&subdirectory=qcfractal'
- name: Special Config - Patch Legacy QCFractal for Python
if: false
run: |
sed -E -i.bak "s;for result in self.queue.values\(\);for result in list(self.queue.values());g" /Users/runner/miniconda3/envs/p4build/lib/python${{ matrix.cfg.python-version }}/site-packages/qcfractal/queue/executor_adapter.py
- name: Runtime Conda environment
run: |
conda info
conda list
if [[ "${{ runner.os }}" != "Windows" ]]; then
# on Windows, cmd varies: `qcengine.exe`
qcengine info
fi
- name: Test OpenMP
working-directory: ./install/lib
run: python -c "from psi4 import core; core.set_num_threads(42); assert core.get_num_threads() == 42"
- name: Test Run, Spot, Run
working-directory: ./objdir
run: |
export PATH=../install/bin:$PATH
#export KMP_DUPLICATE_LIB_OK=TRUE
psi4 ../tests/tu1-h2o-energy/input.dat -o stdout
# step works but is redundant with next one; enable for debugging
- name: Test Addons with CTest (M)
if: runner.os == 'macOS'
working-directory: ./objdir
run: ctest -L quick -j2 --output-on-failure # `-LE d2ints` needed for Windows
- name: Test Addons with Pytest
working-directory: ./objdir
run: PYTHONPATH=stage/lib pytest --cache-clear -v -rws --durations=50 --durations-min=40 --strict-markers --color yes -n auto -m "${{ matrix.cfg.pytest-marker-expr }}" stage/lib/psi4/tests/
- name: Write user Conda environment files
run: |
pygmentize -g env_p4build.yaml
pygmentize -g cache_p4build@objdir.cmake
conda/psi4-path-advisor.py -vv
cp env_p4build.yaml "devtools/conda-envs/${{ matrix.cfg.platform }}-buildrun.yaml"
git diff --color-words
# Notes
# -----
# Error: (W) "OMP: Error #15: Initializing libiomp5md.dll, but found libomp.dll already initialized." or analysis shows linked to libomp.dll
# Soln: feed OpenMP_LIBRARY_DIRS so selects correct libiomp5md.lib so analysis shows linked to libiomp5md.dll
# Error (W) " File "D:\a\psi4\psi4\objdir\stage\lib\psi4\__init__.py", line 55, in <module>
# from . import core
# ImportError: DLL load failed while importing core: The specified module could not be found."
# Soln:
# Have mkl-devel=<mkl-version> -or- mkl=<mkl-version> in runtime environment to match mkl-devel=<mkl-version> in build env.
# Having intel-openmp=<mkl-version> in build and run seems fine but not necessary.
# one of mkl=${{ matrix.cfg.mkl-version }} or mkl-devel=${{ matrix.cfg.mkl-version }} needed to avoid DLL runtime error
# Error: (W) "DLL load failed while importing _multiarray_umath: The specified module could not be found."
# Soln: Add `C:\tools\miniconda3\Library\mingw-w64\bin` to PATH
# Using Intel's OpenMP on Windows needs libiomp5md.lib (import library) and libiomp5md.dll at buildtime and libiomp5md.dll at runtime.
# No conda package provides libiomp5md.lib, so we stashed one from 2019.1 on GH and clone it here for the build.
# We feed the cloned path to the build via OpenMP_LIBRARY_DIRS. 2019.1 has been the iomp5 version for a long time.
# But by now, only defaults conda channel has a complementary intel-openmp=2019.1 package with the dll.
# In order to update the version and to allow a single channel base, conda-forge, using mkl-version=2021.4 still with that
# same 2019.1 iomp5, and it seems to work fine. Is all this really necessary? I don't know.
# There is another libiomp5md.lib that comes with llvm and lives at "C:\Program Files\LLVM\lib\libiomp5md.lib".
# Attempts to use it quickly fell off the narrow path-of-compilability-and-runability but should be explored again.