Skip to content

Revert "Run numba tests in python 3.10 instead of 3.11" #317

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 24, 2023
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
29 changes: 4 additions & 25 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ jobs:
python-version: ["3.8", "3.11"]
fast-compile: [0,1]
float32: [0,1]
install-numba: [0]
install-numba: [1]
part:
- "tests --ignore=tests/tensor --ignore=tests/scan --ignore=tests/sparse --ignore=tests/link/numba"
- "tests --ignore=tests/tensor --ignore=tests/scan --ignore=tests/sparse"
- "tests/scan"
- "tests/sparse"
- "tests/tensor --ignore=tests/tensor/conv --ignore=tests/tensor/rewriting --ignore=tests/tensor/test_math.py --ignore=tests/tensor/test_basic.py --ignore=tests/tensor/test_blas.py --ignore=tests/tensor/test_math_scipy.py --ignore=tests/tensor/test_inplace.py --ignore=tests/tensor/test_elemwise.py"
Expand All @@ -93,27 +93,6 @@ jobs:
part: "tests/tensor/test_math.py"
- fast-compile: 1
float32: 1
include:
- install-numba: 1
python-version: "3.8"
fast-compile: 0
float32: 0
part: "tests/link/numba"
- install-numba: 1
python-version: "3.10"
fast-compile: 0
float32: 0
part: "tests/link/numba"
- install-numba: 1
python-version: "3.10"
fast-compile: 1
float32: 0
part: "tests/link/numba"
- install-numba: 1
python-version: "3.10"
fast-compile: 0
float32: 1
part: "tests/link/numba"
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -139,7 +118,7 @@ jobs:
shell: bash -l {0}
run: |
mamba install --yes -q "python~=${PYTHON_VERSION}=*_cpython" mkl numpy scipy pip mkl-service graphviz cython pytest coverage pytest-cov pytest-benchmark sympy
if [[ $INSTALL_NUMBA == "1" ]]; then mamba install --yes -q -c conda-forge "python~=${PYTHON_VERSION}=*_cpython" "numba>=0.55" numba-scipy; fi
if [[ $INSTALL_NUMBA == "1" ]]; then mamba install --yes -q -c conda-forge "python~=${PYTHON_VERSION}=*_cpython" "numba>=0.57" numba-scipy; fi
mamba install --yes -q -c conda-forge "python~=${PYTHON_VERSION}=*_cpython" jax jaxlib numpyro
pip install -e ./
mamba list && pip freeze
Expand Down Expand Up @@ -192,7 +171,7 @@ jobs:
- name: Install dependencies
shell: bash -l {0}
run: |
mamba install --yes -q -c conda-forge "python~=${PYTHON_VERSION}=*_cpython" mkl numpy scipy pip mkl-service cython pytest "numba>=0.55" numba-scipy jax jaxlib pytest-benchmark
mamba install --yes -q -c conda-forge "python~=${PYTHON_VERSION}=*_cpython" mkl numpy scipy pip mkl-service cython pytest "numba>=0.57" numba-scipy jax jaxlib pytest-benchmark
pip install -e ./
mamba list && pip freeze
python -c 'import pytensor; print(pytensor.config.__str__(print_doc=False))'
Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ dependencies:
- mkl-service
- libblas=*=*mkl
# numba backend
- numba>=0.55
- numba>=0.57
- numba-scipy
# For testing
- coveralls
Expand Down
7 changes: 6 additions & 1 deletion pytensor/link/numba/dispatch/random.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ def body_fn(a):
def numba_funcify_CategoricalRV(op, node, **kwargs):
out_dtype = node.outputs[1].type.numpy_dtype
size_len = int(get_vector_length(node.inputs[1]))
p_ndim = node.inputs[-1].ndim

@numba_basic.numba_njit
def categorical_rv(rng, size, dtype, p):
Expand All @@ -321,7 +322,11 @@ def categorical_rv(rng, size, dtype, p):
size_tpl = numba_ndarray.to_fixed_tuple(size, size_len)
p = np.broadcast_to(p, size_tpl + p.shape[-1:])

unif_samples = np.random.uniform(0, 1, size_tpl)
# Workaround https://github.com/numba/numba/issues/8975
if not size_len and p_ndim == 1:
unif_samples = np.asarray(np.random.uniform(0, 1))
else:
unif_samples = np.random.uniform(0, 1, size_tpl)

res = np.empty(size_tpl, dtype=out_dtype)
for idx in np.ndindex(*size_tpl):
Expand Down
18 changes: 0 additions & 18 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#!/usr/bin/env python
import os

import numpy
from setuptools import Extension, setup
from setuptools.dist import Distribution
Expand All @@ -14,22 +12,6 @@

NAME: str = dist.get_name() # type: ignore

# Handle builds of nightly release
if "BUILD_PYTENSOR_NIGHTLY" in os.environ:
NAME += "-nightly"

from versioneer import get_versions as original_get_versions

def get_versions():
from datetime import datetime, timezone

suffix = datetime.now(timezone.utc).strftime(r".dev%Y%m%d")
versions = original_get_versions()
versions["version"] = versions["version"].split("+")[0] + suffix
return versions

versioneer.get_versions = get_versions


if __name__ == "__main__":
setup(
Expand Down
3 changes: 0 additions & 3 deletions tests/link/numba/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,9 +530,6 @@ def test_AdvancedIncSubtensor1(x, y, indices):
at.as_tensor(np.arange(3 * 4 * 5).reshape((3, 4, 5))),
at.as_tensor(rng.poisson(size=(2, 5))),
([1, 1], [2, 2]),
marks=pytest.mark.xfail(
reason="Duplicate index handling hasn't been implemented, yet."
),
),
],
)
Expand Down
3 changes: 0 additions & 3 deletions tests/link/numba/test_extra_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,9 +459,6 @@ def test_UnravelIndex(arr, shape, order, exc):
"left",
None,
None,
marks=pytest.mark.xfail(
reason="This won't work until https://github.com/numba/numba/pull/7005 is merged"
),
),
(
set_test_value(at.vector(), np.array([1.0, 2.0, 3.0], dtype=config.floatX)),
Expand Down