-
Notifications
You must be signed in to change notification settings - Fork 584
fix: set multiprocessing start method to 'fork' in pt env (since python3.14 defaults to forkserver) #5019
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR addresses a compatibility issue with Python 3.14, which defaults to the 'forkserver' multiprocessing start method instead of 'fork'. The change explicitly sets the multiprocessing start method to 'fork' at the application entry point to maintain consistent behavior across Python versions.
Key Changes:
- Added multiprocessing start method configuration in the main function to explicitly set it to 'fork'
- Included error handling with logging for both successful configuration and failures
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. 📝 WalkthroughWalkthroughThe PR adds platform-aware multiprocessing initialization to Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~15–20 minutes
Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
♻️ Duplicate comments (1)
deepmd/main.py (1)
992-993: Past review suggestions not addressed.Previous reviews suggested:
- Line 992: Change
logging.info()tologging.debug()since successful initialization typically doesn't need info-level logging- Line 993: Catch specific exceptions (
RuntimeError,ValueError) instead of broadExceptionThese suggestions remain valid. The static analysis tool also flags the broad exception catching.
As per coding guidelines, please run
ruff check .before committing to address the BLE001 warning.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
deepmd/main.py(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.py
📄 CodeRabbit inference engine (AGENTS.md)
Always run
ruff check .andruff format .before committing changes to Python code
Files:
deepmd/main.py
🪛 Ruff (0.14.0)
deepmd/main.py
993-993: Do not catch blind exception: Exception
(BLE001)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (29)
- GitHub Check: Analyze (python)
- GitHub Check: Analyze (c-cpp)
- GitHub Check: Build C++ (cuda120, cuda)
- GitHub Check: Build C++ (cuda, cuda)
- GitHub Check: Build C++ (cpu, cpu)
- GitHub Check: Build C++ (clang, clang)
- GitHub Check: Build C++ (rocm, rocm)
- GitHub Check: Test C++ (true)
- GitHub Check: Test Python (3, 3.9)
- GitHub Check: Test Python (4, 3.9)
- GitHub Check: Test C++ (false)
- GitHub Check: Test Python (5, 3.9)
- GitHub Check: Test Python (2, 3.9)
- GitHub Check: Test Python (6, 3.9)
- GitHub Check: Test Python (2, 3.12)
- GitHub Check: Test Python (4, 3.12)
- GitHub Check: Test Python (6, 3.12)
- GitHub Check: Test Python (5, 3.12)
- GitHub Check: Test Python (1, 3.9)
- GitHub Check: Test Python (3, 3.12)
- GitHub Check: Test Python (1, 3.12)
- GitHub Check: Build wheels for cp311-macosx_arm64
- GitHub Check: Build wheels for cp310-manylinux_aarch64
- GitHub Check: Build wheels for cp311-manylinux_x86_64
- GitHub Check: Build wheels for cp311-macosx_x86_64
- GitHub Check: Build wheels for cp311-win_amd64
- GitHub Check: Build wheels for cp311-manylinux_x86_64
- GitHub Check: Build C library (2.14, >=2.5.0,<2.15, libdeepmd_c_cu11.tar.gz)
- GitHub Check: Build C library (2.18, libdeepmd_c.tar.gz)
🔇 Additional comments (1)
deepmd/main.py (1)
987-994: Logging occurs before CLI configuration is applied.This code logs messages before
parse_args()(line 996) processes the--log-leveland--log-patharguments. The log messages will use Python's default logging configuration, so user-specified log levels and paths won't apply to these early messages.This is acceptable for early initialization messages, but be aware that users won't be able to control these logs via CLI arguments.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## devel #5019 +/- ##
==========================================
- Coverage 84.33% 84.33% -0.01%
==========================================
Files 709 709
Lines 70435 70443 +8
Branches 3618 3619 +1
==========================================
+ Hits 59402 59407 +5
- Misses 9867 9869 +2
- Partials 1166 1167 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
njzjz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the purpose of this PR?
…on3.14 defaults to forkserver)
a4262d6 to
83ad632
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
njzjz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure forkserver is not supported by PyTorch?
It is supported by pytorch, but num_worker can only be 0 in this case. And python 3.14 defaults to forkserver. @caic99 |
I know @caic99 made a commit that sets num_worker to 0 for forkserver, but this may not be correct. We need to figure out if pytorch supports forkserver. |
Okay, I will test that later |
I tried using default settings in python3.14, and remove limit of NUM_WORKERS. As a result, an error occurred: |
…on3.14 defaults to forkserver) (deepmodeling#5019) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Enhanced platform-specific multiprocessing initialization with improved logging for better diagnostics. * Streamlined module logging setup to reduce code redundancy. <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.