Skip to content

Commit

Permalink
Merge pull request #783 from callumgassner/polar-processlmt
Browse files Browse the repository at this point in the history
[FIX] Polar: limit process count to prevent crashes on Windows
  • Loading branch information
markotoplak authored Jan 6, 2025
2 parents 5c86112 + 460a6d9 commit 3396b40
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 7 additions & 0 deletions doc/widgets/polar.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ Multiple Inputs
![](images/Polar-Example2.PNG)


Advanced
--------

Unlike the majority of widgets, **Polar** uses multiple processes during fitting to improve
responsiveness and performance. By default this is limited to 2 extra processes, but this can be
overridden by setting the environment variable `QUASAR_N_PROCESSES` to the desired number, or `all`
to use the default value returned by `os.cpu_count()`.


References
Expand Down
4 changes: 3 additions & 1 deletion orangecontrib/spectroscopy/widgets/owpolar.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,10 @@ def unique_xys(images, map_x, map_y):
def start_compute(ulsxs, ulsys, names, shapes, dtypes, polangles, state):
# single core processing is faster for small data sets and small number of selected features
# if <data size> > x:
ncpu = os.cpu_count()
# ncpu = os.cpu_count()
# ncpu = 6
env_proc = os.getenv('QUASAR_N_PROCESSES')
ncpu = os.cpu_count() if env_proc == "all" else int(env_proc) if env_proc else min(2, os.cpu_count())
tulsys = np.array_split(ulsys, ncpu)
state.set_status("Calculating...")
threads=[]
Expand Down

0 comments on commit 3396b40

Please sign in to comment.