-
Notifications
You must be signed in to change notification settings - Fork 526
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
ci(wheel): build PT OPs #3894
ci(wheel): build PT OPs #3894
Conversation
Signed-off-by: Jinzhe Zeng <[email protected]> (cherry picked from commit ebb1a87) Signed-off-by: Jinzhe Zeng <[email protected]>
Signed-off-by: Jinzhe Zeng <[email protected]> (cherry picked from commit 60b6903)
Signed-off-by: Jinzhe Zeng <[email protected]>
Signed-off-by: Jinzhe Zeng <[email protected]>
Signed-off-by: Jinzhe Zeng <[email protected]>
Signed-off-by: Jinzhe Zeng <[email protected]>
Signed-off-by: Jinzhe Zeng <[email protected]>
Signed-off-by: Jinzhe Zeng <[email protected]>
Signed-off-by: Jinzhe Zeng <[email protected]>
Signed-off-by: Jinzhe Zeng <[email protected]>
Signed-off-by: Jinzhe Zeng <[email protected]>
Signed-off-by: Jinzhe Zeng <[email protected]>
Signed-off-by: Jinzhe Zeng <[email protected]>
Signed-off-by: Jinzhe Zeng <[email protected]>
Signed-off-by: Jinzhe Zeng <[email protected]>
Signed-off-by: Jinzhe Zeng <[email protected]>
Signed-off-by: Jinzhe Zeng <[email protected]> (cherry picked from commit bd7da0b)
This reverts commit f9d4e52.
This reverts commit 30b5377.
This reverts commit ced2562.
This reverts commit 76225f0. Signed-off-by: Jinzhe Zeng <[email protected]>
This reverts commit 4c28b75.
Signed-off-by: Jinzhe Zeng <[email protected]>
Signed-off-by: Jinzhe Zeng <[email protected]>
Signed-off-by: Jinzhe Zeng <[email protected]>
This reverts commit ed4bcda.
Signed-off-by: Jinzhe Zeng <[email protected]>
Signed-off-by: Jinzhe Zeng <[email protected]>
Signed-off-by: Jinzhe Zeng <[email protected]>
Signed-off-by: Jinzhe Zeng <[email protected]>
Signed-off-by: Jinzhe Zeng <[email protected]>
This reverts commit 569a958.
Signed-off-by: Jinzhe Zeng <[email protected]>
WalkthroughWalkthroughThis update introduces PyTorch support to the backend, dynamically adjusting the build and runtime requirements based on the availability of PyTorch. Key functions now include checks for PyTorch, and new functionalities are added to handle PyTorch-specific requirements and versions. The documentation and configuration files have been updated to reflect these changes, ensuring smooth integration with existing PyTorch and TensorFlow dependencies. Changes
Recent review detailsConfiguration used: CodeRabbit UI Files selected for processing (3)
Files skipped from review as they are similar to previous changes (1)
Additional context usedRuff
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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: 4
Outside diff range and nitpick comments (6)
backend/find_pytorch.py (1)
Line range hint
33-88
: Update function documentation to reflect actual return values.The function
find_pytorch
documentation incorrectly mentions returning TensorFlow requirements. It should state that it returns PyTorch requirements when PyTorch is not found.- TensorFlow requirement if not found. Empty if found. + PyTorch requirement if not found. Empty if found.backend/read_env.py (3)
18-18
: Add a comment for clarity about the new import.The import of
get_pt_version
is new and directly related to the integration of PyTorch. It would be beneficial to add a comment explaining its purpose and usage in this file.
Line range hint
56-56
: Correct the casing of the environment variable for consistency.The environment variable
CUDAToolkit_ROOT
should beCUDATOOLKIT_ROOT
to maintain consistency and avoid potential issues on case-sensitive systems.- CUDAToolkit_ROOT + CUDATOOLKIT_ROOT
137-137
: Clarify the use of unpacking in function calls.The unpacking in the function call to
get_argument_from_env
is not immediately clear and could benefit from a comment explaining why only certain values are used.doc/install/easy-install.md (2)
Line range hint
40-40
: Correct the verb form for clarity.The verb "setup" should be "set up" when used as a verb. This improves the clarity and correctness of the documentation.
- for how to setup a conda environment. + for how to set up a conda environment.
Line range hint
129-129
: Clarify the instruction for adding extras.The use of "as" in the sentence about adding extras is confusing. Clarifying this could improve the readability of the documentation.
- add `lmp` and/or `ipi` to extras: + add `lmp` and/or `ipi` as extras:
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## devel #3894 +/- ##
=======================================
Coverage 82.74% 82.74%
=======================================
Files 519 519
Lines 50491 50491
Branches 3015 3015
=======================================
Hits 41781 41781
Misses 7773 7773
Partials 937 937 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Jinzhe Zeng <[email protected]>
Signed-off-by: Jinzhe Zeng <[email protected]>
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: 3
Outside diff range and nitpick comments (2)
backend/find_pytorch.py (1)
Line range hint
33-88
: Refactorfind_pytorch
function for clarity and efficiency.The
find_pytorch
function attempts to locate the PyTorch library and determine the necessary TensorFlow requirements if PyTorch is not found. While the logic is sound, the function could benefit from refactoring to improve readability and maintainability. Specifically:
- The use of multiple
if
conditions to checkpt_spec
can be streamlined.- Exception handling in the function is broad and might suppress important errors unintentionally.
Consider restructuring the code to reduce duplication and improve error handling.
@lru_cache def find_pytorch() -> Tuple[Optional[str], List[str]]: if os.environ.get("DP_ENABLE_PYTORCH", "0") == "0": return None, [] pt_spec = find_spec("torch") or find_spec_in_custom_path() if not pt_spec and site.ENABLE_USER_SITE: pt_spec = find_spec_in_site_packages(site.getusersitepackages()) if not pt_spec: pt_spec = find_spec_in_site_packages(get_path("purelib")) pt_install_dir = get_install_dir_from_spec(pt_spec) requires = get_pt_requirement()["torch"] if not pt_install_dir else [] return pt_install_dir, requires def find_spec_in_custom_path(): site_packages = Path(os.environ.get("PYTORCH_ROOT", '')).parent.absolute() return FileFinder(str(site,packages)).find_spec("torch") if site_packages else None def find_spec_in_site_packages(site_packages: str): return FileFinder(site_packages).find_spec("torch") if site_packages else None def get_install_dir_from_spec(pt_spec): try: return pt_spec.submodule_search_locations[0] except (AttributeError, TypeError, IndexError): return Nonebackend/find_tensorflow.py (1)
Line range hint
105-105
: Improve exception handling in TensorFlow version extraction.The current implementation catches broad exceptions which might suppress important errors. Use
raise ... from err
to provide more context about the original exception.try: tf_install_dir = tf_spec.submodule_search_locations[0] except (AttributeError, TypeError, IndexError) as err: raise RuntimeError("Failed to locate TensorFlow installation directory") from err
Build PT OPs for our wheels (against the CPU version of PT but work with the GPU version). Add PT to the build dependencies if it is not found. Bump MPICH to the latest version. Update documentation to address that PT support for LAMMPS and i-PI is not included. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced PyTorch support across various backend functionalities, enhancing compatibility and capabilities alongside existing TensorFlow support. - **Documentation** - Updated installation guide to include warnings about TensorFlow backend support and removed outdated notes about macOS arm64 package support. - **Chores** - Updated dependency versions and build configurations to include new PyTorch settings and improved compatibility for macOS and Linux. - Adjusted build scripts to conditionally link libraries based on new PyTorch-related parameters. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Jinzhe Zeng <[email protected]>
Build PT OPs for our wheels (against the CPU version of PT but work with the GPU version). Add PT to the build dependencies if it is not found. Bump MPICH to the latest version. Update documentation to address that PT support for LAMMPS and i-PI is not included.
Summary by CodeRabbit
New Features
Documentation
Chores