help="Max number of parallel jobs" "executed from the search", ) args = parser.parse_args() if not args.game: print("--game parameter has to set an EGG-implemented game") exit(1) if not args.name: args.name = args.game.split(".")[-2] combinations = [] for sweep_file in args.sweep: combinations.extend(sweep(sweep_file)) for py_sweep_file in args.py_sweep: sweep_module = importlib.import_module(py_sweep_file) combinations.extend(sweep_module.grid()) if args.preview or args.dry_run: print(*combinations, sep="\n") print(f"Total number of combinations: {len(combinations)}") exit() if args.checkpoint_dir is None: base_dir = pathlib.PosixPath("~/nest") args.checkpoint_dir = ( base_dir / args.name / time.strftime("%Y_%m_%d_%H_%M_%S")).expanduser()
help="Checkpoint frequency, in epochs") args = parser.parse_args() if not args.game: print('--game parameter has to set an EGG-implemented game') exit(1) if not args.name: args.name = args.game.split('.')[-2] comb_id = -1 combinations = [] for sweep_file in args.sweep: combinations.extend(enumerate(sweep(sweep_file), start=comb_id + 1)) for py_sweep_file in args.py_sweep: sweep_module = importlib.import_module(py_sweep_file) combinations.extend(enumerate(sweep_module.grid(), start=comb_id + 1)) if args.root_dir is None: args.root_dir = (pathlib.PosixPath('~/nest_local') / args.name / time.strftime("%Y_%m_%d_%H_%M_%S")).expanduser() if args.preview or args.dry_run: print(*combinations, sep='\n') exit() module = importlib.import_module(args.game) pathlib.Path(args.root_dir).mkdir(parents=True)
args.name = args.game.split('.')[-2] if args.checkpoint_dir is None: args.checkpoint_dir = (pathlib.PosixPath('~/nest') / args.name / time.strftime("%Y_%m_%d_%H_%M_%S")).expanduser() module = importlib.import_module(args.game) executor = submitit.AutoExecutor(folder=args.checkpoint_dir) executor.update_parameters(timeout_min=args.time, partition=args.partition, cpus_per_task=args.ncpu, gpus_per_node=args.ngpu, name=args.name, comment=args.comment) pathlib.Path(args.checkpoint_dir).mkdir(parents=True) jobs = [] for sweep_file in args.sweep: for comb in sweep(sweep_file): runner = SlurmWrapper(module.main) if not args.no_preemption: comb.extend(['--preemptable', f'--checkpoint_freq={args.checkpoint_freq}']) comb.append(f'--checkpoint_dir={args.checkpoint_dir}') if not args.preview and not args.dry_run: job = executor.submit(runner, comb) print(f'job id {job.job_id}, args {comb}') jobs.append(job) else: print(f'{comb}')