peft.py 文件源码

python
阅读 44 收藏 0 点赞 0 评论 0

项目:pysimgrid 作者: alexmnazarenko 项目源码 文件源码
def oct_dict(cls, nxgraph, platform_model):
    """
    Build optimistic cost table as an dict task->array.

    Args:
      nxgraph: networkx representation of task graph
      platform_model: platform linear model
    """
    result = dict()
    for task in networkx.topological_sort(nxgraph, reverse=True):
      oct_row = numpy.zeros(platform_model.host_count)
      if not nxgraph[task]:
        result[task] = oct_row
        continue
      for host, idx in platform_model.host_map.items():
        child_results = []
        for child, edge_dict in nxgraph[task].items():
          row = result[child].copy()
          row += child.amount / platform_model.speed
          comm_cost = numpy.ones(platform_model.host_count) * edge_dict["weight"] / platform_model.mean_bandwidth
          comm_cost += platform_model.mean_latency
          comm_cost[idx] = 0
          row += comm_cost
          child_results.append(row.min())
        oct_row[idx] = max(child_results)
      result[task] = oct_row
    return result
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号