Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
e64816d0
提交
e64816d0
authored
11月 19, 2025
作者:
Ricardo Vieira
提交者:
Ricardo Vieira
12月 15, 2025
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
CI: Add numba linker and drop float32 parametrizations
上级
d83b1cc2
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
56 行增加
和
88 行删除
+56
-88
test.yml
.github/workflows/test.yml
+43
-85
test_mode.py
tests/compile/test_mode.py
+13
-3
没有找到文件。
.github/workflows/test.yml
浏览文件 @
e64816d0
...
@@ -65,7 +65,7 @@ jobs:
...
@@ -65,7 +65,7 @@ jobs:
-
uses
:
pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd
# v3.0.1
-
uses
:
pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd
# v3.0.1
test
:
test
:
name
:
"
${{
matrix.os
}}
test
py${{
matrix.python-version
}}
:
fast-compile
${{
matrix.fast-compile
}}
:
float32
${{
matrix.float32
}}
:
${{
matrix.part
}}"
name
:
"
mode
${{
matrix.default-mode
}}
:
py${{
matrix.python-version
}}
:
${{
matrix.os
}}
:
${{
matrix.part[0]
}}"
needs
:
needs
:
-
changes
-
changes
-
style
-
style
...
@@ -74,101 +74,62 @@ jobs:
...
@@ -74,101 +74,62 @@ jobs:
strategy
:
strategy
:
fail-fast
:
false
fail-fast
:
false
matrix
:
matrix
:
os
:
[
"
ubuntu-latest
"
]
default-mode
:
[
"
C"
,
"
NUMBA"
,
"
FAST_COMPILE
"
]
python-version
:
[
"
3.11"
,
"
3.14"
]
python-version
:
[
"
3.11"
,
"
3.14"
]
fast-compile
:
[
0
,
1
]
os
:
[
"
ubuntu-latest"
]
float32
:
[
0
,
1
]
install-numba
:
[
0
]
install-jax
:
[
0
]
install-jax
:
[
0
]
install-torch
:
[
0
]
install-torch
:
[
0
]
install-mlx
:
[
0
]
install-mlx
:
[
0
]
install-xarray
:
[
0
]
install-xarray
:
[
0
]
part
:
part
:
-
"
tests
--ignore=tests/scan
--ignore=tests/tensor
--ignore=tests/xtensor"
-
[
"
*rest"
,
"
tests
--ignore=tests/scan
--ignore=tests/tensor
--ignore=tests/xtensor
--ignore=tests/link/numba"
]
-
"
tests/scan"
-
[
"
scan"
,
"
tests/scan"
]
-
"
tests/tensor
--ignore=tests/tensor/test_basic.py
--ignore=tests/tensor/test_elemwise.py
--ignore=tests/tensor/test_math.py
--ignore=tests/tensor/test_math_scipy.py
--ignore=tests/tensor/test_blas.py
--ignore=tests/tensor/signal
--ignore=tests/tensor/conv
--ignore=tests/tensor/rewriting
--ignore=tests/tensor/linalg
--ignore=tests/tensor/test_nlinalg.py
--ignore=tests/tensor/test_slinalg.py
--ignore=tests/tensor/test_pad.py"
-
[
"
tensor
*rest"
,
"
tests/tensor
--ignore=tests/tensor/test_basic.py
--ignore=tests/tensor/test_elemwise.py
--ignore=tests/tensor/test_math.py
--ignore=tests/tensor/test_math_scipy.py
--ignore=tests/tensor/test_blas.py
--ignore=tests/tensor/signal
--ignore=tests/tensor/conv
--ignore=tests/tensor/rewriting
--ignore=tests/tensor/linalg
--ignore=tests/tensor/test_nlinalg.py
--ignore=tests/tensor/test_slinalg.py
--ignore=tests/tensor/test_pad.py"
]
-
"
tests/tensor/test_basic.py
tests/tensor/test_elemwise.py"
-
[
"
tensor
basic+elemwise"
,
"
tests/tensor/test_basic.py
tests/tensor/test_elemwise.py"
]
-
"
tests/tensor/test_math.py"
-
[
"
tensor
math"
,
"
tests/tensor/test_math.py"
]
-
"
tests/tensor/test_math_scipy.py
tests/tensor/test_blas.py
tests/tensor/signal
tests/tensor/conv
tests/tensor/test_pad.py"
-
[
"
tensor
scipy+blas+conv+pad"
,
"
tests/tensor/test_math_scipy.py
tests/tensor/test_blas.py
tests/tensor/signal
tests/tensor/conv
tests/tensor/test_pad.py"
]
-
"
tests/tensor/rewriting"
-
[
"
tensor
rewriting"
,
"
tests/tensor/rewriting"
]
-
"
tests/tensor/linalg
tests/tensor/test_nlinalg.py
tests/tensor/test_slinalg.py"
-
[
"
tensor
linalg"
,
"
tests/tensor/linalg
tests/tensor/test_nlinalg.py
tests/tensor/test_slinalg.py"
]
exclude
:
exclude
:
-
python-version
:
"
3.11"
-
python-version
:
"
3.11"
fast-compile
:
1
default-mode
:
"
FAST_COMPILE"
-
python-version
:
"
3.11"
float32
:
1
-
fast-compile
:
1
float32
:
1
include
:
include
:
-
os
:
"
ubuntu-latest"
-
part
:
[
"
doctests"
,
"
--doctest-modules
pytensor
--ignore=pytensor/misc/check_duplicate_key.py
--ignore=pytensor/link
--ignore=pytensor/ipython.py"
]
part
:
"
--doctest-modules
pytensor
--ignore=pytensor/misc/check_duplicate_key.py
--ignore=pytensor/link
--ignore=pytensor/ipython.py
"
default-mode
:
"
C
"
python-version
:
"
3.12"
python-version
:
"
3.12"
fast-compile
:
0
float32
:
0
install-numba
:
0
install-jax
:
0
install-torch
:
0
install-mlx
:
0
install-xarray
:
0
-
install-numba
:
1
os
:
"
ubuntu-latest"
os
:
"
ubuntu-latest"
python-version
:
"
3.11"
-
part
:
[
"
numba
link"
,
"
tests/link/numba
--ignore=tests/link/numba/test_slinalg.py"
]
fast-compile
:
0
default-mode
:
"
C"
float32
:
0
python-version
:
"
3.12"
part
:
"
tests/link/numba
--ignore=tests/link/numba/test_slinalg.py"
-
install-numba
:
1
os
:
"
ubuntu-latest"
os
:
"
ubuntu-latest"
python-version
:
"
3.14"
-
part
:
[
"
numba
link
slinalg"
,
"
tests/link/numba/test_slinalg.py"
]
fast-compile
:
0
default-mode
:
"
C"
float32
:
0
python-version
:
"
3.13"
part
:
"
tests/link/numba
--ignore=tests/link/numba/test_slinalg.py"
-
install-numba
:
1
os
:
"
ubuntu-latest"
os
:
"
ubuntu-latest"
-
part
:
[
"
jax
link"
,
"
tests/link/jax"
]
install-jax
:
1
default-mode
:
"
C"
python-version
:
"
3.14"
python-version
:
"
3.14"
fast-compile
:
0
float32
:
0
part
:
"
tests/link/numba/test_slinalg.py"
-
install-jax
:
1
os
:
"
ubuntu-latest"
os
:
"
ubuntu-latest"
-
part
:
[
"
pytorch
link"
,
"
tests/link/pytorch"
]
install-torch
:
1
default-mode
:
"
C"
python-version
:
"
3.11"
python-version
:
"
3.11"
fast-compile
:
0
float32
:
0
part
:
"
tests/link/jax"
-
install-jax
:
1
os
:
"
ubuntu-latest"
os
:
"
ubuntu-latest"
-
part
:
[
"
xtensor"
,
"
tests/xtensor"
]
install-xarray
:
1
default-mode
:
"
C"
python-version
:
"
3.14"
python-version
:
"
3.14"
fast-compile
:
0
float32
:
0
part
:
"
tests/link/jax"
-
install-torch
:
1
os
:
"
ubuntu-latest"
os
:
"
ubuntu-latest"
python-version
:
"
3.11"
-
part
:
[
"
mlx
link"
,
"
tests/link/mlx"
]
fast-compile
:
0
float32
:
0
part
:
"
tests/link/pytorch"
-
install-xarray
:
1
os
:
"
ubuntu-latest"
python-version
:
"
3.14"
fast-compile
:
0
float32
:
0
part
:
"
tests/xtensor"
-
os
:
"
macos-15"
python-version
:
"
3.11"
fast-compile
:
0
float32
:
0
install-mlx
:
1
install-mlx
:
1
install-numba
:
0
default-mode
:
"
C"
install-jax
:
0
python-version
:
"
3.11"
install-torch
:
0
os
:
"
macos-15"
part
:
"
tests/link/mlx"
-
part
:
[
"
macos
smoke
test"
,
"
tests/tensor/test_elemwise.py
tests/tensor/test_math_scipy.py
tests/tensor/test_blas.py"
]
-
os
:
"
macos-15
"
default-mode
:
"
C
"
python-version
:
"
3.14"
python-version
:
"
3.14"
fast-compile
:
0
os
:
"
macos-15"
float32
:
0
install-numba
:
0
install-jax
:
0
install-torch
:
0
part
:
"
tests/tensor/test_elemwise.py
tests/tensor/test_math_scipy.py
tests/tensor/test_blas.py"
steps
:
steps
:
-
uses
:
actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
# v5.0.0
-
uses
:
actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
# v5.0.0
...
@@ -199,11 +160,10 @@ jobs:
...
@@ -199,11 +160,10 @@ jobs:
run
:
|
run
:
|
if [[ $OS == "macos-15" ]]; then
if [[ $OS == "macos-15" ]]; then
micromamba install --yes -q "python~=${PYTHON_VERSION}"
"numpy${NUMPY_VERSION}" scipy
pip graphviz cython pytest coverage pytest-cov pytest-benchmark pytest-mock pytest-sphinx libblas=*=*accelerate;
micromamba install --yes -q "python~=${PYTHON_VERSION}"
numpy scipy "numba>=0.63"
pip graphviz cython pytest coverage pytest-cov pytest-benchmark pytest-mock pytest-sphinx libblas=*=*accelerate;
else
else
micromamba install --yes -q "python~=${PYTHON_VERSION}"
mkl "numpy${NUMPY_VERSION}" scipy pip mkl-service graphviz cython pytest coverage pytest-cov pytest-benchmark pytest-mock pytest-sphinx
;
micromamba install --yes -q "python~=${PYTHON_VERSION}"
numpy scipy "numba>=0.63" pip graphviz cython pytest coverage pytest-cov pytest-benchmark pytest-mock pytest-sphinx mkl mkl-service
;
fi
fi
if [[ $INSTALL_NUMBA == "1" ]]; then pip install "numba>=0.63"; fi
if [[ $INSTALL_JAX == "1" ]]; then micromamba install --yes -q -c conda-forge "python~=${PYTHON_VERSION}" jax jaxlib numpyro equinox && pip install tfp-nightly; fi
if [[ $INSTALL_JAX == "1" ]]; then micromamba install --yes -q -c conda-forge "python~=${PYTHON_VERSION}" jax jaxlib numpyro equinox && pip install tfp-nightly; fi
if [[ $INSTALL_TORCH == "1" ]]; then micromamba install --yes -q -c conda-forge "python~=${PYTHON_VERSION}" pytorch pytorch-cuda=12.1 "mkl<=2024.0" -c pytorch -c nvidia; fi
if [[ $INSTALL_TORCH == "1" ]]; then micromamba install --yes -q -c conda-forge "python~=${PYTHON_VERSION}" pytorch pytorch-cuda=12.1 "mkl<=2024.0" -c pytorch -c nvidia; fi
if [[ $INSTALL_MLX == "1" ]]; then micromamba install --yes -q -c conda-forge "python~=${PYTHON_VERSION}" "mlx<0.29.4"; fi
if [[ $INSTALL_MLX == "1" ]]; then micromamba install --yes -q -c conda-forge "python~=${PYTHON_VERSION}" "mlx<0.29.4"; fi
...
@@ -219,9 +179,8 @@ jobs:
...
@@ -219,9 +179,8 @@ jobs:
fi
fi
env
:
env
:
PYTHON_VERSION
:
${{ matrix.python-version }}
PYTHON_VERSION
:
${{ matrix.python-version }}
INSTALL_NUMBA
:
${{ matrix.install-numba }}
INSTALL_JAX
:
${{ matrix.install-jax }}
INSTALL_JAX
:
${{ matrix.install-jax }}
INSTALL_TORCH
:
${{ matrix.install-torch}}
INSTALL_TORCH
:
${{ matrix.install-torch
}}
INSTALL_XARRAY
:
${{ matrix.install-xarray }}
INSTALL_XARRAY
:
${{ matrix.install-xarray }}
INSTALL_MLX
:
${{ matrix.install-mlx }}
INSTALL_MLX
:
${{ matrix.install-mlx }}
OS
:
${{ matrix.os}}
OS
:
${{ matrix.os}}
...
@@ -229,8 +188,8 @@ jobs:
...
@@ -229,8 +188,8 @@ jobs:
-
name
:
Run tests
-
name
:
Run tests
shell
:
micromamba-shell {0}
shell
:
micromamba-shell {0}
run
:
|
run
:
|
if [[ $
FAST_COMPILE == "1
" ]]; then export PYTENSOR_FLAGS=$PYTENSOR_FLAGS,mode=FAST_COMPILE; fi
if [[ $
DEFAULT_MODE == "FAST_COMPILE
" ]]; then export PYTENSOR_FLAGS=$PYTENSOR_FLAGS,mode=FAST_COMPILE; fi
if [[ $
FLOAT32 == "1" ]]; then export PYTENSOR_FLAGS=$PYTENSOR_FLAGS,floatX=float32
; fi
if [[ $
DEFAULT_MODE == "NUMBA" ]]; then export PYTENSOR_FLAGS=$PYTENSOR_FLAGS,linker=numba
; fi
export PYTENSOR_FLAGS=$PYTENSOR_FLAGS,warn__ignore_bug_before=all,on_opt_error=raise,on_shape_error=raise,gcc__cxxflags=-pipe
export PYTENSOR_FLAGS=$PYTENSOR_FLAGS,warn__ignore_bug_before=all,on_opt_error=raise,on_shape_error=raise,gcc__cxxflags=-pipe
python -m pytest -r A --verbose --runslow --durations=50 --cov=pytensor/ --cov-report=xml:coverage/coverage-${MATRIX_ID}.xml --no-cov-on-fail $PART --benchmark-skip
python -m pytest -r A --verbose --runslow --durations=50 --cov=pytensor/ --cov-report=xml:coverage/coverage-${MATRIX_ID}.xml --no-cov-on-fail $PART --benchmark-skip
env
:
env
:
...
@@ -238,9 +197,8 @@ jobs:
...
@@ -238,9 +197,8 @@ jobs:
MKL_THREADING_LAYER
:
GNU
MKL_THREADING_LAYER
:
GNU
MKL_NUM_THREADS
:
1
MKL_NUM_THREADS
:
1
OMP_NUM_THREADS
:
1
OMP_NUM_THREADS
:
1
PART
:
${{ matrix.part }}
PART
:
${{ matrix.part[1] }}
FAST_COMPILE
:
${{ matrix.fast-compile }}
DEFAULT_MODE
:
${{ matrix.default-mode }}
FLOAT32
:
${{ matrix.float32 }}
-
name
:
Upload coverage file
-
name
:
Upload coverage file
uses
:
actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
# v4.6.2
uses
:
actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
# v4.6.2
...
...
tests/compile/test_mode.py
浏览文件 @
e64816d0
...
@@ -77,9 +77,18 @@ class TestBunchOfModes:
...
@@ -77,9 +77,18 @@ class TestBunchOfModes:
# Linkers to use with regular Mode
# Linkers to use with regular Mode
if
config
.
cxx
:
if
config
.
cxx
:
linkers
=
[
"py"
,
"c|py"
,
"c|py_nogc"
,
"vm"
,
"vm_nogc"
,
"cvm"
,
"cvm_nogc"
]
linkers
=
[
"py"
,
"c|py"
,
"c|py_nogc"
,
"vm"
,
"vm_nogc"
,
"cvm"
,
"cvm_nogc"
,
"numba"
,
]
else
:
else
:
linkers
=
[
"py"
,
"c|py"
,
"c|py_nogc"
,
"vm"
,
"vm_nogc"
]
linkers
=
[
"py"
,
"c|py"
,
"c|py_nogc"
,
"vm"
,
"vm_nogc"
,
"numba"
]
modes
=
predef_modes
+
[
Mode
(
linker
,
"fast_run"
)
for
linker
in
linkers
]
modes
=
predef_modes
+
[
Mode
(
linker
,
"fast_run"
)
for
linker
in
linkers
]
for
mode
in
modes
:
for
mode
in
modes
:
...
@@ -93,11 +102,12 @@ class TestBunchOfModes:
...
@@ -93,11 +102,12 @@ class TestBunchOfModes:
# regression check:
# regression check:
# there should be
# there should be
# - NumbaLinker
# - `VMLinker`
# - `VMLinker`
# - OpWiseCLinker (FAST_RUN)
# - OpWiseCLinker (FAST_RUN)
# - PerformLinker (FAST_COMPILE)
# - PerformLinker (FAST_COMPILE)
# - DebugMode's Linker (DEBUG_MODE)
# - DebugMode's Linker (DEBUG_MODE)
assert
4
==
len
(
set
(
linker_classes_involved
))
assert
5
==
len
(
set
(
linker_classes_involved
))
class
TestOldModesProblem
:
class
TestOldModesProblem
:
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论