コード例 #1
0
ファイル: oldtuner.py プロジェクト: hellok/PetaBricks
def getChoiceSites(tx):
  getSiteRe = re.compile( re.escape(nameof(tx)) + "_([0-9]*)_lvl[0-9]*_.*" )
  getSite=lambda t: int(getSiteRe.match(nameof(t)).group(1))
  #it would be nice to export this data, for now parse it from tunable names
  sites=[]
  sites.extend(map(getSite, getTunables(tx,"algchoice.cutoff")))
  sites.extend(map(getSite, getTunables(tx,"algchoice.alg")))
  return list(set(sites))
コード例 #2
0
def printTx(tx, depth, loops):
    t = len(getTunables(tx, "system.cutoff.splitsize"))
    cs = len(getChoiceSites(tx))
    if loops == 0:
        t += len(getTunables(tx, "system.cutoff.sequential"))
    print ''.ljust(
        2 *
        depth) + ' - ' + nameof(tx) + " (%d choice site, %d cutoffs)" % (cs, t)
コード例 #3
0
def getChoiceSites(tx):
    getSiteRe = re.compile(re.escape(nameof(tx)) + "_([0-9]*)_lvl[0-9]*_.*")
    getSite = lambda t: int(getSiteRe.match(nameof(t)).group(1))
    #it would be nice to export this data, for now parse it from tunable names
    sites = []
    sites.extend(map(getSite, getTunables(tx, "algchoice.cutoff")))
    sites.extend(map(getSite, getTunables(tx, "algchoice.alg")))
    return list(set(sites))
コード例 #4
0
def getChoiceSiteWeight(tx, site, cutoffs):
    getSiteRe = re.compile(re.escape(nameof(tx)) + "_([0-9]*)_lvl[0-9]*_.*")
    getSite = lambda t: int(getSiteRe.match(nameof(t)).group(1))
    tunables = filter(lambda x: getSite(x) == site,
                      getTunables(tx, "algchoice.alg"))
    algcounts = map(
        lambda x: int(x.getAttribute("max")) - int(x.getAttribute("min")),
        tunables)
    return reduce(max, algcounts, 1) + len(cutoffs)
コード例 #5
0
ファイル: oldtuner.py プロジェクト: hellok/PetaBricks
def printTx(tx, depth, loops):
  t = len(getTunables(tx, "system.cutoff.splitsize"))
  cs = len(getChoiceSites(tx))
  if loops == 0:
    t+=len(getTunables(tx, "system.cutoff.sequential"))
  print ''.ljust(2*depth) + ' - ' + nameof(tx) + " (%d choice site, %d cutoffs)"%(cs,t)
コード例 #6
0
ファイル: oldtuner.py プロジェクト: hellok/PetaBricks
def getChoiceSiteWeight(tx, site, cutoffs):
  getSiteRe = re.compile( re.escape(nameof(tx)) + "_([0-9]*)_lvl[0-9]*_.*" )
  getSite=lambda t: int(getSiteRe.match(nameof(t)).group(1))
  tunables=filter(lambda x: getSite(x)==site, getTunables(tx,"algchoice.alg"))
  algcounts=map(lambda x: int(x.getAttribute("max"))-int(x.getAttribute("min")),tunables) 
  return reduce(max, algcounts, 1)+len(cutoffs)