bump to cmake 3.19, einsums 0.5 (#3162) #12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)" | |
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: "LLVM clang-cl (W)" | |
runs-on: windows-latest | |
python-version: "3.12" | |
mkl-version: "=2022.1" | |
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 OpenMP_LIBRARY_DIRS="D:/a/psi4/psi4/iomp5md/conda/win/2019.1" | |
# 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 | |
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@v2 | |
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 | |
- name: Prepare OpenMP build environment, libiomp5md.lib (W) | |
if: runner.os == 'Windows' | |
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" | |
printf "\n<<< env_p4build.yaml >>>\n" | |
cat env_p4build.yaml | |
echo "::endgroup::" | |
# | |
if [[ "${{ runner.os }}" == "Linux" ]]; then | |
: | |
# not for py312 | |
sed -i "s;- dftd4-python;#- dftd4-python;g" env_p4build.yaml | |
sed -i "s;- cppe;#- cppe;g" env_p4build.yaml | |
fi | |
if [[ "${{ runner.os }}" == "macOS" ]]; then | |
: | |
# sed -E -i.bak "s;;;g" env_p4build.yaml | |
fi | |
if [[ "${{ runner.os }}" == "Windows" ]]; then | |
: | |
fi | |
echo " - pygments" >> env_p4build.yaml | |
- name: Setup Conda | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
activate-environment: p4build | |
environment-file: env_p4build.yaml | |
show-channel-urls: true | |
python-version: ${{ matrix.cfg.python-version }} | |
auto-activate-base: false | |
miniforge-variant: Mambaforge | |
use-mamba: true | |
add-pip-as-python-dependency: true | |
channels: conda-forge | |
- name: Buildtime Conda environment | |
run: | | |
mamba info | |
mamba 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: | | |
mamba info | |
mamba 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 | |
if: false | |
working-directory: ./objdir | |
run: ctest -L smoke -LE d2ints -j2 --output-on-failure | |
- 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. |