Compile & Run the experiment with -O3 enabled.
764070
def actions_for_project(self, project):
        """"""
        project.cflags = ["-O3", "-fno-omit-frame-pointer"]
        project.runtime_extension = time.RunWithTime(
            run.RuntimeExtension(project, self))
        return self.default_runtime_actions(project)
17603
def run(self):
    
    experiment = self._context.experiment()
    if experiment is None:
      raise error.HParamsError(
          "Can't find an HParams-plugin experiment data in"
          " the log directory. Note that it takes some time to"
          " scan the log directory; if you just started"
          " Tensorboard it could be that we haven't finished"
          " scanning it yet. Consider trying again in a"
          " few seconds.")
    return experiment
135072
def run(self, context):
        """"""
        # Don't do something when running non-interactive.
        if not sys.stdout.isatty():
            return

        with local.cwd(context.in_container):
            from benchbuild.projects.gentoo import gentoo
            gentoo.setup_networking()
            gentoo.configure_portage()

            sed_in_chroot = uchroot.uchroot()["/bin/sed"]
            emerge_in_chroot = uchroot.uchroot()["/usr/bin/emerge"]
            has_pkg = uchroot.uchroot()["/usr/bin/qlist", "-I"]

            run.run(sed_in_chroot["-i", '/CC=/d', "/etc/portage/make.conf"])
            run.run(sed_in_chroot["-i", '/CXX=/d', "/etc/portage/make.conf"])

            want_sync = bool(CFG["container"]["strategy"]["polyjit"]["sync"])
            want_upgrade = bool(
                CFG["container"]["strategy"]["polyjit"]["upgrade"])

            packages = \
                CFG["container"]["strategy"]["polyjit"]["packages"].value
            with local.env(MAKEOPTS="-j{0}".format(int(CFG["jobs"]))):
                if want_sync:
                    LOG.debug("Synchronizing portage.")
                    run.run(emerge_in_chroot["--sync"])
                if want_upgrade:
                    LOG.debug("Upgrading world.")
                    run.run(emerge_in_chroot["--autounmask-only=y", "-uUDN",
                                             "--with-bdeps=y", "@world"])
                for pkg in packages:
                    if has_pkg[pkg["name"]] & TF:
                        continue
                    env = pkg["env"]
                    with local.env(**env):
                        run.run(emerge_in_chroot[pkg["name"]])

            gentoo.setup_benchbuild()

        print("Packing new container image.")
        with local.cwd(context.builddir):
            pack_container(context.in_container, context.out_container)
316083
function run() {
  var bin = path.resolve(__dirname, '../node_modules/.bin/mocha');
  var args = Array.prototype.slice.call(arguments);
  var fn = args.pop();
  var cmd = [bin].concat(args).join(' ') + ' --no-colors';
  exec(cmd, fn);
}
1082074
def main():
    """"""
    util.create_dir(os.path.join(CONF_DIR, "templates"))
    util.create_dir(os.path.join(CONF_DIR, "colorschemes/light/"))
    util.create_dir(os.path.join(CONF_DIR, "colorschemes/dark/"))

    util.setup_logging()
    parser = get_args()

    parse_args_exit(parser)
    parse_args(parser)
98941
def run_experiment(self):
        
        data=self.data
        options=self.options
        result=self.result

        command = open(self.options.experiment_script).read()
        result["experiment_script"]=command
        t0=time.time()
        exec(command)   #creates variable result
        t1=time.time()
        print(("Elapsed time for running the experiment is %.2f seconds" % (t1-t0)))
        self.result=result
        return self.result
827159
def run(self):
        """"""
        env = dict(os.environ)
        file_path = self.file.real_path
        path_folders = self.pycore.project.get_source_folders() + \
            self.pycore.project.get_python_path_folders()
        env['PYTHONPATH'] = os.pathsep.join(folder.real_path
                                            for folder in path_folders)
        runmod_path = self.pycore.project.find_module('rope.base.oi.runmod').real_path
        self.receiver = None
        self._init_data_receiving()
        send_info = '-'
        if self.receiver:
            send_info = self.receiver.get_send_info()
        args = [sys.executable, runmod_path, send_info,
                self.pycore.project.address, self.file.real_path]
        if self.analyze_data is None:
            del args[1:4]
        if self.args is not None:
            args.extend(self.args)
        self.process = subprocess.Popen(
            executable=sys.executable, args=args, env=env,
            cwd=os.path.split(file_path)[0], stdin=self.stdin,
            stdout=self.stdout, stderr=self.stdout, close_fds=os.name != 'nt')
1370624
def run(client, outputs, no_output, success_codes, isolation, command_line):
    """"""
    working_dir = client.repo.working_dir
    mapped_std = _mapped_std_streams(client.candidate_paths)
    factory = CommandLineToolFactory(
        command_line=command_line,
        directory=os.getcwd(),
        working_dir=working_dir,
        successCodes=success_codes,
        **{
            name: os.path.relpath(path, working_dir)
            for name, path in mapped_std.items()
        }
    )

    with client.with_workflow_storage() as wf:
        with factory.watch(
            client, no_output=no_output, outputs=outputs
        ) as tool:
            # Make sure all inputs are pulled from a storage.
            client.pull_paths_from_storage(
                *(
                    path
                    for _, path in tool.iter_input_files(client.workflow_path)
                )
            )

            returncode = call(
                factory.command_line,
                cwd=os.getcwd(),
                **{key: getattr(sys, key)
                   for key in mapped_std.keys()},
            )

            if returncode not in (success_codes or {0}):
                raise errors.InvalidSuccessCode(
                    returncode, success_codes=success_codes
                )

            sys.stdout.flush()
            sys.stderr.flush()

            wf.add_step(run=tool)
480976
def run(self):
        
        os.environ['JARN_RUN'] = '1'
        self.python.check_valid_python()

        args = self.parse_options(self.args)
        if args:
            arg = args[0]
        else:
            arg = os.curdir
        if arg:
            arg = expanduser(arg)

        if isfile(arg):
            outfile = self.render_file(arg)
        elif isdir(arg):
            outfile = self.render_long_description(arg)
        else:
            err_exit('No such file or directory: %s' % arg)

        self.open_in_browser(outfile)
1036050
def start(self):
             
        self.parse_opt()
        self.parse_cfg()

        # if -b, -B or -p option is set, only show information, don't
        # start the experiments
        if self.options.browse or self.options.browse_big or self.options.progress:
            self.browse()
            raise SystemExit
        
        # read main configuration file
        paramlist = []
        for exp in self.cfgparser.sections():
            if not self.options.experiments or exp in self.options.experiments:
                params = self.items_to_params(self.cfgparser.items(exp))
                params['name'] = exp
                paramlist.append(params)
                
        self.do_experiment(paramlist)
1056421
def run(self, app):
        """"""
        project_path = os.getcwd()
        if self.args.name is not None:
            project_path = os.path.join(project_path, self.args.name)

        proto_path = paths.PROTO_PATH

        try:
            copytree(proto_path, project_path)
            print(colored('A new glim app created successfully! Happy coding :)', 'green'))
        except FolderExistsError as e:
            print(e)
            print(colored('App already exists', 'red'))
783982
def run_module(self, resource, args=None, stdin=None, stdout=None):
        
        perform_doa = self.project.prefs.get('perform_doi', True)
        perform_doa = self.project.prefs.get('perform_doa', perform_doa)
        receiver = self.object_info.doa_data_received
        if not perform_doa:
            receiver = None
        runner = rope.base.oi.doa.PythonFileRunner(
            self, resource, args, stdin, stdout, receiver)
        runner.add_finishing_observer(self.module_cache.forget_all_data)
        runner.run()
        return runner
1290759
def _main():
    """"""
    import signal

    # Handle "Broken pipe" gracefully
    try:
        signal.signal(signal.SIGPIPE, lambda signum, frame: sys.exit(1))
    except AttributeError:
        pass    # not supported on Windows

    style_guide = StyleGuide(parse_argv=True)
    options = style_guide.options

    if options.doctest or options.testsuite:
        from testsuite.support import run_tests
        report = run_tests(style_guide)
    else:
        report = style_guide.check_files()

    if options.statistics:
        report.print_statistics()

    if options.benchmark:
        report.print_benchmark()

    if options.testsuite and not options.quiet:
        report.print_results()

    if report.total_errors:
        if options.count:
            sys.stderr.write(str(report.total_errors) + '\n')
        sys.exit(1)
526876
def _run(
    categories, param_file, project_dir, plugin, target,
    status_update_interval
):
    
    project_dir = os.path.abspath(project_dir)

    # Make sure the project has been initialized
    pio_config = os.path.join(project_dir, "platformio.ini")
    if not os.path.isfile(pio_config):
        raise click.ClickException(
            "Not an OpenAg firmware project. To initialize a new project "
            "please use the `openag firmware init` command"
        )

    # @TODO in future we should pass in module config files as a thing
    # separate from the param file.
    name, ext = os.path.splitext(param_file.name)
    if ext == ".json":
        params = json.load(param_file)
    elif ext in (".yaml", ".yml"):
        params = yaml.load(param_file)
    else:
        raise ValueError("Param file must be YAML or JSON")

    firmware_type_params = params.get(FIRMWARE_MODULE_TYPE, [])
    firmware_params = params.get(FIRMWARE_MODULE, [])

    firmware_types = [
        FirmwareModuleType(record)
        for record in firmware_type_params
    ]
    firmware = [
        FirmwareModule(record)
        for record in firmware_params
    ]

    # Check for working modules in the lib folder
    # Do this second so project-local values overwrite values from the server
    lib_path = os.path.join(project_dir, "lib")
    for dir_name in os.listdir(lib_path):
        dir_path = os.path.join(lib_path, dir_name)
        if not os.path.isdir(dir_path):
            continue
        config_path = os.path.join(dir_path, "module.json")
        if os.path.isfile(config_path):
            with open(config_path) as f:
                click.echo(
                    "Parsing firmware module type \"{}\" from lib "
                    "folder".format(dir_name)
                )
                doc = json.load(f)
                if not doc.get("_id"):
                    # Patch in id if id isn't present
                    doc["_id"] = parent_dirname(config_path)
                firmware_types.append(FirmwareModuleType(doc))

    if len(firmware) == 0:
        click.echo("Warning: no modules specified for the project")

    module_types = index_by_id(firmware_types)
    modules = index_by_id(firmware)
    # Synthesize the module and module type dicts
    modules = synthesize_firmware_module_info(modules, module_types)
    # Update the module inputs and outputs using the categories
    modules = prune_unspecified_categories(modules, categories)

    # Generate src.ino
    src_dir = os.path.join(project_dir, "src")
    src_file_path = os.path.join(src_dir, "src.ino")
    # Load the plugins
    plugin_fns = (load_plugin(plugin_name) for plugin_name in plugin)
    # Run modules through each plugin
    plugins = [plugin_fn(modules) for plugin_fn in plugin_fns]

    # Generate the code
    codegen = CodeGen(
        modules=modules, plugins=plugins,
        status_update_interval=status_update_interval
    )
    pio_ids = (dep["id"] for dep in codegen.all_pio_dependencies())
    for _id in pio_ids:
        subprocess.call(["platformio", "lib", "install", str(_id)])
    lib_dir = os.path.join(project_dir, "lib")
    for dep in codegen.all_git_dependencies():
        url = dep["url"]
        branch = dep.get("branch", "master")
        dep_folder_name = make_dir_name_from_url(url)
        dep_folder = os.path.join(lib_dir, dep_folder_name)
        if os.path.isdir(dep_folder):
            click.echo('Updating "{}"'.format(dep_folder_name))
            subprocess.call(
                ["git", "checkout", "--quiet", branch], cwd=dep_folder)
            subprocess.call(["git", "pull"], cwd=dep_folder)
        else:
            click.echo('Downloading "{}"'.format(dep_folder_name))
            subprocess.call(
                ["git", "clone", "-b", branch, url, dep_folder], cwd=lib_dir)
    with open(src_file_path, "w+") as f:
        codegen.write_to(f)

    # Compile the generated code
    command = ["platformio", "run"]
    if target:
        command.append("-t")
        command.append(target)
    env = os.environ.copy()
    build_flags = []
    for c in categories:
        build_flags.append("-DOPENAG_CATEGORY_{}".format(c.upper()))
    env["PLATFORMIO_BUILD_FLAGS"] = " ".join(build_flags)
    if subprocess.call(command, cwd=project_dir, env=env):
        raise click.ClickException("Compilation failed")
774824
def run_build_lib(folder):
    """"""
    try:
        retcode = subprocess.call("cd %s; make" % folder, shell=True)
        retcode = subprocess.call("rm -rf _build/html/doxygen", shell=True)
        retcode = subprocess.call("mkdir _build", shell=True)
        retcode = subprocess.call("mkdir _build/html", shell=True)
        retcode = subprocess.call("cp -rf doxygen/html _build/html/doxygen", shell=True)
        if retcode < 0:
            sys.stderr.write("build terminated by signal %s" % (-retcode))
    except OSError as e:
        sys.stderr.write("build execution failed: %s" % e)
1287784
def main(argv=None):
  """"""
  args = parse_arguments(sys.argv if argv is None else argv)
  temp_dir = os.path.join(args.output, 'tmp')

  if args.cloud:
    pipeline_name = 'DataflowRunner'
  else:
    pipeline_name = 'DirectRunner'
    # Suppress TF warnings.
    os.environ['TF_CPP_MIN_LOG_LEVEL']='3'

  options = {
      'job_name': args.job_name,
      'temp_location': temp_dir,
      'project': args.project_id,
      'setup_file':
          os.path.abspath(os.path.join(
              os.path.dirname(__file__),
              'setup.py')),
  }
  if args.num_workers:
    options['num_workers'] = args.num_workers
  if args.worker_machine_type:
    options['worker_machine_type'] = args.worker_machine_type

  pipeline_options = beam.pipeline.PipelineOptions(flags=[], **options)

  p = beam.Pipeline(pipeline_name, options=pipeline_options)
  preprocess(pipeline=p, args=args)
  pipeline_result = p.run()

  if not args.async:
    pipeline_result.wait_until_finish()
  if args.async and args.cloud:
    print('View job at https://console.developers.google.com/dataflow/job/%s?project=%s' %
        (pipeline_result.job_id(), args.project_id))
775678
def launch():
    """"""
    try:
        exp = Experiment(db.init_db(drop_all=False))
    except Exception as ex:
        return error_response(
            error_text="Failed to load experiment in /launch: {}".format(str(ex)),
            status=500,
            simple=True,
        )
    try:
        exp.log("Launching experiment...", "-----")
    except IOError as ex:
        return error_response(
            error_text="IOError writing to experiment log: {}".format(str(ex)),
            status=500,
            simple=True,
        )

    try:
        recruitment_details = exp.recruiter.open_recruitment(
            n=exp.initial_recruitment_size
        )
        session.commit()
    except Exception as e:
        return error_response(
            error_text="Failed to open recruitment, check experiment server log "
            "for details: {}".format(str(e)),
            status=500,
            simple=True,
        )

    for task in exp.background_tasks:
        try:
            gevent.spawn(task)
        except Exception:
            return error_response(
                error_text="Failed to spawn task on launch: {}, ".format(task)
                + "check experiment server log for details",
                status=500,
                simple=True,
            )

    if _config().get("replay", False):
        try:
            task = ReplayBackend(exp)
            gevent.spawn(task)
        except Exception:
            return error_response(
                error_text="Failed to launch replay task for experiment."
                "check experiment server log for details",
                status=500,
                simple=True,
            )

    # If the experiment defines a channel, subscribe the experiment to the
    # redis communication channel:
    if exp.channel is not None:
        try:
            from dallinger.experiment_server.sockets import chat_backend

            chat_backend.subscribe(exp, exp.channel)
        except Exception:
            return error_response(
                error_text="Failed to subscribe to chat for channel on launch "
                + "{}".format(exp.channel)
                + ", check experiment server log for details",
                status=500,
                simple=True,
            )

    message = "\n".join(
        (
            "Initial recruitment list:\n{}".format(
                "\n".join(recruitment_details["items"])
            ),
            "Additional details:\n{}".format(recruitment_details["message"]),
        )
    )

    return success_response(recruitment_msg=message)