How to use the opentuner.resultsdb.models.Result 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 jbosboom / streamjit / lib / opentuner / streamjit / onlinetuner.py View on Github external
print self.trycount
		cfg = desired_result.configuration.data
		#self.niceprint(cfg)
		self.sdk.sendmsg("%s\n"%cfg)
		msg = self.sdk.recvmsg()
		if (msg == "exit\n"):
			#data = raw_input ( "exit cmd received. Press Keyboard to exit..." )
			self.sdk.close()
			sys.exit(1)
		exetime = float(msg)
		if exetime < 0:
			print "Error in execution"
			return opentuner.resultsdb.models.Result(state='ERROR', time=float('inf'))
		else:	
			print "Execution time is %f"%exetime
			return opentuner.resultsdb.models.Result(time=exetime)
github jansel / opentuner / opentuner / utils / stats_matplotlib.py View on Github external
q = (db.query(resultsdb.models.TuningRun)
            .filter_by(state='COMPLETE')
            .order_by('name'))
    if labels:
      q = q.filter(resultsdb.models.TuningRun.name.in_(labels))
    for tr in q:
      dir_label_runs[run_label(tr)][run_label(tr)].append((tr, db))
  all_run_ids = list()
  returned_values = {}
  for d, label_runs in list(dir_label_runs.items()):
    all_run_ids = list(map(_[0].id, itertools.chain(*list(label_runs.values()))))
    session = list(label_runs.values())[0][0][1]
    objective = list(label_runs.values())[0][0][0].objective

    q = (session.query(resultsdb.models.Result)
         .filter(resultsdb.models.Result.tuning_run_id.in_(all_run_ids))
         .filter(resultsdb.models.Result.time < float('inf'))
         .filter_by(was_new_best=True, state='OK'))
    total = q.count()
    q = objective.filter_acceptable(q)
    acceptable = q.count()
    q = q.order_by(*objective.result_order_by_terms())
    best = q.limit(1).one()
    worst = q.offset(acceptable - 1).limit(1).one()

    for label, runs in sorted(label_runs.items()):
      (mean_values, percentile_values) = combined_stats_over_time(label, runs, objective, worst, best)
      returned_values[label] = (mean_values, percentile_values)
      final_scores = list()
      for run, session in runs:
        try:
          final = (session.query(resultsdb.models.Result)
github jansel / opentuner / examples / tsp / tsp.py View on Github external
def run(self, desired_result, input, limit):
        cfg = desired_result.configuration.data
        p = cfg[0]      # cheating: should use manipulator function
        t = self.eval_path(p)
        return opentuner.resultsdb.models.Result(time=t)
github jansel / opentuner / examples / gccflags / gccflags.py View on Github external
tmp_dir = self.get_tmpdir(result_id)
    output_dir = '%s/%s' % (tmp_dir, args.output)
    try:
      run_result = self.call_program([output_dir], limit=limit,
                                     memory_limit=args.memory_limit)
    except OSError:
      return Result(state='ERROR', time=float('inf'))

    if run_result['returncode'] != 0:
      if run_result['timeout']:
        return Result(state='TIMEOUT', time=float('inf'))
      else:
        log.error('program error')
        return Result(state='ERROR', time=float('inf'))

    return Result(time=run_result['time'])
github jansel / opentuner / examples / gccflags / gccflags.py View on Github external
def run_precompiled(self, desired_result, input, limit, compile_result,
                      result_id):
    if self.args.force_killall:
      os.system('killall -9 cc1plus 2>/dev/null')
    # Make sure compile was successful
    if compile_result == self.compile_results['timeout']:
      return Result(state='TIMEOUT', time=float('inf'))
    elif compile_result == self.compile_results['error']:
      return Result(state='ERROR', time=float('inf'))

    tmp_dir = self.get_tmpdir(result_id)
    output_dir = '%s/%s' % (tmp_dir, args.output)
    try:
      run_result = self.call_program([output_dir], limit=limit,
                                     memory_limit=args.memory_limit)
    except OSError:
      return Result(state='ERROR', time=float('inf'))

    if run_result['returncode'] != 0:
      if run_result['timeout']:
        return Result(state='TIMEOUT', time=float('inf'))
      else:
        log.error('program error')