Python 当使用@,eventhough数组连续时,numba会引发性能警告

Python 当使用@,eventhough数组连续时,numba会引发性能警告,python,performance,numpy,pytest,numba,Python,Performance,Numpy,Pytest,Numba,我在Fortran数组的一列和C数组的一行之间做了一个简单的点积(因此这两个数组在内存中是连续的) 然而,我得到一个警告: ➜ tests/ ✗ pytest test_numba.py ============================================================= test session starts ============================================================= platform li

我在Fortran数组的一列和C数组的一行之间做了一个简单的点积(因此这两个数组在内存中是连续的)

然而,我得到一个警告:

➜  tests/ ✗ pytest test_numba.py
============================================================= test session starts =============================================================
platform linux -- Python 3.6.6, pytest-4.0.2, py-1.5.3, pluggy-0.7.1
rootdir: /home, inifile:
plugins: cov-2.6.0
collected 1 item                                                                                                                              

test_numba.py .                                                                                                                         [100%]

============================================================== warnings summary ===============================================================
tests/test_numba.py::test_warning
  /home/test_numba.py:11: PerformanceWarning: '@' is faster on contiguous arrays, called on (array(float64, 2d, A), array(float64, 2d, A))
    X[:, 0:1] @ B[0:1, :]
  /home/me/anaconda3/lib/python3.6/site-packages/numba/typing/npydecl.py:965: PerformanceWarning: '@' is faster on contiguous arrays, called on (array(float64, 2d, A), array(float64, 2d, A))
    % (self.func_name, (a, b)), PerformanceWarning)

-- Docs: https://docs.pytest.org/en/latest/warnings.html
==================================================== 1 passed, 2 warnings in 0.69 seconds ==========================
此外,只有通过pytest运行测试时,才会出现警告: 直接在python shell中运行
do_dot()
,不会引发任何警告

原因可能是什么


编辑:numba版本是0.41.0

什么版本的numba?也许pytest指向的是与您直接运行的python不同的版本?我不认为它与
pytest
有什么特别的关系
pytest
只发出它遇到的所有警告,这意味着
numba
也应该吐出它。您是否尝试使用
NUMBA\u WARNINGS=1
运行代码,警告是否在正常代码执行时打印?回答我自己的问题-在运行垃圾邮件导入do\u dot;do\u dot()中的
NUMBA\u WARNINGS=1 python-c”时打印警告
。问题在于函数本身,而不是测试-很可能是
numba
在转换为自己的数组时重新调整numpy数组。@hoefling谢谢,我想测试自己,但无法通过.numba\u config设置numba\u警告,我在这里等待答案:@hoefling这回答了我问题的一半,但为什么我得到了su是否在阵列连续时发出警告?
➜  tests/ ✗ pytest test_numba.py
============================================================= test session starts =============================================================
platform linux -- Python 3.6.6, pytest-4.0.2, py-1.5.3, pluggy-0.7.1
rootdir: /home, inifile:
plugins: cov-2.6.0
collected 1 item                                                                                                                              

test_numba.py .                                                                                                                         [100%]

============================================================== warnings summary ===============================================================
tests/test_numba.py::test_warning
  /home/test_numba.py:11: PerformanceWarning: '@' is faster on contiguous arrays, called on (array(float64, 2d, A), array(float64, 2d, A))
    X[:, 0:1] @ B[0:1, :]
  /home/me/anaconda3/lib/python3.6/site-packages/numba/typing/npydecl.py:965: PerformanceWarning: '@' is faster on contiguous arrays, called on (array(float64, 2d, A), array(float64, 2d, A))
    % (self.func_name, (a, b)), PerformanceWarning)

-- Docs: https://docs.pytest.org/en/latest/warnings.html
==================================================== 1 passed, 2 warnings in 0.69 seconds ==========================