提交 0d34af2e authored 作者: Brandon T. Willard's avatar Brandon T. Willard 提交者: Brandon T. Willard

Fix mkl warning in default_blas_ldflags

上级 d660ea78
""" """
Test config options. Test config options.
""" """
import logging
from unittest.mock import patch
from theano.configdefaults import default_blas_ldflags
from theano.configparser import THEANO_FLAGS_DICT, AddConfigVar, ConfigParam from theano.configparser import THEANO_FLAGS_DICT, AddConfigVar, ConfigParam
class TestConfig: def test_invalid_default():
def test_invalid_default(self):
# Ensure an invalid default value found in the Theano code only causes # Ensure an invalid default value found in the Theano code only causes
# a crash if it is not overridden by the user. # a crash if it is not overridden by the user.
...@@ -43,3 +45,16 @@ class TestConfig: ...@@ -43,3 +45,16 @@ class TestConfig:
assert "T_config.test_invalid_default_b" not in THEANO_FLAGS_DICT assert "T_config.test_invalid_default_b" not in THEANO_FLAGS_DICT
# TODO We should remove these dummy options on test exit. # TODO We should remove these dummy options on test exit.
@patch("theano.configdefaults.try_blas_flag", return_value=None)
@patch("theano.configdefaults.sys")
def test_default_blas_ldflags(sys_mock, try_blas_flag_mock, caplog):
sys_mock.version = "3.8.0 | packaged by conda-forge | (default, Nov 22 2019, 19:11:38) \n[GCC 7.3.0]"
with patch.dict("sys.modules", {"mkl": None}):
with caplog.at_level(logging.WARNING):
default_blas_ldflags()
assert "install mkl with" in caplog.text
...@@ -1835,7 +1835,7 @@ def default_blas_ldflags(): ...@@ -1835,7 +1835,7 @@ def default_blas_ldflags():
# the fallback and test -lblas could give slow computation, so # the fallback and test -lblas could give slow computation, so
# warn about this. # warn about this.
for warn in warn_record: for warn in warn_record:
_logger.warning(*warn) _logger.warning(warn)
del warn_record del warn_record
# Some environment don't have the lib dir in LD_LIBRARY_PATH. # Some environment don't have the lib dir in LD_LIBRARY_PATH.
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论