当前位置: 首页>>代码示例>>Python>>正文


Python ConfigurationManipulator.add_parameter方法代码示例

本文整理汇总了Python中opentuner.search.manipulator.ConfigurationManipulator.add_parameter方法的典型用法代码示例。如果您正苦于以下问题:Python ConfigurationManipulator.add_parameter方法的具体用法?Python ConfigurationManipulator.add_parameter怎么用?Python ConfigurationManipulator.add_parameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在opentuner.search.manipulator.ConfigurationManipulator的用法示例。


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

示例1: main

# 需要导入模块: from opentuner.search.manipulator import ConfigurationManipulator [as 别名]
# 或者: from opentuner.search.manipulator.ConfigurationManipulator import add_parameter [as 别名]
def main():
    parser = argparse.ArgumentParser(parents=opentuner.argparsers())
    args = parser.parse_args()
    manipulator = ConfigurationManipulator()
    manipulator.add_parameter(IntegerParameter('x', -200, 200))
    interface = DefaultMeasurementInterface(args=args,
                                            manipulator=manipulator,
                                            project_name='examples',
                                            program_name='api_test',
                                            program_version='0.1')
    api = TuningRunManager(interface, args)
    for x in range(500):
        desired_result = api.get_next_desired_result()
        if desired_result is None:
          # The search space for this example is very small, so sometimes
          # the techniques have trouble finding a config that hasn't already
          # been tested.  Change this to a continue to make it try again.
          break
        cfg = desired_result.configuration.data
        result = Result(time=test_func(cfg))
        api.report_result(desired_result, result)

    best_cfg = api.get_best_configuration()
    api.finish()
    print('best x found was', best_cfg['x'])
开发者ID:charleslo,项目名称:opentuner,代码行数:27,代码来源:api_example.py

示例2: manipulator

# 需要导入模块: from opentuner.search.manipulator import ConfigurationManipulator [as 别名]
# 或者: from opentuner.search.manipulator.ConfigurationManipulator import add_parameter [as 别名]
 def manipulator(self):
   manipulator = ConfigurationManipulator()
   for d in xrange(self.args.dimensions):
     manipulator.add_parameter(FloatParameter(d,
                                              -self.args.domain,
                                              self.args.domain))
   return manipulator
开发者ID:Bandd-k,项目名称:opentuner,代码行数:9,代码来源:rosenbrock.py

示例3: get_tuning_driver

# 需要导入模块: from opentuner.search.manipulator import ConfigurationManipulator [as 别名]
# 或者: from opentuner.search.manipulator.ConfigurationManipulator import add_parameter [as 别名]
    def get_tuning_driver(self):
        from ctree.opentuner.driver import OpenTunerDriver
        from opentuner.search.manipulator import ConfigurationManipulator
        from opentuner.search.manipulator import FloatParameter
        from opentuner.search.objective import MinimizeTime

        manip = ConfigurationManipulator()
        manip.add_parameter(FloatParameter("x", -100.0, 100.0))
        manip.add_parameter(FloatParameter("y", -100.0, 100.0))

        return OpenTunerDriver(manipulator=manip, objective=MinimizeTime())
开发者ID:i-Zaak,项目名称:ctree,代码行数:13,代码来源:TuningSpecializer.py

示例4: create_test_tuning_run

# 需要导入模块: from opentuner.search.manipulator import ConfigurationManipulator [as 别名]
# 或者: from opentuner.search.manipulator.ConfigurationManipulator import add_parameter [as 别名]
def create_test_tuning_run(db):
  parser = argparse.ArgumentParser(parents=opentuner.argparsers())
  args = parser.parse_args()
  args.database = db
  manipulator = ConfigurationManipulator()
  manipulator.add_parameter(IntegerParameter('x', -200, 200))
  interface = DefaultMeasurementInterface(args=args,
                                          manipulator=manipulator,
                                          project_name='examples',
                                          program_name='api_test',
                                          program_version='0.1')
  api = TuningRunManager(interface, args)
  return api
开发者ID:jansel,项目名称:opentuner,代码行数:15,代码来源:multiple_tuning_runs.py

示例5: get_tuning_driver

# 需要导入模块: from opentuner.search.manipulator import ConfigurationManipulator [as 别名]
# 或者: from opentuner.search.manipulator.ConfigurationManipulator import add_parameter [as 别名]
    def get_tuning_driver(self):
        from ctree.opentuner.driver import OpenTunerDriver
        from opentuner.search.manipulator import ConfigurationManipulator
        from opentuner.search.manipulator import IntegerParameter
        from opentuner.search.manipulator import PowerOfTwoParameter
        from opentuner.search.objective import MinimizeTime, MinimizeEnergy

        manip = ConfigurationManipulator()
        manip.add_parameter(PowerOfTwoParameter("rx", 1, 8))
        manip.add_parameter(PowerOfTwoParameter("ry", 1, 8))
        manip.add_parameter(IntegerParameter("cx", 8, 32))
        manip.add_parameter(IntegerParameter("cy", 8, 32))

        return OpenTunerDriver(manipulator=manip, objective=MinimizeTime())
开发者ID:mbdriscoll,项目名称:ctree,代码行数:16,代码来源:dgemm.py

示例6: test_1d_config

# 需要导入模块: from opentuner.search.manipulator import ConfigurationManipulator [as 别名]
# 或者: from opentuner.search.manipulator.ConfigurationManipulator import add_parameter [as 别名]
    def test_1d_config(self):
        from ctree.opentuner.driver import OpenTunerDriver
        from opentuner.search.objective import MinimizeTime
        from opentuner.search.manipulator import ConfigurationManipulator, IntegerParameter

        cfg = ConfigurationManipulator()
        cfg.add_parameter(IntegerParameter("foo", 0, 199))
        driver = OpenTunerDriver(manipulator=cfg, objective=MinimizeTime())

        unsearched = set(range(200))
        for cfg in islice(driver.configs, 20):
            val = cfg["foo"]
            driver.report(time=val)
            unsearched.remove(val)
        self.assertEqual(len(unsearched), 180)
开发者ID:i-Zaak,项目名称:ctree,代码行数:17,代码来源:test_tuning.py

示例7: main

# 需要导入模块: from opentuner.search.manipulator import ConfigurationManipulator [as 别名]
# 或者: from opentuner.search.manipulator.ConfigurationManipulator import add_parameter [as 别名]
def main(args, cfg, ss):
	logging.basicConfig(level=logging.INFO)
	manipulator = ConfigurationManipulator()

	params = cfg.getAllParameters()
	print "\nFeature variables...."
	for key in params.keys():
		print "\t", key
  		manipulator.add_parameter(cfg.getParameter(key))
	
	mi = StreamJitMI(args, ss, manipulator, FixedInputManager(),
                    MinimizeTime())

	m = TuningRunMain(mi, args)
	m.main()
开发者ID:dhlorenz,项目名称:streamjit,代码行数:17,代码来源:tuner.py

示例8: main

# 需要导入模块: from opentuner.search.manipulator import ConfigurationManipulator [as 别名]
# 或者: from opentuner.search.manipulator.ConfigurationManipulator import add_parameter [as 别名]
def main(args, cfg, jvmOptions):
	logging.basicConfig(level=logging.INFO)
	manipulator = ConfigurationManipulator()

	params = dict(cfg.items() + jvmOptions.items())
	#print "\nFeature variables...."
	for key in params.keys():
		#print "\t", key
  		manipulator.add_parameter(params.get(key))
	
	mi = StreamJitMI(args,jvmOptions, manipulator, FixedInputManager(),
                    MinimizeTime())

	m = TuningRunMain(mi, args)
	m.main()
开发者ID:dhlorenz,项目名称:streamjit,代码行数:17,代码来源:tuner2.py

示例9: manipulator

# 需要导入模块: from opentuner.search.manipulator import ConfigurationManipulator [as 别名]
# 或者: from opentuner.search.manipulator.ConfigurationManipulator import add_parameter [as 别名]
  def manipulator(self):
    '''create the configuration manipulator, from example config'''
    upper_limit = self.program_settings['n']+1
    cfg = open(self.args.program_cfg_default).read()
    manipulator = ConfigurationManipulator()

    for m in re.finditer(r" *([a-zA-Z0-9_-]+)[ =]+([0-9e.+-]+) *"
                         r"[#] *([a-z]+).* ([0-9]+) to ([0-9]+)", cfg):
      k, v, valtype, minval, maxval =  m.group(1,2,3,4,5)
      minval = float(minval)
      maxval = float(maxval)
      if upper_limit:
        maxval = min(maxval, upper_limit)
      assert valtype=='int'
      #log.debug("param %s %f %f", k, minval, maxval)
      if minval == 0 and maxval < 64:
        manipulator.add_parameter(SwitchParameter(k, maxval))
      else:
        manipulator.add_parameter(LogIntegerParameter(k, minval, maxval))

    return manipulator
开发者ID:shoaibkamil,项目名称:opentuner-old,代码行数:23,代码来源:pbtuner.py

示例10: manipulator

# 需要导入模块: from opentuner.search.manipulator import ConfigurationManipulator [as 别名]
# 或者: from opentuner.search.manipulator.ConfigurationManipulator import add_parameter [as 别名]
 def manipulator(self):
     m = ConfigurationManipulator()
     for i in range(0, 12000):
         m.add_parameter(BooleanParameter("L{}".format(i)))
         m.add_parameter(BooleanParameter("R{}".format(i)))
         m.add_parameter(BooleanParameter("D{}".format(i)))
         m.add_parameter(BooleanParameter("B{}".format(i)))
         m.add_parameter(BooleanParameter("A{}".format(i)))
     return m
开发者ID:charleslo,项目名称:opentuner,代码行数:11,代码来源:mario.py

示例11: manipulator

# 需要导入模块: from opentuner.search.manipulator import ConfigurationManipulator [as 别名]
# 或者: from opentuner.search.manipulator.ConfigurationManipulator import add_parameter [as 别名]
 def manipulator(self):
   m = ConfigurationManipulator()
   for i in xrange(0, 12000):
     m.add_parameter(BooleanParameter('L{}'.format(i)))
     m.add_parameter(BooleanParameter('R{}'.format(i)))
     m.add_parameter(BooleanParameter('D{}'.format(i)))
     m.add_parameter(BooleanParameter('B{}'.format(i)))
     m.add_parameter(BooleanParameter('A{}'.format(i)))
   return m
开发者ID:WeiFoo,项目名称:opentuner,代码行数:11,代码来源:mario.py

示例12: manipulator

# 需要导入模块: from opentuner.search.manipulator import ConfigurationManipulator [as 别名]
# 或者: from opentuner.search.manipulator.ConfigurationManipulator import add_parameter [as 别名]
 def manipulator(self):
   m = ConfigurationManipulator()
   for i in xrange(0, 1000):
     m.add_parameter(EnumParameter('move{}'.format(i), ["R", "L", "RB", "LB", "N", "LR", "LRB", "R2", "RB2", "R3", "RB3"]))
     m.add_parameter(IntegerParameter('move_duration{}'.format(i), 1, 60))
     #m.add_parameter(BooleanParameter("D"+str(i)))
   for i in xrange(0, 1000):
     m.add_parameter(IntegerParameter('jump_frame{}'.format(i), 0, 24000))
     m.add_parameter(IntegerParameter('jump_duration{}'.format(i), 1, 32))
   return m
开发者ID:jrk,项目名称:opentuner,代码行数:12,代码来源:mario.py

示例13: manipulator

# 需要导入模块: from opentuner.search.manipulator import ConfigurationManipulator [as 别名]
# 或者: from opentuner.search.manipulator.ConfigurationManipulator import add_parameter [as 别名]
  def manipulator(self):
    """create the configuration manipulator, from example config"""
    upper_limit = self.program_settings['n'] + 1
    cfg = open(self.args.program_cfg_default).read()
    manipulator = ConfigurationManipulator()

    self.choice_sites = dict()

    for m in re.finditer(r" *([a-zA-Z0-9_-]+)[ =]+([0-9e.+-]+) *"
                         r"[#] *([a-z]+).* ([0-9]+) to ([0-9]+)", cfg):
      k, v, valtype, minval, maxval = m.group(1, 2, 3, 4, 5)
      minval = float(minval)
      maxval = float(maxval)
      if upper_limit:
        maxval = min(maxval, upper_limit)
      assert valtype == 'int'
      #log.debug("param %s %f %f", k, minval, maxval)

      m1 = re.match(r'(.*)_lvl[0-9]+_rule', k)
      m2 = re.match(r'(.*)_lvl[0-9]+_cutoff', k)
      if m1:
        self.choice_sites[m1.group(1)] = int(maxval)
      elif m2:
        pass
      elif k == 'worker_threads':
        manipulator.add_parameter(IntegerParameter(k, 1, 16))
      elif k == 'distributedcutoff':
        pass
      elif minval == 0 and maxval < 64:
        manipulator.add_parameter(SwitchParameter(k, maxval))
      else:
        manipulator.add_parameter(LogIntegerParameter(k, minval, maxval))

    for name, choices in self.choice_sites.items():
      manipulator.add_parameter(
        SelectorParameter('.' + name, range(choices + 1),
                          upper_limit / choices))

    self.manipulator = manipulator
    return manipulator
开发者ID:pbalapra,项目名称:opentuner,代码行数:42,代码来源:pbtuner.py

示例14: tuning_loop

# 需要导入模块: from opentuner.search.manipulator import ConfigurationManipulator [as 别名]
# 或者: from opentuner.search.manipulator.ConfigurationManipulator import add_parameter [as 别名]
def tuning_loop():
    report_delay = 200
    last_time    = time.time()
    start_time   = last_time
    parser       = argparse.ArgumentParser(parents = opentuner.argparsers())

    parser.add_argument("--processes",
                        type = int,
                        help = "Number of Python threads available.")
    parser.add_argument("--no-wait",
                        action = "store_true",
                        help   = "Do not wait for requested results to generate more requests.")

    args         = parser.parse_args()
    pool         = ThreadPool(args.processes)
    manipulator  = ConfigurationManipulator()

    for name in legup_parameters.parameters:
        parameter_type = legup_parameters.parameter_type(name)
        values = legup_parameters.parameter_values(name)
        if parameter_type == int:
            manipulator.add_parameter(IntegerParameter(name, values[0], values[1]))
        elif parameter_type == bool:
            manipulator.add_parameter(BooleanParameter(name))
        elif parameter_type == Enum:
            manipulator.add_parameter(EnumParameter(name, values))
        else:
            print("ERROR: No such parameter type \"{0}\"".format(name))

    interface = DefaultMeasurementInterface(args            = args,
                                            manipulator     = manipulator,
                                            project_name    = 'HLS-FPGAs',
                                            program_name    = 'legup-tuner',
                                            program_version = '0.0.1')

    manager = TuningRunManager(interface, args)

    current_time      = time.time()
    computing_results = []
    computed_results  = []
    desired_results   = manager.get_desired_results()

    while current_time - start_time < args.stop_after:
        if args.no_wait:
            if len(desired_results) != 0 or len(computing_results) != 0:
                for desired_result in desired_results:
                    computing_results.append([desired_result,
                                              pool.apply_async(get_wallclock_time,
                                                              (desired_result.configuration.data, ))])

                for result in computing_results:
                    if result[1].ready() and result[0] not in computed_results:
                        cost = result[1].get()
                        manager.report_result(result[0], Result(time = cost))
                        computed_results.append(result)

                for result in computed_results:
                    if result in computing_results:
                        computing_results.remove(result)

                computed_results = []
        else:
            if len(desired_results) != 0:
                cfgs    = [dr.configuration.data for dr in desired_results]
                results = pool.map_async(get_wallclock_time, cfgs).get(timeout = None)

                for dr, result in zip(desired_results, results):
                    manager.report_result(dr, Result(time = result))

        desired_results = manager.get_desired_results()

        current_time = time.time()

        if (current_time - last_time) >= report_delay:
            log_intermediate(current_time - start_time, manager)
            last_time = current_time

    current_time = time.time()
    log_intermediate(current_time - start_time, manager)

    save_final_configuration(manager.get_best_configuration())
    manager.finish()
开发者ID:phrb,项目名称:legup-tuner,代码行数:84,代码来源:tuner.py

示例15: manipulator

# 需要导入模块: from opentuner.search.manipulator import ConfigurationManipulator [as 别名]
# 或者: from opentuner.search.manipulator.ConfigurationManipulator import add_parameter [as 别名]
 def manipulator(self):
     #FIXME: should some of these be expressed as booleans or switch parameters?
     #FIXME: how to express P and Q, given PxQ=nprocs, with nprocs being fixed?
     #FIXME: how to express logscaled parameter with a particular base?
     manipulator = ConfigurationManipulator()
     manipulator.add_parameter(IntegerParameter("blocksize", 1, 64))
     manipulator.add_parameter(IntegerParameter("row_or_colmajor_pmapping", 0, 1))
     manipulator.add_parameter(IntegerParameter("pfact", 0, 2))
     manipulator.add_parameter(IntegerParameter("nbmin", 1, 4))
     manipulator.add_parameter(IntegerParameter("ndiv", 2, 2))
     manipulator.add_parameter(IntegerParameter("rfact", 0, 4))
     manipulator.add_parameter(IntegerParameter("bcast", 0, 5))
     manipulator.add_parameter(IntegerParameter("depth", 0, 4))
     manipulator.add_parameter(IntegerParameter("swap", 0, 2))
     manipulator.add_parameter(IntegerParameter("swapping_threshold", 64, 128))
     manipulator.add_parameter(IntegerParameter("L1_transposed", 0, 1))
     manipulator.add_parameter(IntegerParameter("U_transposed", 0, 1))
     manipulator.add_parameter(IntegerParameter("mem_alignment", 4, 16))
     
     return manipulator
开发者ID:charleslo,项目名称:opentuner,代码行数:22,代码来源:hpl.py


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