示例#1
0
文件: task-run.go 项目: rosrad/grid
func main() {
	var list, scope, root, lm string
	var manual bool
	flag.StringVar(&root, "root", "", "root path")
	flag.StringVar(&lm, "lm", "", "language model")
	flag.StringVar(&list, "list", "", "task list")
	flag.StringVar(&scope, "scope", "-1", "scope: number ,1-3,4,5 ")
	flag.BoolVar(&manual, "manual", false, "manual to control servers (default=false) ")
	flag.Parse()
	kaldi.Init(root, lm)
	defer kaldi.Uninit()
	kaldi.Trace().Println("task-run")
	if !manual {
		kaldi.DevInstance().AutoSync()
		kaldi.DevInstance().SortGpu()
		kaldi.DevInstance().PrintNodes(true)
		kaldi.DevInstance().SortCpu()
		kaldi.DevInstance().PrintNodes(false)
	}

	if list != "" {
		RunMultiTask(list)
		return
	}

	if flag.NArg() < 1 {
		fmt.Println("No enough args!")
		return
	}
	tag := flag.Arg(0)
	kaldi.Trace().Println("tag", tag)
	RunTask(tag, scope)
}
示例#2
0
文件: grid-svr.go 项目: rosrad/grid
func main() {
	kaldi.Init("", "")
	defer kaldi.Uninit()
	kaldi.DevInstance().AutoSync()
	kaldi.DevInstance().SortGpu()
	kaldi.DevInstance().PrintNodes(true)
	kaldi.DevInstance().SortCpu()
	kaldi.DevInstance().PrintNodes(false)

	rpc.Register(kaldi.DevInstance().RPC())
	l, e := net.Listen("tcp", ":9001")
	if e != nil {
		kaldi.Err().Println("Grid Svr listen error:", e)
	}

	rpc.Accept(l)
}