def main(): global LstmCellTypes print("Benchmarking LSTMs.") better_exchook.install() print("Args:", " ".join(sys.argv)) arg_parser = ArgumentParser() arg_parser.add_argument("cfg", nargs="*", help="opt=value, opt in %r" % sorted(base_settings.keys())) arg_parser.add_argument("--no-cpu", action="store_true") arg_parser.add_argument("--no-gpu", action="store_true") arg_parser.add_argument("--selected", help="comma-separated list from %r" % LstmCellTypes) arg_parser.add_argument("--no-setup-tf-thread-pools", action="store_true") args = arg_parser.parse_args() for opt in args.cfg: key, value = opt.split("=", 1) assert key in base_settings value_type = type(base_settings[key]) base_settings[key] = value_type(value) print("Settings:") pprint(base_settings) log.initialize(verbosity=[4]) print("Returnn:", describe_crnn_version(), file=log.v3) print("TensorFlow:", describe_tensorflow_version(), file=log.v3) print("Python:", sys.version.replace("\n", ""), sys.platform) if not args.no_setup_tf_thread_pools: setup_tf_thread_pools(log_file=log.v2) else: print("Not setting up the TF thread pools. Will be done automatically by TF to number of CPU cores.") if args.no_gpu: print("GPU will not be used.") else: print("GPU available: %r" % is_gpu_available()) print_available_devices() if args.selected: LstmCellTypes = args.selected.split(",") benchmarks = {} if not args.no_gpu and is_gpu_available(): for lstm_unit in LstmCellTypes: benchmarks["GPU:" + lstm_unit] = benchmark(lstm_unit=lstm_unit, use_gpu=True) if not args.no_cpu: for lstm_unit in LstmCellTypes: if lstm_unit in GpuOnlyCellTypes: continue benchmarks["CPU:" + lstm_unit] = benchmark(lstm_unit=lstm_unit, use_gpu=False) print("-" * 20) print("Settings:") pprint(base_settings) print("Final results:") for t, lstm_unit in sorted([(t, lstm_unit) for (lstm_unit, t) in sorted(benchmarks.items())]): print(" %s: %s" % (lstm_unit, hms_fraction(t))) print("Done.")
def crnnGreeting(configFilename=None, commandLineOptions=None): print("CRNN starting up, version %s, pid %i, cwd %s" % (describe_crnn_version(), os.getpid(), os.getcwd()), file=log.v3) if configFilename: print("CRNN config: %s" % configFilename, file=log.v4) if os.path.islink(configFilename): print("CRNN config is symlink to: %s" % os.readlink(configFilename), file=log.v4) if commandLineOptions is not None: print("CRNN command line options: %s" % (commandLineOptions, ), file=log.v4)
def returnnGreeting(configFilename=None, commandLineOptions=None): print( "RETURNN starting up, version %s, date/time %s, pid %i, cwd %s, Python %s" % (describe_crnn_version(), time.strftime("%Y-%m-%d-%H-%M-%S (UTC%z)"), os.getpid(), os.getcwd(), sys.executable), file=log.v3) if configFilename: print("RETURNN config: %s" % configFilename, file=log.v4) if os.path.islink(configFilename): print("RETURNN config is symlink to: %s" % os.readlink(configFilename), file=log.v4) if commandLineOptions is not None: print("RETURNN command line options: %s" % (commandLineOptions, ), file=log.v4)
def init(configFilename, commandLineOptions): initBetterExchook() initThreadJoinHack() initConfig(configFilename, commandLineOptions) initLog() print >> log.v3, "CRNN starting up, version %s, pid %i" % (describe_crnn_version(), os.getpid()) print >> log.v3, "Theano:", describe_theano_version() initFaulthandler() if config.value('task', 'train') == "theano_graph": config.set("multiprocessing", False) if config.bool('multiprocessing', True): initCudaNotInMainProcCheck() if config.bool('ipython', False): initIPythonKernel() initConfigJsonNetwork() devices = initDevices() if needData(): initData() printTaskProperties(devices) initEngine(devices)
def crnnGreeting(): print >> log.v3, "CRNN starting up, version %s, pid %i" % ( describe_crnn_version(), os.getpid())