How to use the transonic.log.logger function in transonic

To help you get started, we’ve selected a few transonic examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github fluiddyn / transonic / transonic / analyses / justintime.py View on Github external
def analysis_jit(code, pathfile, backend_name):
    """Gather the informations for ``@jit`` with an ast analysis"""
    debug = logger.debug

    debug("extast.parse")
    module = extast.parse(code)

    debug("compute ancestors and chains")
    ancestors, duc, udc = compute_ancestors_chains(module)

    jitted_dicts = get_decorated_dicts(
        module, ancestors, duc, pathfile, backend_name, decorator="jit"
    )

    jitted_dicts = dict(
        functions=jitted_dicts["functions"][backend_name],
        functions_ext=jitted_dicts["functions_ext"][backend_name],
        methods=jitted_dicts["methods"][backend_name],
        classes=jitted_dicts["classes"][backend_name],
github fluiddyn / transonic / transonic / run.py View on Github external
args = parse_args()

    if args.version:
        print(__version__)
        return

    if not args.path and not args.clear_cache:
        logger.warning("No python files given. Nothing to do! ✨ 🍰 ✨.")
        return

    if args.clear_cache:
        clear_cached_extensions(args.clear_cache, args.force, args.backend)
        return

    if args.verbose is None:
        logger.set_level(None)
    elif args.verbose == 1:
        logger.set_level("info")
    elif args.verbose > 1:
        logger.set_level("debug")
    logger.info(args)

    path = args.path

    if isinstance(path, list) and len(path) == 1:
        path = path[0]

    if isinstance(path, list):
        paths = path
    else:
        path = Path(path)
        if path.is_file():
github fluiddyn / transonic / transonic / mpi.py View on Github external
def is_alive_root(self, raise_if_error=False):
        process = self.process
        is_alive_ = process.poll() is None

        if not is_alive_ and process.returncode:
            if process.stdout:
                print(process.stdout.read(), flush=True)
            if process.stderr:
                from transonic.log import logger

                logger.error(process.stderr.read())

            if raise_if_error:
                raise RuntimeError(
                    "Error while compiling code generated by Transonic."
                )

        return is_alive_
github fluiddyn / transonic / transonic / backends / pythranizer.py View on Github external
flags = []

        def update_flags(flag):
            if flag not in flags:
                flags.append(flag)

        if native and os.name != "nt":
            update_flags("-march=native")

        if xsimd:
            update_flags("-DUSE_XSIMD")

        if openmp:
            update_flags("-fopenmp")

        if logger.is_enable_for("debug"):
            update_flags("-v")

        words_command = [
            sys.executable,
            "-m",
            "transonic_cl.run_pythran",
            path.name,
        ]

        words_command.extend(("-o", name_ext_file))

        words_command.extend(flags)

        cwd = path.parent

        self.block_until_avail(parallel)