Skip to content

Commit 0e4d243

Browse files
committed
MNT: solve number of processes issue on Windows.
1 parent 5141791 commit 0e4d243

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

rocketpy/simulation/monte_carlo.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@ def __run_in_serial(self):
283283
file.write(inputs_dict)
284284
raise error
285285

286+
# pylint: disable=too-many-statements
286287
def __run_in_parallel(self, n_workers=None):
287288
"""
288289
Runs the monte carlo simulation in parallel.
@@ -298,7 +299,8 @@ def __run_in_parallel(self, n_workers=None):
298299
None
299300
"""
300301
if n_workers is None or n_workers > os.cpu_count():
301-
n_workers = os.cpu_count()
302+
# For Windows, the number of workers must be at most os.cpu_count() - 1
303+
n_workers = os.cpu_count() - 1
302304

303305
if n_workers < 2:
304306
raise ValueError("Number of workers must be at least 2 for parallel mode.")

0 commit comments

Comments
 (0)