提交 e3c95974 authored 作者: Frédéric Bastien's avatar Frédéric Bastien 提交者: GitHub

Merge pull request #6472 from nouiz/user_err

Add good user error in corner case that are hard to debug.
......@@ -110,14 +110,12 @@ script:
- free -m
- df -h
- ulimit -a
# Move out of Theano so the import will use the installed version
- cd ..
# Move to the path of the installed version
- cd $(python -c 'import theano; import os; print(os.path.split(theano.__file__)[0])')
- echo "$PART"
- cd -; cd Theano
# Print information to help debug problems
- python -c 'import theano; print(theano.__version__)'
- python -c 'import theano; print(theano.config.__str__(print_doc=False))'
- python -c 'import theano; assert(theano.config.blas.ldflags != "")'
# Run tests for the given part
- theano-nose -v --with-timer --timer-top-n 10 $PART
- if [[ $DOC == "1" ]]; then python doc/scripts/docgen.py --nopdf --check; fi
- if [[ $DOC == "1" ]]; then python doc/scripts/docgen.py --test --check; fi
......
......@@ -37,7 +37,7 @@ Update the year in the ``Theano/LICENSE.txt`` file too, if necessary.
``NEWS.txt`` usually contains the name and date of the release, change them
too.
Update the fallback version in ``setup.py``.
Update the fallback version in ``theano/version.py``.
Update the code and the documentation for the theano flags
``warn.ignore_bug_before`` to accept the new version. You must modify the
......
......@@ -16,8 +16,6 @@ except ImportError:
import versioneer
FALLBACK_VERSION="0.10.0beta3+unknown"
CLASSIFIERS = """\
Development Status :: 4 - Beta
Intended Audience :: Education
......@@ -74,6 +72,16 @@ def find_packages(where='.', exclude=()):
version_data = versioneer.get_versions()
if version_data['error'] is not None:
# Get the fallback version
# We can't import theano.version as it isn't yet installed, so parse it.
fname = os.path.join(os.path.split(__file__)[0], "theano", "version.py")
with open(fname, "r") as f:
lines = f.readlines()
lines = [l for l in lines if l.startswith("FALLBACK_VERSION")]
assert len(lines) == 1
FALLBACK_VERSION = lines[0].split("=")[1].strip().strip('""')
version_data['version'] = FALLBACK_VERSION
......
......@@ -245,7 +245,3 @@ def sparse_grad(var):
__import__('theano.tensor.shared_randomstreams')
from ._version import get_versions
__version__ = get_versions()['version']
del get_versions
......@@ -1897,7 +1897,10 @@ class GCC_compiler(Compiler):
@staticmethod
def compile_args(march_flags=True):
cxxflags = [flag for flag in config.gcc.cxxflags.split(' ') if flag]
if "-fopenmp" in cxxflags:
raise ValueError(
"Do not use -fopenmp in Theano flag gcc.cxxflags."
" To enable OpenMP, use the Theano flag openmp=True")
# Add the equivalent of -march=native flag. We can't use
# -march=native as when the compiledir is shared by multiple
# computers (for example, if the home directory is on NFS), this
......
......@@ -222,10 +222,16 @@ def dnn_available(context_name):
# This is a hack because bin_id is in the from of
# "<something>_<major><minor>" for cuda devices.
if ctx.bin_id[-2:] < b'30':
if int(ctx.bin_id[-2:]) < 30:
dnn_available.msg = "Device not supported"
return False
# On V100, cuDNN lower then 7002 don't raise error but
# takes hours to load or execute! So raise a good user error.
if version() < 7002:
if int(ctx.bin_id[-2:]) >= 70:
dnn_available.msg = "Use cuDNN 7.0.2 or higher for Volta."
return False
return True
dnn_available.msg = None
......
......@@ -2,24 +2,28 @@ from __future__ import absolute_import, print_function, division
from theano._version import get_versions
FALLBACK_VERSION = "0.10.0beta3+unknown"
info = get_versions()
if info['error'] is not None:
info['version'] = FALLBACK_VERSION
full_version = info['version']
git_revision = info['full-revisionid']
del info, get_versions
del get_versions
short_version = full_version.split('+')[0]
# This tries to catch a tag like beta2, rc1, ...
try:
int(short_version.split('.')[2])
release = True
except ValueError:
release = False
except IndexError:
print(short_version)
raise
if release:
if release and info['error'] is None:
version = short_version
else:
version = full_version
del info
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论