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

Remove pynvml module and convert to a "meta package" #57

Merged
merged 22 commits into from
Nov 27, 2024

Conversation

rjzamora
Copy link
Collaborator

@rjzamora rjzamora commented Aug 13, 2024

TODO:

  • Confirm "correctness" of meta-package approach
  • Update documentation

@rjzamora
Copy link
Collaborator Author

NOTE: When I install this package, I cannot query the version of pynvml (AttributeError: module 'pynvml' has no attribute '__version__'). Not sure if any down-stream users depend on this functionality, but nvidia-ml-py doesn't seem to support it.

@jakirkham - Does this general approach seem reasonable? Also, if we start depending on nvidia-ml-py, do we also need to make changes in the nvidia-ml-py feedstock?

@jakirkham
Copy link
Collaborator

Think we are using Versioneer here. We would want to follow these steps as if we were configuring versioneer from scratch

It is possible we will still need to cleanup some files after

We may want to consider devendoring Versioneer, but that can be follow on work


Generally this seems like a reasonable approach. Think the version constraint on nvidia-ml-py will do most of the work for us

In terms of reworking things in conda-forge, yes we will want to fix lines that you have indicated in nvidia-ml-py. We can change the pynvml constraint to >=12

Likely we will also want a repodata patch to fix old versions to work as well. Would want to check with Lawrence since he knows which versions have the bug fixes we need

@rjzamora
Copy link
Collaborator Author

Think we are using Versioneer here. We would want to follow these steps as if we were configuring versioneer from scratch

I think I already did this back in August (maybe?). Was this in response to my question about import pynvml; pynvml.__version__ returning an error? If so, I don't think there is much we can do about that within this repo. When pynvml becomes a meta package, importing pynvml in python will not touch anything in this repo.

@rjzamora
Copy link
Collaborator Author

Update: I removed versioneer to simplify the repo a bit. I also made some small test changes. However, there is still one failing test (Cause is the NVML_P2P_CAPS_INDEX_READ problem reported in this dev forum).

@rjzamora rjzamora marked this pull request as ready for review November 22, 2024 15:21
@rjzamora rjzamora changed the title [WIP] Remove pynvml module and convert to a "meta package" Remove pynvml module and convert to a "meta package" Nov 22, 2024
@rjzamora rjzamora self-assigned this Nov 22, 2024
setup.py Outdated Show resolved Hide resolved
setup.py Outdated Show resolved Hide resolved
@jakirkham
Copy link
Collaborator

Think we are using Versioneer here. We would want to follow these steps as if we were configuring versioneer from scratch

I think I already did this back in August (maybe?). Was this in response to my question about import pynvml; pynvml.__version__ returning an error? If so, I don't think there is much we can do about that within this repo. When pynvml becomes a meta package, importing pynvml in python will not touch anything in this repo.

Yes

Update: I removed versioneer to simplify the repo a bit. I also made some small test changes. However, there is still one failing test (Cause is the NVML_P2P_CAPS_INDEX_READ problem reported in this dev forum).

Removing versioneer may have helped with this problem

.gitattributes Outdated Show resolved Hide resolved
@rjzamora
Copy link
Collaborator Author

Removing versioneer may have helped with this problem

Unfortunately not, because the problem is in nvidia-ml-py

requirements.txt Outdated Show resolved Hide resolved
@jakirkham
Copy link
Collaborator

Should we go ahead and convert this to pyproject.toml? That would help us consolidate several different files into one file with the relevant metadata

rjzamora and others added 2 commits November 22, 2024 14:51
Co-authored-by: jakirkham <[email protected]>
Co-authored-by: jakirkham <[email protected]>
.gitattributes Outdated Show resolved Hide resolved
@rjzamora
Copy link
Collaborator Author

Should we go ahead and convert this to pyproject.toml? That would help us consolidate several different files into one file with the relevant metadata

@jakirkham - Would this be easy to you to contribute? I don't personally deal much with build/packaging details, so I'd need to learn a bit about toml files first :)

Copy link
Collaborator

@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 Rick! 🙏

Had some feedback on the changes so far

Comment on lines -2 to -4
pytest>=3.6,<7.0
pytest-runner
pytest-cov
Copy link
Collaborator

Choose a reason for hiding this comment

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

Think we should still capture these somewhere as they are used for testing

here = path.abspath(path.dirname(__file__))

# Get the long description from the README file
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()

setup(name='pynvml',
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
python_requires='>=3.6',
Copy link
Collaborator

Choose a reason for hiding this comment

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

Think it is unwise to drop this minimum. It is unlikely their code works on anything older than Python 3.6 (possibly it even needs a newer version). The code we still ship at least needs Python 3.6 (possibly newer depending on what we test with)

setup.py Outdated
@@ -2,18 +2,15 @@
from os import path
from io import open

import versioneer

here = path.abspath(path.dirname(__file__))

# Get the long description from the README file
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()

setup(name='pynvml',
Copy link
Collaborator

Choose a reason for hiding this comment

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

Given the simplicity of this code, think we can move this to a pyproject.toml, which will simplify and deduplicate dependency handling, metadata (like the README), etc.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Okay, I gave it a go. My knowledge in this area is limited, so feel free to suggest/push changes.

Copy link
Collaborator

@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 Rick! 🙏

Generally this looks good. Had a few suggestions below

pyproject.toml Outdated Show resolved Hide resolved
pyproject.toml Show resolved Hide resolved
pyproject.toml Outdated Show resolved Hide resolved
pyproject.toml Outdated Show resolved Hide resolved
requirements.txt Outdated
Comment on lines 1 to 5
pip>=9.0.1
pytest>=3.6,<7.0
pytest>=3.6
pytest-runner
pytest-cov
nvidia-ml-py>=12.0.0,<13.0.0a0
Copy link
Collaborator

Choose a reason for hiding this comment

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

As this is now in the test requirements in pyproject.toml, think we can drop this

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Is the suggestion to drop the requirements.txt file altogether? That seems fine to me. I only left it because it is used in the Dockerfile (though I don't personally know if anyone is using that).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Update: I removed requirements.txt now that the Dockerfile doesn't need it.

setup.py Show resolved Hide resolved
pyproject.toml Outdated Show resolved Hide resolved
Comment on lines 16 to 22
pip install --no-cache-dir -r /app/requirements.txt && \
rm -rf ~/.cache/pip

ADD ./pynvml /app/pynvml
ADD ./setup.py /app/
ADD ./setup.cfg /app/
ADD ./pynvml_utils /app/pynvml_utils
ADD ./README.md /app/
ADD ./PKG-INFO /app/
ADD ./MANIFEST.in /app/
ADD ./help_query_gpu.txt /app/
ADD docker/entrypoint.sh /docker-entrypoint.sh
Copy link
Collaborator

Choose a reason for hiding this comment

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

Think we can consolidate this to one ADD of the whole directory and then use pip install .

Alternatively this might be a good time to clean this up if it is unneeded

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Okay, gave this a try.

Copy link
Collaborator

@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 Rick! 🙏

Think this is pretty close to done

Had a few cleanup suggestions below

MANIFEST.in Outdated Show resolved Hide resolved
pyproject.toml Outdated Show resolved Hide resolved
docker/Dockerfile Outdated Show resolved Hide resolved
docker/Dockerfile Outdated Show resolved Hide resolved
docker/Dockerfile Outdated Show resolved Hide resolved
docker/Dockerfile Outdated Show resolved Hide resolved
@jakirkham
Copy link
Collaborator

Thanks Rick! 🙏

This looks reasonable to me

@kenhester could you please take a look as well?

@rjzamora
Copy link
Collaborator Author

Note: Ken confirmed offline that we are good to move forward with this.

@rjzamora rjzamora merged commit 3ab8776 into gpuopenanalytics:master Nov 27, 2024
@rjzamora rjzamora deleted the create-meta-package branch November 27, 2024 23:09
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.

2 participants