提交 8ebe5708 authored 作者: Frederic's avatar Frederic

When calling subprocess.Popen on windows, don't open command line windows.

上级 6ef19365
......@@ -6,6 +6,7 @@ from theano.configparser import (
AddConfigVar, BoolParam, ConfigParam, EnumStr, IntParam,
TheanoConfigParser)
from theano.misc.cpucount import cpuCount
from theano.misc.windows import call_subprocess_Popen
_logger = logging.getLogger('theano.configdefaults')
......@@ -99,7 +100,8 @@ enum = EnumStr("g++", "")
# in an unusual Python 2.4.4 Windows environment with the default stdin=None.
dummy_stdin = open(os.devnull)
try:
subprocess.Popen('g++', stdout=subprocess.PIPE, stderr=subprocess.PIPE,
call_subprocess_Popen('g++', stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
stdin=dummy_stdin.fileno())
# Keep the default linker the same as the one for the mode FAST_RUN
AddConfigVar('linker',
......
......@@ -22,6 +22,7 @@ import theano
from theano.gof.utils import flatten
from theano.configparser import config
from theano.gof.cc import hash_from_code
from theano.misc.windows import call_subprocess_Popen
# we will abuse the lockfile mechanism when reading and writing the registry
import compilelock
......@@ -1592,7 +1593,7 @@ class GCC_compiler(object):
print >> sys.stderr, ' '.join(cmd)
try:
p = subprocess.Popen(cmd, stderr=subprocess.PIPE)
p = call_subprocess_Popen(cmd, stderr=subprocess.PIPE)
compile_stderr = p.communicate()[1]
except Exception:
# An exception can occur e.g. if `g++` is not found.
......
......@@ -3,8 +3,8 @@ import errno
import os
import platform
import re
import subprocess
import shutil
import subprocess
import sys
import textwrap
......@@ -13,6 +13,7 @@ import numpy
import theano
from theano.configparser import config, AddConfigVar, ConfigParam, StrParam
from theano.gof.utils import flatten
from theano.misc.windows import call_subprocess_Popen
# Using the dummy file descriptors below is a workaround for a crash
# experienced in an unusual Python 2.4.4 Windows environment with the default
......@@ -21,8 +22,10 @@ dummy_in = open(os.devnull)
dummy_err = open(os.devnull, 'w')
p = None
try:
p = subprocess.Popen(['g++', '-dumpversion'], stdout=subprocess.PIPE,
stdin=dummy_in.fileno(), stderr=dummy_err.fileno())
p = call_subprocess_Popen(['g++', '-dumpversion'],
stdout=subprocess.PIPE,
stdin=dummy_in.fileno(),
stderr=dummy_err.fileno())
p.wait()
gcc_version_str = p.stdout.readline().strip()
except OSError:
......
......@@ -20,6 +20,7 @@ import warnings
import theano
from theano import config
from theano.misc.windows import call_subprocess_Popen
import cc
import graph
......@@ -788,7 +789,7 @@ class OpenMPOp(Op):
os.write(fd, code)
os.close(fd)
fd = None
proc = subprocess.Popen(['g++', '-fopenmp', path],
proc = call_subprocess_Popen(['g++', '-fopenmp', path],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
stdin=dummy_stdin.fileno())
......
......@@ -15,6 +15,7 @@ from theano.gof.cmodule import (std_libs, std_lib_dirs,
std_include_dirs, dlimport,
get_lib_extension, local_bitwidth)
from theano.gof.python25 import any
from theano.misc.windows import call_subprocess_Popen
_logger = logging.getLogger("theano.sandbox.cuda.nvcc_compiler")
_logger.setLevel(logging.WARN)
......@@ -64,7 +65,8 @@ nvcc_version = None
def is_nvcc_available():
"""Return True iff the nvcc compiler is found."""
def set_version():
p = subprocess.Popen([nvcc_path, '--version'], stdout=subprocess.PIPE,
p = call_subprocess_Popen([nvcc_path, '--version'],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
p.wait()
s = p.stdout.readlines()[-1].split(',')[1].strip().split()
......
......@@ -60,6 +60,7 @@ import subprocess
import sys
import datetime
import theano
from theano.misc.windows import call_subprocess_Popen
def main(stdout=None, stderr=None, argv=None, theano_nose=None,
......@@ -264,7 +265,7 @@ def run(stdout, stderr, argv, theano_nose, batch_size, time_profile,
data["ids"][test_id]))
f_rawlog.flush()
proc = subprocess.Popen(
proc = call_subprocess_Popen(
([python, theano_nose, '-v', '--with-id']
+ [str(test_id)] + argv +
['--disabdocstring']),
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论