Overview of MPIRE features
masterMPIRE (MultiProcessing Is Really Easy) is a Python package designed to be faster and more user-friendly than the standard multiprocessing module. It combines the map-like functionality of multiprocessing.Pool with the benefits of copy-on-write shared objects (available on Linux/macOS via the fork start method).
Key capabilities include:
- Map-like functions: Supports
map,map_unordered,imap,imap_unordered,apply, andapply_async. - Worker State Management: Each worker can maintain its own state using
worker_initandworker_exitfunctions. This is ideal for loading large models or datasets once per worker to avoid expensive serialization. - Progress Tracking: Built-in support for
tqdmprogress bars (includingrichand notebook widgets) and progress dashboards. - Efficiency & Control: Automatic task chunking, adjustable maximum active tasks to manage memory, and automatic worker restarting to reduce memory footprint.
- Advanced Execution: CPU pinning, nested pools (via the
daemonoption), and support for exotic objects (lambdas, etc.) when usingdillviamultiprocess_. - Robustness: Graceful exception handling and support for timeouts on tasks and worker lifecycle functions.