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

[Split Build] Use single command to build both wheels #126590

Open
wants to merge 44 commits into
base: gh/PaliC/241/base
Choose a base branch
from

Conversation

PaliC
Copy link
Contributor

@PaliC PaliC commented May 17, 2024

[ghstack-poisoned]
Copy link

pytorch-bot bot commented May 17, 2024

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/126590

Note: Links to docs will display an error until the docs builds have been completed.

❌ 22 New Failures, 1 Unrelated Failure

As of commit 998b193 with merge base 2b72e2a (image):

NEW FAILURES - The following jobs have failed:

UNSTABLE - The following job failed but was likely due to flakiness present on trunk and has been marked as unstable:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@pytorch-bot pytorch-bot bot added the topic: not user facing topic category label May 17, 2024
PaliC added a commit that referenced this pull request May 17, 2024
ghstack-source-id: 3627b4513e48d9231ef28ccb811c2fd264a42a21
Pull Request resolved: #126590
[ghstack-poisoned]
PaliC added a commit that referenced this pull request May 20, 2024
ghstack-source-id: 6cfbe22b4d83307ea39877723eb8b86f7f13ad27
Pull Request resolved: #126590
[ghstack-poisoned]
PaliC added a commit that referenced this pull request May 20, 2024
ghstack-source-id: b673d085f6078646573940456713659bc541ed8a
Pull Request resolved: #126590
[ghstack-poisoned]
PaliC added a commit that referenced this pull request May 20, 2024
ghstack-source-id: 818ba4d5df3eace02bd90bd932ba2f81e4faf3ac
Pull Request resolved: #126590
[ghstack-poisoned]
PaliC added a commit that referenced this pull request May 20, 2024
ghstack-source-id: 101ca8c5a187a9a364ae149ffca21d031b602992
Pull Request resolved: #126590
[ghstack-poisoned]
PaliC added a commit that referenced this pull request May 20, 2024
ghstack-source-id: 754885f2f6bfe7304ee587e2500d3b32a777eb97
Pull Request resolved: #126590
[ghstack-poisoned]
PaliC added a commit that referenced this pull request May 20, 2024
ghstack-source-id: 9bc0681e005c8d357f8f27afc9cae4675ddb2efb
Pull Request resolved: #126590
[ghstack-poisoned]
PaliC added a commit that referenced this pull request May 20, 2024
ghstack-source-id: 2f12726f8c6b93f5e5cdd73670df4cc0324d911f
Pull Request resolved: #126590
[ghstack-poisoned]
PaliC added a commit that referenced this pull request May 20, 2024
ghstack-source-id: a3dbd1096f4087b9a2df48da006e25b5eca1667a
Pull Request resolved: #126590
[ghstack-poisoned]
PaliC added a commit that referenced this pull request May 20, 2024
ghstack-source-id: 6e7f1bc1ede8e2a73f22eebac4983dc117e3f031
Pull Request resolved: #126590
[ghstack-poisoned]
PaliC added a commit that referenced this pull request May 21, 2024
ghstack-source-id: c906ffb04fce5912d9381bfed20f0f738e7a4858
Pull Request resolved: #126590
[ghstack-poisoned]
PaliC added 4 commits May 21, 2024 22:30
[ghstack-poisoned]
Adds a `SPLIT_BUILD` option to build both the libtorch wheel and pytorch wheels at the same time. This option was added as a convenience and right now only supports "clean" and "install"


[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
@@ -230,20 +235,8 @@ def _get_package_path(package_name):
return None


BUILD_LIBTORCH_WHL = os.getenv("BUILD_LIBTORCH_WHL", "0") == "1"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we unify this one and #126328 ? Since these lines seems to be added by #126328 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two PRs are wholly unrelated. The only reason they're together in a stack is to not have a merge conflict. I can just remove this PR and CI should still pass if you want

@PaliC PaliC requested a review from atalman May 22, 2024 21:28
[ghstack-poisoned]
PaliC added 4 commits May 22, 2024 16:54
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
or setup_cmd == "sdist"
or setup_cmd == "develop"
):
raise RuntimeError(
Copy link
Contributor

@huydhn huydhn May 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit confusing here, if this raises a RunTimeError, then the rest of the if statement would be skipped, wouldn't it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this is unsupported use case, looking at the Error text.

global BUILD_PYTHON_ONLY
global PACKAGE_NAME

BUILD_LIBTORCH_WHL = os.getenv("BUILD_LIBTORCH_WHL", "0") == "1"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Is there a reason to bring the initialization BUILD_LIBTORCH_WHL = os.getenv("BUILD_LIBTORCH_WHL", "0") == "1" and BUILD_PYTHON_ONLY = os.getenv("BUILD_PYTHON_ONLY", "0") == "1" here instead of where they are defined above? It's better to defined and init a variable in the same place if possible IMO

_main()


def _main():
Copy link
Contributor

@huydhn huydhn May 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would love to call this function something else if possible _main doesn't feel like a good name, may be _build? The context here is that I was asking myself why there are 2 main functions, then I realized that one is _main

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for this, using _build sounds like a good idea

BUILD_PYTHON_ONLY = True
sys.argv[1] = "clean"
PACKAGE_NAME = final_package_name
_main()
Copy link
Contributor

@atalman atalman May 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this work same way as ?:

BUILD_LIBTORCH_WHL=1 python setup.py install
python setup.py clean
BUILD_PYTHON_ONLY=1 python setup.py install

The code above is calling _main() 3 times. While code here is only 2 times, combining clean step with BUILD_PYTHON_ONLY=1.

)

final_package_name = PACKAGE_NAME
PACKAGE_NAME = "libtorch"
Copy link
Contributor

@atalman atalman May 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are the final 2 package names ? Where we will store them in https://download.pytorch.org/whl/nightly/ - we want to make sure there do not come to conflict with current torch packages.

To better explain this point, please take a look nightly workflow results, here: https://github.com/pytorch/pytorch/actions/runs/9209764850?pr=126699

looks like the packages with split option and regular packages are almost the same:

Screenshot 2024-05-23 at 6 59 02 PM

Looking at the package contents, shows the same structure:
Screenshot 2024-05-23 at 8 12 38 PM

METADATA is same as well

Copy link
Contributor

@atalman atalman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see comments

PaliC added 11 commits May 28, 2024 07:57
[ghstack-poisoned]
[ghstack-poisoned]
Adds a `SPLIT_BUILD` option to build both the libtorch wheel and pytorch wheels at the same time. This option was added as a convenience and right now only supports "clean" and "install"


[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants