How to use the opentuner.search.manipulator.IntegerParameter function in opentuner

To help you get started, we’ve selected a few opentuner 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 jansel / opentuner / examples / hpl / hpl.py View on Github external
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
github jansel / opentuner / examples / mario / mario.py View on Github external
def manipulator(self):
    m = ConfigurationManipulator()
    for i in range(0, 1000):
      #bias 3:1 in favor of moving right
      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 range(0, 1000):
      m.add_parameter(IntegerParameter('jump_frame{}'.format(i), 0, 24000))
      m.add_parameter(IntegerParameter('jump_duration{}'.format(i), 1, 32))
    return m
github uber / bayesmark / bayesmark / builtin_opt / opentuner_optimizer.py View on Github external
ot_param = FloatParameter(pname, pmin, pmax)
                elif pspace in ("log", "bilog"):
                    LogFloatParameter_ = ClippedParam(LogFloatParameter)
                    ot_param = LogFloatParameter_(pname, pmin, pmax)
                else:
                    assert False, "unsupported param space = %s" % pspace
            elif ptype == "int":
                if pspace in ("linear", "logit"):
                    ot_param = IntegerParameter(pname, pmin, pmax)
                elif pspace in ("log", "bilog"):
                    ot_param = LogIntegerParameter(pname, pmin, pmax)
                else:
                    assert False, "unsupported param space = %s" % pspace
            elif ptype == "bool":
                # The actual bool parameter seems not to work in Py3 :(
                ot_param = IntegerParameter(pname, 0, 1)
            elif ptype in ("cat", "ordinal"):
                # Treat ordinal and categorical variables the same for now.
                assert "values" in api_config[pname]
                pvalues = api_config[pname]["values"]
                ot_param = EnumParameter(pname, pvalues)
            else:
                assert False, "type=%s/space=%s not handled in opentuner yet" % (ptype, pspace)
            manipulator.add_parameter(ot_param)
        return manipulator
github uber / bayesmark / example_opt_root / opentuner_optimizer.py View on Github external
for pname in api_config:
            ptype = api_config[pname]["type"]
            pspace = api_config[pname].get("space", None)
            pmin, pmax = api_config[pname].get("range", (None, None))

            if ptype == "real":
                if pspace in ("linear", "logit"):
                    ot_param = FloatParameter(pname, pmin, pmax)
                elif pspace in ("log", "bilog"):
                    LogFloatParameter_ = ClippedParam(LogFloatParameter)
                    ot_param = LogFloatParameter_(pname, pmin, pmax)
                else:
                    assert False, "unsupported param space = %s" % pspace
            elif ptype == "int":
                if pspace in ("linear", "logit"):
                    ot_param = IntegerParameter(pname, pmin, pmax)
                elif pspace in ("log", "bilog"):
                    ot_param = LogIntegerParameter(pname, pmin, pmax)
                else:
                    assert False, "unsupported param space = %s" % pspace
            elif ptype == "bool":
                # The actual bool parameter seems not to work in Py3 :(
                ot_param = IntegerParameter(pname, 0, 1)
            elif ptype in ("cat", "ordinal"):
                # Treat ordinal and categorical variables the same for now.
                assert "values" in api_config[pname]
                pvalues = api_config[pname]["values"]
                ot_param = EnumParameter(pname, pvalues)
            else:
                assert False, "type=%s/space=%s not handled in opentuner yet" % (ptype, pspace)
            manipulator.add_parameter(ot_param)
        return manipulator
github jansel / opentuner / examples / gccflags / gccflags.py View on Github external
def manipulator(self):
    m = manipulator.ConfigurationManipulator()
    m.add_parameter(manipulator.IntegerParameter('-O', 0, 3))
    for flag in self.cc_flags:
      m.add_parameter(manipulator.EnumParameter(flag, ['on', 'off', 'default']))
    for param in self.cc_params:
      defaults = self.cc_param_defaults[param]
      if defaults['max'] <= defaults['min']:
        defaults['max'] = float('inf')
      defaults['max'] = min(defaults['max'],
                            max(1, defaults['default']) * args.scaler)
      defaults['min'] = max(defaults['min'],
                            old_div(max(1, defaults['default']), args.scaler))

      if param == 'l1-cache-line-size':
        # gcc requires this to be a power of two or it internal errors
        m.add_parameter(manipulator.PowerOfTwoParameter(param, 4, 256))
      elif defaults['max'] > 128:
        m.add_parameter(manipulator.LogIntegerParameter(
github jansel / opentuner / examples / hpl / hpl.py View on Github external
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
github jansel / opentuner / examples / py_api / multiple_tuning_runs.py View on Github external
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
github jansel / opentuner / examples / hpl / hpl.py View on Github external
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
github jansel / opentuner / examples / mario / mario.py View on Github external
def manipulator(self):
    m = ConfigurationManipulator()
    for i in range(0, 1000):
      #bias 3:1 in favor of moving right
      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 range(0, 1000):
      m.add_parameter(IntegerParameter('jump_frame{}'.format(i), 0, 24000))
      m.add_parameter(IntegerParameter('jump_duration{}'.format(i), 1, 32))
    return m