You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(Multiprocessing): Fully disable multiprocessing when not used (#281)
This PR fully disables multiprocessing when `max_processes = 1`. This
speeds up execution on windows based systems as the overhead of spawning
processing using `spawn` context is large. For this reason, this PR also
disabled the multiprocessing checkpointing tests for all systems not
running Linux since Linux by default uses `fork` which comes with less
overhead. Finally, a better error message is given when users runs
unguarded benchmarks (main script is not wrapped in `if __name__ ==
'__main__'`) while using multiprocessing (`max_processes > 1`).
closes#279
Copy file name to clipboardExpand all lines: docs/source/user.rst
+32-25Lines changed: 32 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,6 +22,12 @@ Generally benchmark execution involves three steps:
22
22
2. Compute metrics from the benchmark results, which returns a :class:`~decent_bench.benchmark.MetricResult` object.
23
23
3. Display the computed metrics in tables and plots.
24
24
25
+
Note:
26
+
When running benchmarks, be sure to guard the execution code with ``if __name__ == "__main__":`` to avoid issues with multiprocessing on some platforms (e.g., Windows).
27
+
This is a common Python practice to ensure that the benchmark code only runs when the script is executed directly, and not when it is imported as a module or when worker
28
+
processes are spawned for multiprocessing. If you forget to include this guard and you are using multiprocessing, i.e. with ``max_processes > 1`` in :func:`~decent_bench.benchmark.benchmark`,
29
+
you may encounter errors or unexpected behavior due to the way multiprocessing works on different platforms.
30
+
25
31
**The following is a working example. The remainder of the user guide will be updated soon.**
26
32
27
33
.. code-block:: python
@@ -36,39 +42,40 @@ Generally benchmark execution involves three steps:
0 commit comments