提交 20d8637e authored 作者: Frédéric Bastien's avatar Frédéric Bastien

Merge pull request #4235 from cai-lw/fix2

Decoding nvcc outputs in correct encoding.
......@@ -44,6 +44,9 @@ if PY3:
def decode_iter(itr):
for x in itr:
yield x.decode()
def decode_with(x, encoding):
return x.decode(encoding)
else:
from six import get_unbound_function
from operator import div as operator_div
......@@ -63,6 +66,9 @@ else:
def decode_iter(x):
return x
def decode_with(x, encoding):
return x
__all__ += ['cmp', 'operator_div', 'DictMixin', 'OrderedDict', 'decode',
'decode_iter', 'get_unbound_function', 'imap', 'izip', 'ifilter']
......
......@@ -5,11 +5,12 @@ import os
import subprocess
import sys
import warnings
from locale import getpreferredencoding
import numpy
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.gof.utils import hash_from_file
from theano.gof.cmodule import (std_libs, std_lib_dirs,
......@@ -359,7 +360,10 @@ class NVCC_compiler(Compiler):
os.chdir(location)
p = subprocess.Popen(
cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
nvcc_stdout, nvcc_stderr = decode_iter(p.communicate()[:2])
nvcc_stdout_raw, nvcc_stderr_raw = p.communicate()[:2]
console_encoding = getpreferredencoding()
nvcc_stdout = decode_with(nvcc_stdout_raw, console_encoding)
nvcc_stderr = decode_with(nvcc_stderr_raw, console_encoding)
finally:
os.chdir(orig_dir)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论