Skip to content

fix(benchmate): disable warden on platforms 'darwin' and 'win32'#386

Closed
srygaard wants to merge 2 commits intomila-iqia:masterfrom
srygaard:srygaard/warden-platform-support
Closed

fix(benchmate): disable warden on platforms 'darwin' and 'win32'#386
srygaard wants to merge 2 commits intomila-iqia:masterfrom
srygaard:srygaard/warden-platform-support

Conversation

@srygaard
Copy link
Copy Markdown
Contributor

Context:

While becoming familiar with milabench, I attempted to run the project locally on my MacBook but quickly discovered Linux specific functionality in the path of milabench install.

Local development is useful when working on improvements that don't need more compute than a workstation.

Issue:

Upon running milabench install, the subprocess reaper logic in benchmate/benchmate/warden.py failed to find PR_SET_CHILD_SUBREAPER in libc on MacOS. This reparenting functionality does not exist on Mac - or Win32 - which leads to the following exception:

(milabench) stevenrygaard@MacBookPro milabench % milabench install --select fp32
Traceback (most recent call last):
  File "/Users/stevenrygaard/proj/milabench/.venv/bin/milabench", line 3, in <module>
    from milabench.cli import main
  File "/Users/stevenrygaard/proj/milabench/milabench/cli/__init__.py", line 8, in <module>
    from .compare import cli_compare
  File "/Users/stevenrygaard/proj/milabench/milabench/cli/compare.py", line 6, in <module>
    from ..common import _read_reports
  File "/Users/stevenrygaard/proj/milabench/milabench/common.py", line 15, in <module>
    from milabench.alt_async import proceed
  File "/Users/stevenrygaard/proj/milabench/milabench/alt_async.py", line 13, in <module>
    from benchmate.warden import destroy
  File "/Users/stevenrygaard/proj/milabench/.venv/lib/python3.12/site-packages/benchmate/warden.py", line 482, in <module>
    subreaper()
  File "/Users/stevenrygaard/proj/milabench/.venv/lib/python3.12/site-packages/benchmate/warden.py", line 480, in subreaper
    libc.prctl(PR_SET_CHILD_SUBREAPER, 1, 0, 0, 0)
    ^^^^^^^^^^
  File "/Users/stevenrygaard/.local/share/uv/python/cpython-3.12.13-macos-aarch64-none/lib/python3.12/ctypes/__init__.py", line 392, in __getattr__
    func = self.__getitem__(name)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/stevenrygaard/.local/share/uv/python/cpython-3.12.13-macos-aarch64-none/lib/python3.12/ctypes/__init__.py", line 397, in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: dlsym(0x35c682048, prctl): symbol not found

Solution:

Since darwin (MacOS) and Win32 are currently not target platforms for milabench, this change disables the incompatible pipe and process context managers in warden. This allows minimal local execution on Mac (tested) and Windows (untested).

The call to subreaper() on import was also made conditional on the platform. A log warning is now emitted when subreaper() is skipped.

I first looked at implementing a truly cross-platform solution using psutil but found that it lacks a method of obtaining file descriptors of open pipes. If Mac/Win are to receive first-class support in the future, this will all need to be revisited.

@Delaunay
Copy link
Copy Markdown
Collaborator

Change was bundled into milabench 1.3 :)

@Delaunay Delaunay closed this Mar 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants