示例#1
0
    def _test_inline(cls):
        """
        Detect whether weave.inline is functional.

        Produces compile warnings, which we suppress by capturing STDERR.
        """
        if not hasattr(cls, '_use_inline'):
            cls._use_inline = False
            if weave_inline is not None:
                logger = get_logger(__name__)
                extra_compile_args = []
                # See comment in __init__ for why this must be EXTENDED_DEBUG.
                if not logger.isEnabledFor(EXTENDED_DEBUG):
                    if os.name == 'posix':
                        extra_compile_args.append('2>/dev/null')
                    elif os.name == 'nt':
                        extra_compile_args.append('2>NUL')
                try:
                    with _patch_distutils_logging(logger):
                        weave_inline('int i=0; i=i;', force=1,
                                     extra_compile_args=extra_compile_args)
                    cls._use_inline = True
                except (weave.build_tools.CompileError,
                        distutils.errors.CompileError, ImportError):
                    pass
示例#2
0
文件: scipyode.py 项目: alubbock/pysb
    def _test_inline(cls):
        """
        Detect whether weave.inline is functional.

        Produces compile warnings, which we suppress by capturing STDERR.
        """
        if not hasattr(cls, '_use_inline'):
            cls._use_inline = False
            if weave_inline is not None:
                logger = get_logger(__name__)
                extra_compile_args = []
                # See comment in __init__ for why this must be EXTENDED_DEBUG.
                if not logger.isEnabledFor(EXTENDED_DEBUG):
                    if os.name == 'posix':
                        extra_compile_args.append('2>/dev/null')
                    elif os.name == 'nt':
                        extra_compile_args.append('2>NUL')
                try:
                    with _patch_distutils_logging(logger):
                        weave_inline('int i=0; i=i;', force=1,
                                     extra_compile_args=extra_compile_args)
                    cls._use_inline = True
                except (weave.build_tools.CompileError,
                        distutils.errors.CompileError, ImportError):
                    pass
                except ValueError as e:
                    if len(e.args) == 1 and \
                                        e.args[0] == "Symbol table not found":
                        get_logger(__name__).debug(
                            "'ValueError: Symbol table not found' "
                            "encountered; weave compiler is not functional")
                    else:
                        raise
示例#3
0
文件: scipyode.py 项目: zhwycsz/pysb
 def rhs(t, y, p):
     # note that the evaluated code sets ydot as a side effect
     weave_inline(
         code_eqs,
         ['ydot' if ydot is not None else 'jac', 't', 'y', 'p'],
         extra_compile_args=compiler_directives)
     return ydot if ydot is not None else jac
示例#4
0
文件: scipyode.py 项目: jmuhlich/pysb
    def _test_inline(cls):
        """
        Detect whether weave.inline is functional.

        Produces compile warnings, which we suppress by capturing STDERR.
        """
        if not hasattr(cls, '_use_inline'):
            cls._use_inline = False
            if weave_inline is not None:
                logger = get_logger(__name__)
                extra_compile_args = []
                # See comment in __init__ for why this must be EXTENDED_DEBUG.
                if not logger.isEnabledFor(EXTENDED_DEBUG):
                    if os.name == 'posix':
                        extra_compile_args.append('2>/dev/null')
                    elif os.name == 'nt':
                        extra_compile_args.append('2>NUL')
                try:
                    with _patch_distutils_logging(logger):
                        weave_inline('int i=0; i=i;', force=1,
                                     extra_compile_args=extra_compile_args)
                    cls._use_inline = True
                except (weave.build_tools.CompileError,
                        distutils.errors.CompileError,
                        ImportError,
                        ValueError) as e:
                    if not cls._check_compiler_error(e, 'weave'):
                        raise
示例#5
0
    def _test_inline(cls):
        """
        Detect whether weave.inline is functional.

        Produces compile warnings, which we suppress by capturing STDERR.
        """
        if not hasattr(cls, '_use_inline'):
            cls._use_inline = False
            try:
                if weave_inline is not None:
                    extra_compile_args = None
                    if os.name == 'posix':
                        extra_compile_args = ['2>/dev/null']
                    elif os.name == 'nt':
                        extra_compile_args = ['2>NUL']
                    weave_inline('int i=0; i=i;',
                                 force=1,
                                 extra_compile_args=extra_compile_args)
                    cls._use_inline = True
            except (weave.build_tools.CompileError,
                    distutils.errors.CompileError, ImportError):
                pass
示例#6
0
 def jacobian(t, y, p):
     jac = self.jac
     weave_inline(jac_eqs, ['jac', 't', 'y', 'p'],
                  extra_compile_args=['-w'])
     return jac
示例#7
0
 def rhs(t, y, p):
     ydot = self.ydot
     # note that the evaluated code sets ydot as a side effect
     weave_inline(code_eqs, ['ydot', 't', 'y', 'p'],
                  extra_compile_args=['-w'])
     return ydot
示例#8
0
 def jacobian(t, y, p):
     weave_inline(jac_eqs, ['jac', 't', 'y', 'p'],
                  extra_compile_args=extra_compile_args)
     return jac
示例#9
0
文件: scipyode.py 项目: alubbock/pysb
 def jacobian(t, y, p):
     weave_inline(jac_eqs, ['jac', 't', 'y', 'p'],
                  extra_compile_args=extra_compile_args)
     return jac
示例#10
0
文件: scipyode.py 项目: alubbock/pysb
 def rhs(t, y, p):
     # note that the evaluated code sets ydot as a side effect
     weave_inline(code_eqs, ['ydot', 't', 'y', 'p'],
                  extra_compile_args=extra_compile_args)
     return ydot
示例#11
0
文件: scipyode.py 项目: LoLab-VU/pysb
 def rhs(t, y, p):
     # note that the evaluated code sets ydot as a side effect
     weave_inline(code_eqs, ['ydot' if ydot is not None else 'jac',
                             't', 'y', 'p'],
                  extra_compile_args=compiler_directives)
     return ydot if ydot is not None else jac