提交 f40bb97f authored 作者: cai-lw's avatar cai-lw

Decoding nvcc outputs in correct encoding.

上级 2fe88f36
...@@ -44,6 +44,9 @@ if PY3: ...@@ -44,6 +44,9 @@ if PY3:
def decode_iter(itr): def decode_iter(itr):
for x in itr: for x in itr:
yield x.decode() yield x.decode()
def decode_with(x, encoding):
return x.decode(encoding)
else: else:
from six import get_unbound_function from six import get_unbound_function
from operator import div as operator_div from operator import div as operator_div
...@@ -63,6 +66,9 @@ else: ...@@ -63,6 +66,9 @@ else:
def decode_iter(x): def decode_iter(x):
return x return x
def decode_with(x, encoding):
return x
__all__ += ['cmp', 'operator_div', 'DictMixin', 'OrderedDict', 'decode', __all__ += ['cmp', 'operator_div', 'DictMixin', 'OrderedDict', 'decode',
'decode_iter', 'get_unbound_function', 'imap', 'izip', 'ifilter'] 'decode_iter', 'get_unbound_function', 'imap', 'izip', 'ifilter']
......
...@@ -9,7 +9,7 @@ import warnings ...@@ -9,7 +9,7 @@ import warnings
import numpy import numpy
from theano import config from theano import config
from theano.compat import decode, decode_iter from theano.compat import decode, decode_with
from theano.configdefaults import local_bitwidth from theano.configdefaults import local_bitwidth
from theano.gof.utils import hash_from_file from theano.gof.utils import hash_from_file
from theano.gof.cmodule import (std_libs, std_lib_dirs, from theano.gof.cmodule import (std_libs, std_lib_dirs,
...@@ -357,7 +357,9 @@ class NVCC_compiler(Compiler): ...@@ -357,7 +357,9 @@ class NVCC_compiler(Compiler):
os.chdir(location) os.chdir(location)
p = subprocess.Popen( p = subprocess.Popen(
cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
nvcc_stdout, nvcc_stderr = decode_iter(p.communicate()[:2]) nvcc_stdout, nvcc_stderr = p.communicate()[:2]
nvcc_stdout = decode_with(nvcc_stdout, p.stdout.encoding)
nvcc_stderr = decode_with(nvcc_stderr, p.stderr.encoding)
finally: finally:
os.chdir(orig_dir) os.chdir(orig_dir)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论