Beispiel #1
0
 def test_mysarkar_scheduler(self):
     lgnames = ['cont_img.json', 'lofar_std.json', 'chiles_two.json', 'test_grpby_gather.json', 'chiles_two_dev1.json', 'chiles_simple.json']
     #lgnames = [lgnames[1]]
     tgt_partnum = [20, 15, 15, 10, 10, 5]
     mdp = 8
     s_matrix = True
     for j, lgn in enumerate(lgnames):
         fp = pkg_resources.resource_filename('dfms.dropmake', 'web/{0}'.format(lgn))
         lg = LG(fp)
         drop_list = lg.unroll_to_tpl()
         #logger.info( "MySarkarScheduler Partitioning ", lgn)
         lll = len(lgn) + len("Partitioning ") + 1
         #logger.info( "=" * lll)
         mys = MySarkarScheduler(drop_list, max_dop=mdp)
         num_parts_done, lpl, ptime, parts = mys.partition_dag()
         #logger.info( "{3} partitioned: parts = {0}, lpl = {1}, ptime = {2:.2f}".format(num_parts_done, lpl, ptime, lgn))
         if (s_matrix):
             for i, part in enumerate(parts):
                 if (part.cardinality > 0):
                     ma = part.schedule.schedule_matrix
                     ga = DAGUtil.ganttchart_matrix(part.schedule._dag, part.schedule._topo_sort)
                     # print "Partition ", i
                     # print "scheduling matrix: ", ma.shape
                     # print ma
                     # print "ganttchart matrix: ", ga.shape
                     # print ga
                     # print "Workload: ", part.schedule.workload
                     # print
         mys.merge_partitions(tgt_partnum[j])
Beispiel #2
0
 def test_mysarkar_scheduler(self):
     lgnames = ['cont_img.json', 'lofar_std.json', 'chiles_two.json', 'test_grpby_gather.json', 'chiles_two_dev1.json', 'chiles_simple.json']
     #lgnames = [lgnames[1]]
     tgt_partnum = [20, 15, 15, 10, 10, 5]
     mdp = 8
     s_matrix = True
     for j, lgn in enumerate(lgnames):
         fp = pkg_resources.resource_filename('dfms.dropmake', 'web/{0}'.format(lgn))
         lg = LG(fp)
         drop_list = lg.unroll_to_tpl()
         #logger.info( "MySarkarScheduler Partitioning ", lgn)
         lll = len(lgn) + len("Partitioning ") + 1
         #logger.info( "=" * lll)
         mys = MySarkarScheduler(drop_list, max_dop=mdp)
         num_parts_done, lpl, ptime, parts = mys.partition_dag()
         #logger.info( "{3} partitioned: parts = {0}, lpl = {1}, ptime = {2:.2f}".format(num_parts_done, lpl, ptime, lgn))
         if (s_matrix):
             for i, part in enumerate(parts):
                 if (part.cardinality > 0):
                     ma = part.schedule.schedule_matrix
                     ga = DAGUtil.ganttchart_matrix(part.schedule._dag, part.schedule._topo_sort)
                     # print "Partition ", i
                     # print "scheduling matrix: ", ma.shape
                     # print ma
                     # print "ganttchart matrix: ", ga.shape
                     # print ga
                     # print "Workload: ", part.schedule.workload
                     # print
         mys.merge_partitions(tgt_partnum[j])
Beispiel #3
0
    def get_gantt_chart(self, pgt_id, json_str=True):
        """
        Return:
            the gantt chart matrix (numarray) given a PGT id
        """
        pgt = self.get_pgt(pgt_id)
        if (pgt is None):
            raise GraphException("PGT {0} not found".format(pgt_id))
        try:
            gcm = DAGUtil.ganttchart_matrix(pgt.dag)
        except SchedulerException:
            topo_sort = nx.topological_sort(pgt.dag)
            DAGUtil.label_schedule(pgt.dag, topo_sort=topo_sort)
            gcm = DAGUtil.ganttchart_matrix(pgt.dag, topo_sort=topo_sort)

        if (json_str):
            gcm = json.dumps(gcm.tolist())
        return gcm
Beispiel #4
0
    def get_gantt_chart(self, pgt_id, json_str=True):
        """
        Return:
            the gantt chart matrix (numarray) given a PGT id
        """
        pgt = self.get_pgt(pgt_id)
        if (pgt is None):
            raise GraphException("PGT {0} not found".format(pgt_id))
        try:
            gcm = DAGUtil.ganttchart_matrix(pgt.dag)
        except SchedulerException:
            topo_sort = nx.topological_sort(pgt.dag)
            DAGUtil.label_schedule(pgt.dag, topo_sort=topo_sort)
            gcm = DAGUtil.ganttchart_matrix(pgt.dag, topo_sort=topo_sort)

        if (json_str):
            gcm = json.dumps(gcm.tolist())
        return gcm