• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python windows.call_subprocess_Popen函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中theano.misc.windows.call_subprocess_Popen函数的典型用法代码示例。如果您正苦于以下问题:Python call_subprocess_Popen函数的具体用法?Python call_subprocess_Popen怎么用?Python call_subprocess_Popen使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了call_subprocess_Popen函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: set_version

 def set_version():
     p = call_subprocess_Popen([nvcc_path, '--version'],
                               stdout=subprocess.PIPE,
                               stderr=subprocess.PIPE)
     p.wait()
     s = p.stdout.readlines()[-1].split(',')[1].strip().split()
     assert s[0] == 'release'
     global nvcc_version
     nvcc_version = s[1]
开发者ID:jmarinero,项目名称:Theano,代码行数:9,代码来源:nvcc_compiler.py


示例2: set_version

    def set_version():
        p = call_subprocess_Popen([nvcc_path, '--version'],
                                  stdout=subprocess.PIPE,
                                  stderr=subprocess.PIPE)
        p.wait()

        ver_line = decode(p.stdout.readlines()[-1])
        build, version = ver_line.split(',')[1].strip().split()

        assert build == 'release'
        global nvcc_version
        nvcc_version = version
开发者ID:bayerj,项目名称:Theano,代码行数:12,代码来源:nvcc_compiler.py


示例3: test_gxx_support

    def test_gxx_support():
        default_openmp = True
        try:
            code = """
            #include <omp.h>
    int main( int argc, const char* argv[] )
    {
            int res[10];

            for(int i=0; i < 10; i++){
                res[i] = i;
            }
    }
            """
            fd, path = tempfile.mkstemp(suffix='.c', prefix='test_omp_')
            dummy_stdin = open(os.devnull)
            try:
                os.write(fd, code)
                os.close(fd)
                fd = None
                proc = call_subprocess_Popen(['g++', '-fopenmp', path],
                                             stdout=subprocess.PIPE,
                                             stderr=subprocess.PIPE,
                                             stdin=dummy_stdin.fileno())
                proc.wait()
                if proc.returncode != 0:
                    default_openmp = False
            finally:
                del dummy_stdin
                # Ensure `fd` is closed before we remove the temporary file.
                try:
                    if fd is not None:
                        os.close(fd)
                finally:
                    os.remove(path)
        except OSError, e:
            return False
开发者ID:gitaccount2,项目名称:Theano,代码行数:37,代码来源:op.py


示例4: AddConfigVar

# The way to get FAST_RUN_NOGC is with the flag 'linker=c|py_nogc'.
# The old all capital letter way of working is deprecated as it is not
# scalable.
# Also, please be careful not to modify the first item in the enum when adding
# new modes, since it is the default mode.
AddConfigVar('mode',
        "Default compilation mode",
        EnumStr('Mode', 'ProfileMode', 'DebugMode', 'FAST_RUN',
                'FAST_COMPILE', 'PROFILE_MODE', 'DEBUG_MODE'),
        in_c_key=False)

enum = EnumStr("g++", "")

# Test whether or not g++ is present: disable C code if it is not.
try:
    rc = call_subprocess_Popen(['g++', '-v'])
except OSError:
    enum = EnumStr("")
    rc = 1
AddConfigVar('cxx',
             "The C++ compiler to use. Currently only g++ is"
             " supported, but supporting additional compilers should not be "
             "too difficult. "
             "If it is empty, no C++ code is compiled.",
             enum,
             in_c_key=False)
del enum

if rc == 0 and config.cxx != "":
    # Keep the default linker the same as the one for the mode FAST_RUN
    AddConfigVar('linker',
开发者ID:AlexArgus,项目名称:Theano,代码行数:31,代码来源:configdefaults.py


示例5: AddConfigVar

AddConfigVar('mode',
        "Default compilation mode",
        EnumStr('Mode', 'ProfileMode', 'DebugMode', 'FAST_RUN',
                'FAST_COMPILE', 'PROFILE_MODE', 'DEBUG_MODE'),
        in_c_key=False)

enum = EnumStr("g++", "")

# Test whether or not g++ is present: disable C code if it is not.
# Using the dummy file descriptor below is a workaround for a crash experienced
# in an unusual Python 2.4.4 Windows environment with the default stdin=None.
dummy_stdin = open(os.devnull)
try:
    try:
        rc = call_subprocess_Popen(['g++', '-v'], stdout=subprocess.PIPE,
                                   stderr=subprocess.PIPE,
                                   stdin=dummy_stdin).wait()
    except OSError:
        rc = 1
finally:
    dummy_stdin.close()
    del dummy_stdin
if rc == 0:
    # Keep the default linker the same as the one for the mode FAST_RUN
    AddConfigVar('linker',
                 ("Default linker used if the theano flags mode is Mode "
                  "or ProfileMode"),
                 EnumStr('cvm', 'c|py', 'py', 'c', 'c|py_nogc', 'c&py',
                     'vm', 'vm_nogc', 'cvm_nogc'),
                 in_c_key=False)
else:
开发者ID:lukastencer,项目名称:Theano,代码行数:31,代码来源:configdefaults.py


示例6: open

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
# None values.
dummy_in = open(os.devnull)
dummy_err = open(os.devnull, 'w')
p = None
try:
    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:
    # Typically means gcc cannot be found.
    gcc_version_str = 'GCC_NOT_FOUND'
del p
del dummy_in
del dummy_err

compiledir_format_dict = {"platform": platform.platform(),
                          "processor": platform.processor(),
                          "python_version": platform.python_version(),
                          "theano_version": theano.__version__,
                          "numpy_version": numpy.__version__,
开发者ID:gitaccount2,项目名称:Theano,代码行数:32,代码来源:compiledir.py


示例7: EnumStr

    "mode",
    "Default compilation mode",
    EnumStr("Mode", "ProfileMode", "DebugMode", "FAST_RUN", "FAST_COMPILE", "PROFILE_MODE", "DEBUG_MODE"),
    in_c_key=False,
)

enum = EnumStr("g++", "")

# Test whether or not g++ is present: disable C code if it is not.
# Using the dummy file descriptor below is a workaround for a crash experienced
# in an unusual Python 2.4.4 Windows environment with the default stdin=None.
dummy_stdin = open(os.devnull)
try:
    try:
        rc = call_subprocess_Popen(
            ["g++", "-v"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=dummy_stdin
        ).wait()
    except OSError:
        rc = 1
finally:
    dummy_stdin.close()
    del dummy_stdin
if rc == 0:
    # Keep the default linker the same as the one for the mode FAST_RUN
    AddConfigVar(
        "linker",
        ("Default linker used if the theano flags mode is Mode " "or ProfileMode"),
        EnumStr("cvm", "c|py", "py", "c", "c|py_nogc", "c&py", "vm", "vm_nogc", "cvm_nogc"),
        in_c_key=False,
    )
else:
开发者ID:igul222,项目名称:Theano,代码行数:31,代码来源:configdefaults.py


示例8: run


#.........这里部分代码省略.........
                if s in word:
                    return pos

        # finds last word of list l containing string s
        def getIndexOfLast(l, s):
            for pos, word in enumerate(reversed(l)):
                if s in word:
                    return len(l) - pos - 1

        # iterating through tests
        # initializing master profiling list and raw log
        prof_master_nosort = []
        prof_rawlog = []
        dummy_out = open(os.devnull, "w")
        path_rawlog = os.path.join(sav_dir, "timeprof_rawlog")
        stamp = str(datetime.datetime.now()) + "\n\n"
        f_rawlog = open(path_rawlog, "w")
        f_rawlog.write("TIME-PROFILING OF THEANO'S NOSETESTS" " (raw log)\n\n" + stamp)
        f_rawlog.flush()

        stamp = str(datetime.datetime.now()) + "\n\n"
        fields = "Fields: computation time; nosetests sequential id;" " test name; parent class (if any); outcome\n\n"
        path_nosort = os.path.join(sav_dir, "timeprof_nosort")
        f_nosort = open(path_nosort, "w")
        f_nosort.write("TIME-PROFILING OF THEANO'S NOSETESTS" " (by sequential id)\n\n" + stamp + fields)
        f_nosort.flush()
        for test_floor in xrange(1, n_tests + 1, batch_size):
            for test_id in xrange(test_floor, min(test_floor + batch_size, n_tests + 1)):
                # Print the test we will start in the raw log to help
                # debug tests that are too long.
                f_rawlog.write("\n%s Will run test #%d %s\n" % (time.ctime(), test_id, data["ids"][test_id]))
                f_rawlog.flush()

                proc = call_subprocess_Popen(
                    ([python, theano_nose, "-v", "--with-id"] + [str(test_id)] + argv + ["--disabdocstring"]),
                    # the previous option calls a custom Nosetests plugin
                    # precluding automatic sustitution of doc. string for
                    # test name in display
                    # (see class 'DisabDocString' in file theano-nose)
                    stderr=subprocess.PIPE,
                    stdout=dummy_out.fileno(),
                )

                # recovering and processing data from pipe
                err = proc.stderr.read()
                # print the raw log
                f_rawlog.write(err)
                f_rawlog.flush()

                # parsing the output
                l_err = err.split()
                try:
                    pos_id = getIndexOfFirst(l_err, "#")
                    prof_id = l_err[pos_id]
                    pos_dot = getIndexOfFirst(l_err, "...")
                    prof_test = ""
                    for s in l_err[pos_id + 1 : pos_dot]:
                        prof_test += s + " "
                    if "OK" in err:
                        pos_ok = getIndexOfLast(l_err, "OK")
                        if len(l_err) == pos_ok + 1:
                            prof_time = float(l_err[pos_ok - 1][0:-1])
                            prof_pass = "OK"
                        elif "SKIP" in l_err[pos_ok + 1]:
                            prof_time = 0.0
                            prof_pass = "SKIPPED TEST"
开发者ID:igul222,项目名称:Theano,代码行数:67,代码来源:run_tests_in_batch.py


示例9: AddConfigVar

# new modes, since it is the default mode.
AddConfigVar(
    "mode",
    "Default compilation mode",
    EnumStr("Mode", "ProfileMode", "DebugMode", "FAST_RUN", "FAST_COMPILE", "PROFILE_MODE", "DEBUG_MODE"),
    in_c_key=False,
)

enum = EnumStr("g++", "")

# Test whether or not g++ is present: disable C code if it is not.
# Using the dummy file descriptor below is a workaround for a crash experienced
# in an unusual Python 2.4.4 Windows environment with the default stdin=None.
dummy_stdin = open(os.devnull)
try:
    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",
        ("Default linker used if the theano flags mode is Mode " "or ProfileMode"),
        EnumStr("cvm", "c|py", "py", "c", "c|py_nogc", "c&py", "vm", "vm_nogc", "cvm_nogc"),
        in_c_key=False,
    )
except OSError:
    # g++ is not present, linker should default to python only
    AddConfigVar(
        "linker",
        ("Default linker used if the theano flags mode is Mode " "or ProfileMode"),
        EnumStr("py", "vm", "vm_nogc"),
        in_c_key=False,
    )
开发者ID:littlemaomao,项目名称:Theano,代码行数:31,代码来源:configdefaults.py



注:本文中的theano.misc.windows.call_subprocess_Popen函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python printing.var_descriptor函数代码示例发布时间:2022-05-27
下一篇:
Python strutil.render_string函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap