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

Add wheel builds #901

Merged
merged 106 commits into from
Dec 1, 2022
Merged

Add wheel builds #901

merged 106 commits into from
Dec 1, 2022

Conversation

vyasr
Copy link
Contributor

@vyasr vyasr commented Nov 16, 2022

This PR adds support for building wheels of ucx-py.

@vyasr vyasr requested review from jakirkham and wence- and removed request for jakirkham and wence- November 18, 2022 21:12
Copy link
Member

@jakirkham jakirkham left a comment

Choose a reason for hiding this comment

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

Thanks Vyas for all the hard work here! 🙏

Had some thoughts on simplifying the version handling below

ftext = f.read()
major = re.findall("^#define.*UCP_API_MAJOR.*", ftext, re.MULTILINE)
minor = re.findall("^#define.*UCP_API_MINOR.*", ftext, re.MULTILINE)
versioneer.get_versions = get_versions
Copy link
Member

Choose a reason for hiding this comment

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

Am curious why we are overwriting the version function here? It seems simpler just to not use versioneer at all in this case

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll defer to @wence- here, but the answer here is related to his answer to your other query about why not directly use the version: this hack ensures that we get the right version encoded in _version.py so that ucp.__version__ is correct when users import and use it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, it's all part of the same dance.

The other approach would be to rewrite _version.py in the wheel-building process to fill in the version by hand. But this is kind of what versioneer does any, so this monkeypatch is simpler.

@@ -56,6 +63,10 @@ def get_ucp_version():
cmdclass = versioneer.get_cmdclass(cmdclass)
Copy link
Member

Choose a reason for hiding this comment

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

Could we condition this on whether the version was set externally and skip this if so?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Given the discussions around versioneer.get_version I think it's more appropriate to leave all of this unconditional and make the versioneer monkey patch the only conditional change.

# TODO: At present the ucx-py naming scheme is not dynamic and will not
# support different CUDA major versions if we need to build wheels. It is
# hardcoded in pyproject.toml, so overriding it here will not work.
# name="ucx-py" + os.getenv("RAPIDS_PY_WHEEL_CUDA_SUFFIX", default=""),
ext_modules=ext_modules,
cmdclass=cmdclass,
version=versioneer.get_version(),
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we should just pass the version here if known

Copy link
Contributor

Choose a reason for hiding this comment

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

The rationale for this is as for the approach we took in dask-cuda. I copy the description:

The GIT_DESCRIBE_TAG and VERSION_SUFFIX environment variables are used
to control the name and version of the created conda/pypi package.
They should, however, not be used to control the version of the
installed package by overriding the versioneer cmdclass since that
leaves an unmodified _version.py file in the installed package
directory. A consequence is that the version reported by
dask_cuda.version is "0+unknown".

We cannot always use the versioneer-provided cmdclass unmodified since
PEP440 specifically forbids PyPI from accepting packages that have local
version identifiers (as used by versioneer). To get around this, when setup.py
detects it is building a PyPI package (GIT_DESCRIBE_TAG is in the environment),
patch the version returned from versioneer with a PyPI-compatible one.

Specifically. If we don't use versioneer here, then the dynamic code in __init__.py which imports _version and calls get_versions() will report nonsense for wheel packages.

pyproject.toml Show resolved Hide resolved
Copy link
Contributor

@wence- wence- left a comment

Choose a reason for hiding this comment

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

Thanks!

cibw-before-build: "cp {package}/.github/build-scripts/patch-wheel.sh /patch-wheel.sh"
# Also rewrite the name in the pyproject.toml file.
# TODO: Eventually this needs to be done more generically.
cibw-before-build: "cp {package}/.github/build-scripts/patch-wheel.sh /patch-wheel.sh && sed -i 's/name = \"ucx-py\"/name = \"ucx-py-cu11\"/g' {package}/pyproject.toml"
Copy link
Member

Choose a reason for hiding this comment

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

Was thinking we could also capture this in a patch we apply as part of the build. No strong feelings about that or this approach though

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let's stick to this approach for now and punt determining an "optimal" long-term solution for the next release. I don't know if we want to store multiple patches in the repo since that will create multiple sources of truth (the GHA workflow will also need to have access to the current CUDA version, for instance). I think it will be cleaner in the long run to use this sort of scripting approach that reacts to the values of inputs to the workflow.

@vyasr vyasr requested a review from jakirkham November 23, 2022 18:07
@vyasr
Copy link
Contributor Author

vyasr commented Nov 29, 2022

@jakirkham do you have further concerns here about the version management (or anything else)?

@vyasr
Copy link
Contributor Author

vyasr commented Dec 1, 2022

In the interest of getting things in for code freeze I'm going to go ahead and merge this. If there are any outstanding concerns about the version handling we can address that in the next release.

@vyasr
Copy link
Contributor Author

vyasr commented Dec 1, 2022

@gpucibot merge

@vyasr
Copy link
Contributor Author

vyasr commented Dec 1, 2022

Ah I guess I don't have write access to this repository. @wence- or @pentschev could you please merge this? Thanks!

@jakirkham
Copy link
Member

@gpucibot merge

@rapids-bot rapids-bot bot merged commit 68a74de into rapidsai:branch-0.29 Dec 1, 2022
quasiben pushed a commit to quasiben/ucx-py that referenced this pull request Dec 19, 2022
This PR adds support for building wheels of ucx-py.

Authors:
  - Vyas Ramasubramani (https://github.com/vyasr)
  - Benjamin Zaitlen (https://github.com/quasiben)
  - Sevag H (https://github.com/sevagh)

Approvers:
  - Lawrence Mitchell (https://github.com/wence-)
  - Joseph (https://github.com/jolorunyomi)

URL: rapidsai#901
@quasiben quasiben mentioned this pull request Dec 19, 2022
@vyasr vyasr deleted the feat/cibuildwheel branch March 9, 2023 19:48
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.

6 participants