예제 #1
0
파일: main.go 프로젝트: callistoaz/3
func main() {
	flag.Parse()
	log.SetPrefix("")
	log.SetFlags(0)

	cuda.Init(*flag_gpu)
	runtime.GOMAXPROCS(runtime.NumCPU())
	cuda.Synchronous = *flag_sync
	if *flag_version {
		printVersion()
	}

	timer.Timeout = *flag_launchtimeout
	if *flag_launchtimeout != 0 {
		cuda.Synchronous = true
	}

	engine.TestDemag = *flag_selftest

	// used by bootstrap launcher to test cuda
	// successful exit means cuda was initialized fine
	if *flag_test {
		fmt.Println(cuda.GPUInfo)
		os.Exit(0)
	}

	engine.CacheDir = *flag_cachedir
	if *flag_cpuprof {
		prof.InitCPU(".")
	}
	if *flag_memprof {
		prof.InitMem(".")
	}
	defer prof.Cleanup()
	defer engine.Close() // flushes pending output, if any

	defer func() {
		if *flag_sync {
			timer.Print(os.Stdout)
		}
	}()

	if *flag_vet {
		vet()
		return
	}

	switch flag.NArg() {
	case 0:
		runInteractive()
	case 1:
		runFileAndServe(flag.Arg(0))
	default:
		RunQueue(flag.Args())
	}
}
예제 #2
0
파일: engine.go 프로젝트: jsampaio/3
// Cleanly exits the simulation, assuring all output is flushed.
func Close() {
	drainOutput()
	Table.flush()
	if logfile != nil {
		logfile.Close()
	}
	if *Flag_sync {
		timer.Print(os.Stdout)
	}

}