Skip to content

Commit e16927e

Browse files
wenx-guofacebook-github-bot
authored andcommitted
add start_idx for data recording in run_benchmarks_with_checkpoints (#349)
Summary: The run_benchmarks_with_checkpoints function generates an output path featuring the current chunk number. If the benchmarking process restarts, previous outputs will be overwritten. To avoid this and prevent file overwriting, the start_idx argument can be used to initiate chunk counting from a specific index. Reviewed By: crasanders Differential Revision: D57881813
1 parent 23ac907 commit e16927e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

aepsych/benchmark/pathos_benchmark.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ def run_benchmarks_with_checkpoints(
182182
problems: List[Problem],
183183
configs: Mapping[str, Union[str, list]],
184184
global_seed: Optional[int] = None,
185+
start_idx: int = 0,
185186
n_chunks: int = 1,
186187
n_reps_per_chunk: int = 1,
187188
log_every: Optional[int] = None,
@@ -202,6 +203,7 @@ def run_benchmarks_with_checkpoints(
202203
Lists at leaves are used to construct a cartesian product of configurations.
203204
global_seed (int, optional): Global seed to use for reproducible benchmarks.
204205
Defaults to randomized seeds.
206+
start_idx (int): The chunk number to start from after the last checkpoint. Defaults to 0.
205207
n_chunks (int): The number of chunks to break the results into. Each chunk will contain at least 1 run of every
206208
combination of problem and config.
207209
n_reps_per_chunk (int, optional): Number of repetitions to run each problem/config in each chunk.
@@ -227,7 +229,7 @@ def run_benchmarks_with_checkpoints(
227229
final_results = bench.pandas()
228230
final_results.to_csv(out_fname)
229231
else:
230-
for chunk in range(n_chunks):
232+
for chunk in range(start_idx, n_chunks+start_idx):
231233
out_fname = Path(f"{out_path}/{benchmark_name}_chunk{chunk}_out.csv")
232234

233235
intermediate_fname = Path(

0 commit comments

Comments
 (0)