Skip to content

Commit

Permalink
Update test framework (pyscf#1249)
Browse files Browse the repository at this point in the history
* Support python 3.10 in pip wheel build chain (issue pyscf#1231)

* Add python3.10 tests in github action

* update pypi build chain

* fix github action configs

* Improve safe_eigh function for irregular overlap matrix

* Downgrade scipy due to scipy/scipy#15362

* Debug openmp cmake flags (fix issue pyscf#940)
  • Loading branch information
sunqm authored May 16, 2022
1 parent 55cf68f commit ac65240
Show file tree
Hide file tree
Showing 271 changed files with 4,736 additions and 4,775 deletions.
31 changes: 23 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,32 @@ name: CI
on: [push, pull_request]

jobs:
build:
linux-build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-18.04]
python-version: [3.6, 3.7, 3.8, 3.9]
exclude:
- os: macos-latest
python-version: 3.8
- os: macos-latest
python-version: 3.9
os: [ubuntu-20.04]
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install and Test
run: ./.github/workflows/run_ci.sh
- name: Upload to codecov
uses: codecov/[email protected]
with:
token: ${{secrets.CODECOV_TOKEN}}

macos-build:
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.7"]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/ci_linux/build_pyscf.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#!/usr/bin/env bash

set -e

cd ./pyscf/lib
curl -L "https://github.com/pyscf/pyscf-build-deps/blob/master/pyscf-2.1a-deps.tar.gz?raw=true" | tar xzf -
mkdir build; cd build
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/ci_linux/deps_apt.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#!/usr/bin/env bash
sudo apt-get -qq install \
gcc \
gfortran \
libgfortran3 \
libblas-dev \
cmake \
curl
2 changes: 1 addition & 1 deletion .github/workflows/ci_linux/python_deps.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
python -m pip install --upgrade pip
pip install "numpy!=1.16,!=1.17" "scipy<1.5" h5py nose nose-exclude nose-timer nose-cov codecov
pip install "numpy!=1.16,!=1.17" "scipy!=1.5" h5py pytest pytest-cov pytest-timer
pip install pyberny geometric

#cppe
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/ci_macos/build_pyscf.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env bash
set -e

#XXX default clang compiler does not support openmp, shall we use gcc?
cd ./pyscf/lib
#curl -L https://github.com/fishjojo/pyscf-deps/raw/master/pyscf-1.7.5-deps-macos-10.14.tar.gz | tar xzf -
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_macos/python_deps.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
python -m pip install --upgrade pip
pip install numpy "scipy==1.1" h5py nose nose-exclude nose-timer nose-cov codecov
pip install "numpy!=1.16,!=1.17" "scipy<=1.1" h5py pytest pytest-cov pytest-timer
pip install pyberny geometric

#cppe
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/run_ci.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#!/usr/bin/env bash

set -e

if [ "$RUNNER_OS" == "Linux" ]; then
os='linux'
elif [ "$RUNNER_OS" == "macOS" ]; then
Expand Down
34 changes: 3 additions & 31 deletions .github/workflows/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,7 @@ ulimit -s 20000

echo 'pbc_tools_pbc_fft_engine = "NUMPY"' > .pyscf_conf.py
echo "dftd3_DFTD3PATH = './pyscf/lib/deps/lib'" >> .pyscf_conf.py
echo "scf_hf_SCF_mute_chkfile = True" >> .pyscf_conf.py

nosetests pyscf/ -v --with-timer --with-cov --cov-report xml --cov-report term --cov-config .coveragerc --cov pyscf \
--exclude-dir=examples --exclude-dir=pyscf/pbc/grad \
-e test_bz \
-e h2o_vdz \
-e test_mc2step_4o4e \
-e test_ks_noimport \
-e test_jk_hermi0 \
-e test_j_kpts \
-e test_k_kpts \
-e high_cost \
-e skip \
-e call_in_background \
-e libxc_cam_beta_bug \
-e test_finite_diff_rks_eph \
-e test_finite_diff_uks_eph \
-e test_pipek \
-I test_kuccsd_supercell_vs_kpts\.py \
-I test_kccsd_ghf\.py \
-I test_h_.*\.py \
-I test_P_uadc_ea.py \
-I test_P_uadc_ip.py \
--exclude-test=pyscf/pbc/gw/test/test_kgw_slow_supercell.DiamondTestSupercell3 \
--exclude-test=pyscf/pbc/gw/test/test_kgw_slow_supercell.DiamondKSTestSupercell3 \
--exclude-test=pyscf/pbc/gw/test/test_kgw_slow.DiamondTestSupercell3 \
--exclude-test=pyscf/pbc/gw/test/test_kgw_slow.DiamondKSTestSupercell3 \
--exclude-test=pyscf/pbc/tdscf/test/test_krhf_slow_supercell.DiamondTestSupercell3 \
--exclude-test=pyscf/pbc/tdscf/test/test_kproxy_hf.DiamondTestSupercell3 \
--exclude-test=pyscf/pbc/tdscf/test/test_kproxy_ks.DiamondTestSupercell3 \
--exclude-test=pyscf/pbc/tdscf/test/test_kproxy_supercell_hf.DiamondTestSupercell3 \
--exclude-test=pyscf/pbc/tdscf/test/test_kproxy_supercell_ks.DiamondTestSupercell3 \
-I .*_slow.*py -I .*_kproxy_.*py -I test_proxy.py # tdscf/*_slow.py gw/*_slow.py do not compatible with python3.[456] and old numpy
pytest pyscf/ -s -c setup.cfg \
--cov-report xml --cov-report term --cov-config .coveragerc --cov pyscf
20 changes: 10 additions & 10 deletions docker/pypa-env/Dockerfile-2.0-openblas
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM quay.io/pypa/manylinux2014_x86_64:latest
RUN yum install -y openblas-devel.x86_64

FROM quay.io/pypa/manylinux1_x86_64:latest
#FROM quay.io/pypa/manylinux2014_x86_64:latest
#RUN yum install -y openblas-devel.x86_64
#
FROM quay.io/pypa/manylinux2010_x86_64:latest

RUN yum install -y openblas-devel.x86_64 gcc && \
yum clean all && \
Expand All @@ -13,9 +13,9 @@ COPY build-wheels.sh /build-wheels.sh
CMD ['/build-wheels.sh']

RUN pip config set global.disable-pip-version-check true
# openblas in quay.io/pypa/manylinux1_x86_64 has a bug that causes segfault
# (issue https://github.com/pyscf/pyscf/issues/1095). openblas r0-3.3 fixed
# the bug
COPY --from 0 /usr/lib64/libopenblas.so /usr/lib64/libopenblas.so.0
RUN rm -f libopenblas-r0.2.18.so && \
ln -fs /usr/lib64/libopenblas.so.0 /usr/lib64/libopenblas.so
# # openblas in quay.io/pypa/manylinux1_x86_64 has a bug that causes segfault
# # (issue https://github.com/pyscf/pyscf/issues/1095). openblas r0-3.3 fixed
# # the bug
# COPY --from 0 /usr/lib64/libopenblas.so /usr/lib64/libopenblas.so.0
# RUN rm -f libopenblas-r0.2.18.so && \
# ln -fs /usr/lib64/libopenblas.so.0 /usr/lib64/libopenblas.so
4 changes: 2 additions & 2 deletions docker/pypa-env/build-wheels.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ fi
sed -i '/ if basename(fn) not in needed_libs:/s/basename.*libs/1/' /opt/_internal/tools/lib/python3.7/site-packages/auditwheel/wheel_abi.py

# Compile wheels
for PYVERSION in cp36-cp36m cp37-cp37m cp38-cp38 cp39-cp39; do
for PYVERSION in cp36-cp36m cp37-cp37m cp38-cp38 cp39-cp39 cp310-cp310; do
PYBIN=/opt/python/$PYVERSION/bin
"${PYBIN}/pip" wheel -v --no-deps --no-clean -w /root/wheelhouse $src

# Bundle external shared libraries into the wheels
whl=`ls /root/wheelhouse/pyscf-*-$PYVERSION-linux_x86_64.whl`
whl=`ls /root/wheelhouse/pyscf-*-$PYVERSION-linux*_x86_64.whl`
auditwheel -v repair "$whl" --lib-sdir /lib -w $dst
done
40 changes: 21 additions & 19 deletions pyscf/adc/test/test_radc/test_H2O_radc_ea.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,29 @@
from pyscf import scf
from pyscf import adc

mol = gto.Mole()
r = 0.957492
x = r * math.sin(104.468205 * math.pi/(2 * 180.0))
y = r * math.cos(104.468205* math.pi/(2 * 180.0))
mol.atom = [
['O', ( 0., 0. , 0)],
['H', ( 0., -x, y)],
['H', ( 0., x , y)],]
mol.basis = {'H': 'aug-cc-pVDZ',
'O': 'aug-cc-pVDZ',}
mol.verbose = 0
mol.build()

mf = scf.RHF(mol)
mf.conv_tol = 1e-12
mf.kernel()
myadc = adc.ADC(mf)
def setUpModule():
global mol, mf, myadc
mol = gto.Mole()
r = 0.957492
x = r * math.sin(104.468205 * math.pi/(2 * 180.0))
y = r * math.cos(104.468205* math.pi/(2 * 180.0))
mol.atom = [
['O', ( 0., 0. , 0)],
['H', ( 0., -x, y)],
['H', ( 0., x , y)],]
mol.basis = {'H': 'aug-cc-pVDZ',
'O': 'aug-cc-pVDZ',}
mol.verbose = 0
mol.build()

mf = scf.RHF(mol)
mf.conv_tol = 1e-12
mf.kernel()
myadc = adc.ADC(mf)

def tearDownModule():
global mol, mf
del mol, mf
global mol, mf, myadc
del mol, mf, myadc

class KnownValues(unittest.TestCase):

Expand Down
40 changes: 21 additions & 19 deletions pyscf/adc/test/test_radc/test_H2O_radc_ip.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,29 @@
from pyscf import scf
from pyscf import adc

mol = gto.Mole()
r = 0.957492
x = r * math.sin(104.468205 * math.pi/(2 * 180.0))
y = r * math.cos(104.468205* math.pi/(2 * 180.0))
mol.atom = [
['O', ( 0., 0. , 0)],
['H', ( 0., -x, y)],
['H', ( 0., x , y)],]
mol.basis = {'H': 'cc-pVDZ',
'O': 'cc-pVDZ',}
mol.verbose = 0
mol.build()

mf = scf.RHF(mol)
mf.conv_tol = 1e-12
mf.kernel()
myadc = adc.ADC(mf)
def setUpModule():
global mol, mf, myadc
mol = gto.Mole()
r = 0.957492
x = r * math.sin(104.468205 * math.pi/(2 * 180.0))
y = r * math.cos(104.468205* math.pi/(2 * 180.0))
mol.atom = [
['O', ( 0., 0. , 0)],
['H', ( 0., -x, y)],
['H', ( 0., x , y)],]
mol.basis = {'H': 'cc-pVDZ',
'O': 'cc-pVDZ',}
mol.verbose = 0
mol.build()

mf = scf.RHF(mol)
mf.conv_tol = 1e-12
mf.kernel()
myadc = adc.ADC(mf)

def tearDownModule():
global mol, mf
del mol, mf
global mol, mf, myadc
del mol, mf, myadc

class KnownValues(unittest.TestCase):

Expand Down
40 changes: 21 additions & 19 deletions pyscf/adc/test/test_radc/test_H2O_radc_outcore.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,29 @@
from pyscf import scf
from pyscf import adc

mol = gto.Mole()
r = 0.957492
x = r * math.sin(104.468205 * math.pi/(2 * 180.0))
y = r * math.cos(104.468205* math.pi/(2 * 180.0))
mol.atom = [
['O', ( 0., 0. , 0)],
['H', ( 0., -x, y)],
['H', ( 0., x , y)],]
mol.basis = {'H': 'aug-cc-pVDZ',
'O': 'aug-cc-pVDZ',}
mol.verbose = 0
mol.build()

mf = scf.RHF(mol)
mf.conv_tol = 1e-12
mf.kernel()
myadc = adc.ADC(mf)
def setUpModule():
global mol, mf, myadc
mol = gto.Mole()
r = 0.957492
x = r * math.sin(104.468205 * math.pi/(2 * 180.0))
y = r * math.cos(104.468205* math.pi/(2 * 180.0))
mol.atom = [
['O', ( 0., 0. , 0)],
['H', ( 0., -x, y)],
['H', ( 0., x , y)],]
mol.basis = {'H': 'aug-cc-pVDZ',
'O': 'aug-cc-pVDZ',}
mol.verbose = 0
mol.build()

mf = scf.RHF(mol)
mf.conv_tol = 1e-12
mf.kernel()
myadc = adc.ADC(mf)

def tearDownModule():
global mol, mf
del mol, mf
global mol, mf, myadc
del mol, mf, myadc

class KnownValues(unittest.TestCase):

Expand Down
30 changes: 16 additions & 14 deletions pyscf/adc/test/test_radc/test_N2_radc_ea.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,24 @@
from pyscf import scf
from pyscf import adc

r = 1.098
mol = gto.Mole()
mol.atom = [
['N', ( 0., 0. , -r/2 )],
['N', ( 0., 0. , r/2)],]
mol.basis = {'N':'aug-cc-pvdz'}
mol.verbose = 0
mol.build()
mf = scf.RHF(mol)
mf.conv_tol = 1e-12
mf.kernel()
myadc = adc.ADC(mf)
def setUpModule():
global mol, mf, myadc
r = 1.098
mol = gto.Mole()
mol.atom = [
['N', ( 0., 0. , -r/2 )],
['N', ( 0., 0. , r/2)],]
mol.basis = {'N':'aug-cc-pvdz'}
mol.verbose = 0
mol.build()
mf = scf.RHF(mol)
mf.conv_tol = 1e-12
mf.kernel()
myadc = adc.ADC(mf)

def tearDownModule():
global mol, mf
del mol, mf
global mol, mf, myadc
del mol, mf, myadc

class KnownValues(unittest.TestCase):

Expand Down
30 changes: 16 additions & 14 deletions pyscf/adc/test/test_radc/test_N2_radc_ip.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,24 @@
from pyscf import scf
from pyscf import adc

r = 1.098
mol = gto.Mole()
mol.atom = [
['N', ( 0., 0. , -r/2 )],
['N', ( 0., 0. , r/2)],]
mol.basis = {'N':'aug-cc-pvdz'}
mol.verbose = 0
mol.build()
mf = scf.RHF(mol)
mf.conv_tol = 1e-12
mf.kernel()
myadc = adc.ADC(mf)
def setUpModule():
global mol, mf, myadc
r = 1.098
mol = gto.Mole()
mol.atom = [
['N', ( 0., 0. , -r/2 )],
['N', ( 0., 0. , r/2)],]
mol.basis = {'N':'aug-cc-pvdz'}
mol.verbose = 0
mol.build()
mf = scf.RHF(mol)
mf.conv_tol = 1e-12
mf.kernel()
myadc = adc.ADC(mf)

def tearDownModule():
global mol, mf
del mol, mf
global mol, mf, myadc
del mol, mf, myadc

class KnownValues(unittest.TestCase):

Expand Down
Loading

0 comments on commit ac65240

Please sign in to comment.