Skip to content

Commit ceb1832

Browse files
committed
Added cpu limit
1 parent d421a83 commit ceb1832

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

rocketpy/simulation/monte_carlo.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -304,8 +304,8 @@ def __run_in_parallel(self, append, light_mode, n_workers=None):
304304
parallel_start = time()
305305
processes = []
306306

307-
if n_workers is None:
308-
n_workers = os.cpu_count()
307+
if n_workers is None or n_workers > os.cpu_count() - 2: # leave 2 cores for the writer workers
308+
n_workers = os.cpu_count() - 2
309309

310310
# get the size of the serialized dictionary
311311
inputs_size, results_size = self.__get_export_size(light_mode)

0 commit comments

Comments
 (0)