Skip to content

Commit 6c88e85

Browse files
committed
try with threadpoole executor
1 parent 23d2f23 commit 6c88e85

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

sklbench/runner/implementation.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
import argparse
1919
import json
20-
from multiprocessing import get_context
20+
from concurrent.futures import ThreadPoolExecutor
2121
from typing import Dict, List, Tuple, Union
2222

2323
from psutil import cpu_count
@@ -102,8 +102,8 @@ def run_benchmarks(args: argparse.Namespace) -> int:
102102
logger.debug(f"Unique dataset names to load:\n{list(dataset_cases.keys())}")
103103
n_proc = min([16, cpu_count(), n_datasets])
104104
logger.info(f"Prefetching {n_datasets} datasets with {n_proc} processes")
105-
with get_context("spawn").Pool(n_proc) as pool:
106-
pool.map(load_data_with_cleanup, dataset_cases.values())
105+
with ThreadPoolExecutor(max_workers=n_proc) as executor:
106+
list(executor.map(load_data_with_cleanup, dataset_cases.values()))
107107

108108
# run bench_cases
109109
return_code, result = call_benchmarks(

0 commit comments

Comments
 (0)