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

NEW: Add cf-nvidia-tools #28794

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open

Conversation

carterbox
Copy link
Member

@carterbox carterbox commented Jan 8, 2025

Checklist

  • Title of this PR is meaningful: e.g. "Adding my_nifty_package", not "updated meta.yaml".
  • License file is packaged (see here for an example).
  • Source is from official source.
  • Package does not vendor other packages. (If a package uses the source of another package, they should be separate packages or the licenses of all packages need to be packaged).
  • If static libraries are linked in, the license of the static library is packaged.
  • Package does not ship static libraries. If static libraries are needed, follow CFEP-18.
  • Build number is 0.
  • A tarball (url) rather than a repo (e.g. git_url) is used in your recipe (see here for more details).
  • GitHub users listed in the maintainer section have posted a comment confirming they are willing to be listed there.
  • When in trouble, please check our knowledge base documentation before pinging a team.

Copy link
Contributor

github-actions bot commented Jan 8, 2025

Hi! This is the staged-recipes linter and your PR looks excellent! 🚀

@conda-forge-admin
Copy link
Contributor

conda-forge-admin commented Jan 8, 2025

Hi! This is the friendly automated conda-forge-linting service.

I wanted to let you know that I linted all conda-recipes in your PR (recipes/cf-nvidia-tools/recipe.yaml) and found some lint.

Here's what I've got...

For recipes/cf-nvidia-tools/recipe.yaml:

  • noarch packages can't have skips with selectors. If the selectors are necessary, please remove noarch: generic.

This message was generated by GitHub Actions workflow run https://github.com/conda-forge/conda-forge-webservices/actions/runs/12794723558. Examine the logs at this URL for more detail.

@carterbox
Copy link
Member Author

@conda-forge/cuda, please review

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 Daniel! 🙏

Really appreciate you putting the time into creating this testing resource. This will be very helpful when testing packages and catching any missed changes.

Had a few questions below

recipes/cf-nvidia-tools/recipe.yaml Outdated Show resolved Hide resolved
tests:
- script:
- export c_stdlib_version="2.17.0"
- check-glibc ${CONDA_PREFIX}/lib/*.so.*
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- check-glibc ${CONDA_PREFIX}/lib/*.so.*
- check-glibc "${CONDA_PREFIX}/lib/*.so.*"

Also would it make sense to have a default search argument or would we rather be explicit like in this test

Lastly should we add a library test dependency to ensure there is one library we can check?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't want to provide a default argument because in production, we don't want to test all of the binaries in PREFIX, just the NVIDIA redists. There is no glob that I can think of that satisfies this condition.

Copy link
Member Author

Choose a reason for hiding this comment

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

No double quotes because we want the terminal to expand the glob expression not pass a literal glob expression.

Comment on lines +34 to +38
description: >
This package contains CLI tools for validating and linting NVIDIA's conda recipes on
conda-forge. For a description of the tools see the README in the package feedstock. The
tools are hosted directly in the feedstock; there is no external source code repository
for these tools at this time.
Copy link
Member

Choose a reason for hiding this comment

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

Do we want this to be one long string or do want to have it wrapped a certain way?

FWIW find this website to be a useful resource when playing with YAML string formatting: https://yaml-multiline.info

Copy link
Member Author

Choose a reason for hiding this comment

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

I want one long string. anaconda.org handles the wrapping of long lines.

recipes/cf-nvidia-tools/recipe.yaml Outdated Show resolved Hide resolved
recipes/cf-nvidia-tools/recipe.yaml Outdated Show resolved Hide resolved
@carterbox carterbox requested a review from jakirkham January 14, 2025 23:05
@carterbox
Copy link
Member Author

@conda-forge/staged-recipes, please review

Copy link
Contributor

To help direct your pull request to the best reviewers, please mention a topic-specifc team if your recipe matches any of the following: conda-forge/help-c-cpp, conda-forge/help-cdts, conda-forge/help-go, conda-forge/help-java, conda-forge/help-julia, conda-forge/help-nodejs, conda-forge/help-perl, conda-forge/help-python, conda-forge/help-python-c, conda-forge/help-r, conda-forge/help-ruby,or conda-forge/help-rust. Thanks!

)
if [[ "${first}" == "${second}" ]] ; then
echo "true"
return 0
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the return value of 1 or 0 ever used ? I found that when this file was used in cudnn feedstock, and when it returned 1 (incompatible), it would exit build.sh right away due to "set -e" in build.sh, without printing the message "The binary is not compatible with the recipe's glibc pinning". This does not happen here in this feedstock as it does not have "set -e" though.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is a good point! You're saying that return causes the entire script to abort instead of just moving up one level. I will refactor to use the strings only.

Copy link
Member Author

Choose a reason for hiding this comment

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

I've stripped unused parts of the API and added a test to ensure that the script exits 1 when appropriate.

for file in "$@"; do
if [[ -f "$file" && ! -L "$file" ]]; then # Ensure it's a file and not a link
BINARY_GLIBC_VERSION="$(glibc-detect req "$file")"
echo "binary glibc ${BINARY_GLIBC_VERSION} <= recipe glibc ${RECIPE_GLIBC_VERSION} <= system glibc ${SYSTEM_GLIBC_VERSION} $file"
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe I am missing something - is the 2nd half of the check i.e. "recipe glibc ${RECIPE_GLIBC_VERSION} <= system glibc ${SYSTEM_GLIBC_VERSION}" being run ? The next line, glibc-check compatible "$BINARY_GLIBC_VERSION" "$RECIPE_GLIBC_VERSION", compares binary glibc and recipe glibc only I think.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think you are correct. We don't check if the system glibc version is >= the recipe version. This was important for debugging when developing this tool, but it doesn't actually affect the correctness of the recipe.

It is perfectly valid to build a package that requires glibc 5 on a system that only has glibc 2. It's just that you won't be able to run or install the binaries you have built because the package will require __glibc >= 5.

In summary, printing the system glibc version is printed for informational purposes and may help with debugging if tests which try to load the libraries fail during the test phase.

I could add a check and echo a warning message if system glibc is < recipe glibc, but definitely not raise an error.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for clarifying! Yeah I think it's better to give a warning if system glibc is < recipe glibc, or at least simply print SYSTEM_GLIBC_VERSION value on a separate line as dry information - right now it may give impression to the user that system glibc is being checked against recipe glibc version

@carterbox carterbox requested a review from billysuh7 January 15, 2025 18:34
Comment on lines +9 to +16
## 1. detecting the glibc version
"detect" )
glibc-detect "${@}"
;;
## 2. checking a pair of glibc versions for compatibility
"check" )
glibc-check "${@}"
;;
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't believe these two modes are used. Are they for future extension ?

for file in "$@"; do
if [[ -f "$file" && ! -L "$file" ]]; then # Ensure it's a file and not a link
BINARY_GLIBC_VERSION="$(glibc-detect req "$file")"
echo "binary glibc ${BINARY_GLIBC_VERSION} <= recipe glibc ${RECIPE_GLIBC_VERSION} <= system glibc ${SYSTEM_GLIBC_VERSION} $file"
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for clarifying! Yeah I think it's better to give a warning if system glibc is < recipe glibc, or at least simply print SYSTEM_GLIBC_VERSION value on a separate line as dry information - right now it may give impression to the user that system glibc is being checked against recipe glibc version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

4 participants