def decide_simulation_num_per_move(self, idx): ret = read_as_int(self.config.resource.force_simulation_num_file) if ret: logger.debug(f"loaded simulation num from file: {ret}") return ret for min_idx, num in self.config.play.schedule_of_simulation_num_per_move: if idx >= min_idx: ret = num return ret
def start(config: Config): tf_util.set_session_config(per_process_gpu_memory_fraction=0.3) api_server = MultiProcessReversiModelAPIServer(config) process_num = config.play_data.multi_process_num api_server.start_serve() with Manager() as manager: shared_var = SharedVar( manager, game_idx=read_as_int(config.resource.self_play_game_idx_file) or 0) with ProcessPoolExecutor(max_workers=process_num) as executor: futures = [] for i in range(process_num): play_worker = SelfPlayWorker(config, env=ReversiEnv(), api=api_server.get_api_client(), shared_var=shared_var, worker_index=i) futures.append(executor.submit(play_worker.start))
def start(config: Config): tf_util.set_session_config(allow_growth=True) # api_server_list = [MultiProcessReversiModelAPIServer(config) for i in range(config.model.num_gpus)] api_server = MultiProcessReversiModelAPIServer(config) api_server.start_serve() process_num = config.play_data.multi_process_num # for i in range(config.model.num_gpus): # api_server_list[i].start_serve(i) # print(f'Create server on GPU#{i}') with Manager() as manager: shared_var = SharedVar( manager, game_idx=read_as_int(config.resource.self_play_game_idx_file) or 0) with ProcessPoolExecutor(max_workers=process_num) as executor: futures = [] for i in range(process_num): play_worker = SelfPlayWorker(config, env=ReversiEnv(), api=api_server.get_api_client(), shared_var=shared_var, worker_index=i) futures.append(executor.submit(play_worker.start))