Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MacOS support #119

Merged
merged 35 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
4575ae1
Changed keep_order to mp.Value instead of mp.Event
sybrenjansen Jan 19, 2024
bbcae41
Changed workers_dead from list of mp.Event to single mp.Array
sybrenjansen Jan 19, 2024
358d10a
Changed kill_signal_received from mp.Event to mp.Value
sybrenjansen Jan 19, 2024
24fd268
Changed progress_bar_shutdown from mp.Event to mp.Value
sybrenjansen Jan 19, 2024
b634ff2
Changed worker_working_on_job from list of Values to single Array
sybrenjansen Jan 20, 2024
b65490c
Removed type:ignore and used Optional type instead
sybrenjansen Jan 21, 2024
5068baa
Changed worker_restart_array from list of Values to single Array
sybrenjansen Jan 21, 2024
0c1ef20
Misc stuff I forgot
sybrenjansen Jan 21, 2024
0c72e48
Changed results_received from list of Values to single Array
sybrenjansen Jan 21, 2024
20e2cbf
Reducing access to synchronized worker_working_on_job object in timeo…
sybrenjansen Jan 21, 2024
56a8148
workers_time_task_started changed from list of Values to list of Arrays
sybrenjansen Jan 22, 2024
24b6ef4
tasks_completed_array changed from list of Values to list of Arrays
sybrenjansen Jan 22, 2024
ddd55f6
Misc
sybrenjansen Jan 22, 2024
b6f29b3
Fixed the leaked semaphores on macos
sybrenjansen Jan 27, 2024
54eeff3
Removed the need to reconnect to the insights manager
sybrenjansen Jan 27, 2024
a1471ae
sphinx docs config updates
sybrenjansen Jan 28, 2024
442b63b
* Added support for macOS
sybrenjansen Jan 31, 2024
74c4a0d
Reverting conf.py in docs
sybrenjansen Jan 31, 2024
944cfad
* Reduced number of leaked semaphores in dashboard.
sybrenjansen Feb 5, 2024
415eb29
Fixed leaked semaphores for dashboard when using MacOS
sybrenjansen Feb 5, 2024
cfa3e1a
Merge branch 'master' of github.com:sybrenjansen/mpire into use-less-…
sybrenjansen Feb 5, 2024
9bc1a19
Fix for resource loading in py38
sybrenjansen Feb 6, 2024
3830122
Using importlib_resources as a fallback for Python < 3.9
sybrenjansen Feb 6, 2024
d42e0d8
Fix for macos ulimit and drain queue
sybrenjansen Feb 6, 2024
f325ecc
Attempted leaked semaphore fix for macos
sybrenjansen Feb 6, 2024
5b68260
Added general overview of how comms work
sybrenjansen Feb 14, 2024
2256a97
Replaced using datetime.now.timestamp by time.time
sybrenjansen Feb 14, 2024
cd0f0af
Change _workers_time_task_started from list of arrays to single array
sybrenjansen Feb 14, 2024
dea2ed8
Change importlib_resources_files alias to simply resource
sybrenjansen Feb 14, 2024
272f1a0
Changed _worker_running_task to include the RLock instead of creating…
sybrenjansen Feb 14, 2024
d871676
Fix for dealing with += operations on Arrays whic are not atomic
sybrenjansen Feb 14, 2024
97229dc
Changed patching mpire...time.time to simply time.time
sybrenjansen Feb 14, 2024
2aac28c
Trying something for windows deadlocks
sybrenjansen Feb 14, 2024
3371d82
- Potential fix for windows deadlock
sybrenjansen Feb 14, 2024
dc7bf1c
One small change for Windows. I'll stop now, I promise
sybrenjansen Feb 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, windows-latest]
os: [ubuntu-20.04, windows-latest, macos-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
Expand All @@ -31,6 +31,11 @@ jobs:
pip install .[dashboard]
pip install .[dill]
pip install .[testing]
- name: Set ulimit for macOS
if: runner.os == 'macos-latest'
run: |
ulimit -a
ulimit -n 1024
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@ _build
dist
*.egg-info
.eggs
.pytest_cache

# MacOS
.DS_store
3 changes: 2 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ Features
- Optionally utilizes dill_ as serialization backend through multiprocess_, enabling parallelizing more exotic objects,
lambdas, and functions in iPython and Jupyter notebooks.

MPIRE is tested on Linux and Windows. For Windows and macOS users, there are a few minor known caveats, which are documented in the Troubleshooting_ chapter.
MPIRE is tested on Linux, macOS, and Windows. For Windows and macOS users, there are a few minor known caveats, which
are documented in the Troubleshooting_ chapter.

.. _benchmarks: https://towardsdatascience.com/mpire-for-python-multiprocessing-is-really-easy-d2ae7999a3e9
.. _multiprocess: https://github.com/uqfoundation/multiprocess
Expand Down
12 changes: 11 additions & 1 deletion docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@ Changelog
=========

Unreleased
----------
==========

* Added support for macOS (`#27`_, `#79`_, `#91`_)

- Fixes memory leaks on macOS
- Reduced the amount of semaphores used
- Issues a warning when ``cpu_ids`` is used on macOS

* Added :meth:`mpire.dashboard.set_stacklevel` to set the stack level in the dashboard. This influences what line to
display in the 'Invoked on line' section. (`#118`_)
Expand All @@ -12,9 +18,13 @@ Unreleased
(`#117`_)
* Make it possible to reuse the same `progress_bar_options` without raising warnings (`#117`_)

.. _#27: https://github.com/sybrenjansen/mpire/issues/27
.. _#79: https://github.com/sybrenjansen/mpire/issues/79
.. _#91: https://github.com/sybrenjansen/mpire/issues/91
.. _#117: https://github.com/sybrenjansen/mpire/pull/117
.. _#118: https://github.com/sybrenjansen/mpire/pull/118


2.9.0
-----

Expand Down
4 changes: 2 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ Features
- Optionally utilizes dill_ as serialization backend through multiprocess_, enabling parallelizing more exotic objects,
lambdas, and functions in iPython and Jupyter notebooks.

MPIRE has been tested on both Linux and Windows. There are a few minor known caveats for Windows users, which can be
found at :ref:`troubleshooting_windows`.
MPIRE has been tested on Linux, macOS, and Windows. There are a few minor known caveats for Windows and macOS users,
which can be found at :ref:`troubleshooting_windows`.

.. _benchmarks: https://towardsdatascience.com/mpire-for-python-multiprocessing-is-really-easy-d2ae7999a3e9
.. _dill: https://pypi.org/project/dill/
Expand Down
13 changes: 6 additions & 7 deletions docs/troubleshooting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,6 @@ define your function in a file that can be imported by the child process, or you
Windows
-------

Windows support has some caveats:

* When using ``dill`` and an exception occurs, or when the exception occurs in an exit function, it can print additional
``OSError`` messages in the terminal, but they can be safely ignored.
* The ``mpire-dashboard`` script does not work on Windows.
Expand All @@ -161,8 +159,9 @@ Windows support has some caveats:
macOS
-----

macOS is not yet officially supported. It seems to work mostly fine, with these caveats:

* Use ``ulimit -n <number>`` to increase the limit of the number of open files.
This is required because mpire uses a lot of file-descriptor based synchronization primitives.
`<Number>` should be large enough to accomodate all of mpire's file descriptors, eg. `<number> = 65536`.
* When encountering ``OSError: [Errno 24] Too many open files`` errors, use ``ulimit -n <number>`` to increase the
limit of the number of open files. This is required because MPIRE uses file-descriptor based synchronization
primitives and macOS has a very low default limit. For example, MPIRE uses about 190 file descriptors when using 10
workers.
* Pinning of processes to CPU cores is not supported on macOS. This is because macOS does not support the
``sched_setaffinity`` system call. A warning will be printed when trying to use this feature.
2 changes: 1 addition & 1 deletion docs/usage/workerpool/cpu_pinning.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ CPU IDs have to be positive integers, not exceeding the number of CPUs available

.. note::

Pinning processes to CPU IDs doesn't work when using threading.
Pinning processes to CPU IDs doesn't work when using threading or when you're on macOS.
Loading
Loading