项目文件夹

文件
Lingfan Yu deb653f8dc [Runtime] Scheduler and Executor (#140)
* executor api

* draft executor interface

* WIP

* revert changes to avoid conflict with api change

* core scheduling logic

* WIP: build graph adj

* incidence matrix for in edges

* support incidence matrix for partial recv nodes

* improve

* build adjmat in scheduler

* graph store

* get degree bucketing schedule

* connect to c++ degree bucketing

* conceptual executor creation code

* executor comments

* fix

* more executor comments

* WIP: full send_and_recv schedule

* most schedulers

* simplify scheduler

* executors

* runtime

* builtin function base class

* adj indices and shape

* completely refactor scheduler

* rename and move bundled out to function.py

* use_edge_feature in msg func

* rewrite scheduler

* node edge executor

* connect with graph api

* handle zero degree

* misc

* fix test cases

* fix a good many bugs...

* remove old scheduler

* push and pull

* fix send recv

* c++ lint

* fix batched send recv

* hot fix for mxnet

* typo

* write back executor

* apply node edge

* clean up, doc string

* fix as requested

* refactor

* fix

* WIP

* WIP

* ir draft

* more on ir

* WIP: spmv schedule

* WIP

* recv schedule

* refactor

* WIP

* snr degree bucketing

* snr scheduler

* move prog to graph.py; rename

* unittest for send/recv

* remove some legacy codes

* WIP: update_all

* pass test_basics

* passed all current utests

* more utests; fix mx utest

* WIP: fixing zero deg initial value

* some tests

* fix 0deg problem

* fix mx

* fix mx

* some notes

* fix as requested
2018-11-22 12:15:50 -05:00

49 行
1.1 KiB
Python

from __future__ import absolute_import
from contextlib import contextmanager
from .registry import IR_REGISTRY
class Prog(object):
"""The program."""
def __init__(self):
self.execs = []
self.varcount = 0
def issue(self, exe):
self.execs.append(exe)
def pprint_exe(self, exe):
argstr = ', '.join([str(av) for av in exe.arg_vars()])
if exe.ret_var() is None:
# stmt
print("%s(%s)" % (
IR_REGISTRY[exe.opcode()]['name'],
argstr))
else:
print("%s %s = %s(%s)" % (
exe.ret_var().typestr(),
exe.ret.name,
IR_REGISTRY[exe.opcode()]['name'],
argstr))
def pprint(self):
for exe in self.execs:
self.pprint_exe(exe)
_current_prog = None
def get_current_prog():
global _current_prog
return _current_prog
def set_current_prog(prog):
global _current_prog
_current_prog = prog
@contextmanager
def prog():
set_current_prog(Prog())
yield get_current_prog()
set_current_prog(None)