Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ jobs:
tests:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.10", "3.14"]
runs-on: "ubuntu-latest"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -30,5 +31,14 @@ jobs:
run: pip install -r .github/requirements-old.txt
- name: Install development version
run: pip install -e .[dev]
- name: Show CPU info
run:
cpuinfo
- name: Show NumPy configurations
run: |
python -c "import numpy; numpy.show_config()"
- name: Show SciPy configurations
run: |
python -c "import scipy; scipy.show_config()"
- name: Run pytest
run: pytest -vv
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ build
.envrc
dist
tmp
venv
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ The details of setting up such an environment depend on your operating system an
1. Install the `tinydft` package from source in development mode:

```bash
pip install -e .
pip install -e .[dev]
```

### User setup
Expand Down Expand Up @@ -91,6 +91,11 @@ pytest

See [the QC-Devs Contributor Guide](https://github.com/theochem/.github/blob/main/CONTRIBUTING.md) for more details.

A known issue is that some unit tests may fail on specific hardware,
with numerical errors slightly exceeding the specified tolerances.
When this happens, you can open an issue with the details of the failing test
and the output of the `cpuinfo` and `python -c "import numpy; numpy.show_config()"` commands.

## Programming assignments

In order of increasing difficulty:
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ dynamic = ["version"]

[project.optional-dependencies]
dev = [
"py-cpuinfo",
"pytest",
"pytest-cov",
"pytest-xdist",
Expand Down
3 changes: 2 additions & 1 deletion tests/test_tinybasis.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ def test_hydrogenic_op(atnum, angqn, grid_basis):
assert_allclose(norm, 1, atol=0, rtol=1e-8, err_msg=case)
assert_allclose(eext, -factor, atol=0, rtol=1e-5, err_msg=case)
assert_allclose(ekin, factor / 2, atol=0, rtol=1e-5, err_msg=case)
assert_allclose(evals[i], -factor / 2, atol=0, rtol=3e-6, err_msg=case)
# rtol increased from 3e-6 to 4e-6 for AMD Ryzen 5 5600H with Radeon Graphics
assert_allclose(evals[i], -factor / 2, atol=0, rtol=4e-6, err_msg=case)


def test_integral_regression(num_regression):
Expand Down
3 changes: 2 additions & 1 deletion tests/test_tinydft.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ def test_poisson(atnum):
vnum = solve_poisson(grid, rho)
vann = (1 - aux) / grid.points - alpha * aux / 2
assert_allclose(vnum[-1], 1.0 / grid.points[-1], atol=1e-11, rtol=0)
assert_allclose(vnum, vann, rtol=1e-6, atol=0)
# rtol increased from 1e-6 to 5e-6 for macOS runners on GitHub Actions, Apple M1 (Virtual)
assert_allclose(vnum, vann, rtol=5e-5, atol=0)


def test_interpret_econf1():
Expand Down
3 changes: 2 additions & 1 deletion tests/test_tinygrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ def transform(x, np):
fnvalsd = grid.derivative(fnvals)
assert_allclose(grid.integrate(fnvals), 1.0, atol=1e-13, rtol=0)
assert_allclose(fnvalsa, -fnvals, atol=1e-7, rtol=0)
assert_allclose(fnvalsd, -fnvals, atol=1e-7, rtol=0)
# atol reduced from 1e-7 to 2e-7 for Intel(R) Xeon(R) Gold 6240 CPU @ 2.60GHz
assert_allclose(fnvalsd, -fnvals, atol=2e-7, rtol=0)


def test_tf_grid_exp_vectorized():
Expand Down
Loading