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

WIP: cudaPackages.hasCudaObjects: init #351679

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

pbsds
Copy link
Member

@pbsds pbsds commented Oct 27, 2024

includes some commented code from when i tried to have the function override the provided package to enable CUDA. turns out finalAttrs.finalPackage does not have .override /shrug

@SomeoneSerge is this of any interest?

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@ofborg ofborg bot requested a review from brian-dawn October 27, 2024 19:52
@ofborg ofborg bot added 11.by: package-maintainer This PR was created by the maintainer of the package it changes 10.rebuild-darwin: 1-10 10.rebuild-linux: 1-10 labels Oct 27, 2024
@pbsds pbsds force-pushed the feat-cuobjdump-tester-1730028634 branch 3 times, most recently from 810f298 to 43e29fa Compare October 27, 2024 20:38
@pbsds pbsds changed the title WIP: cudaPackages.testAnyCudaObject: init cudaPackages.testAnyCudaObject: init Oct 27, 2024
@pbsds pbsds marked this pull request as ready for review October 27, 2024 20:39
@pbsds
Copy link
Member Author

pbsds commented Oct 27, 2024

i opted for passthru.tests rather than a installCheckPhase hook do avoid a cudaPackages-wide dependence on cuobjdump

@pbsds pbsds changed the title cudaPackages.testAnyCudaObject: init WIP: cudaPackages.testAnyCudaObject: init Oct 30, 2024
@pbsds
Copy link
Member Author

pbsds commented Oct 30, 2024

the tests of the two packages i pushed doesn't seem to pass, could use investigation

Copy link
Contributor

Choose a reason for hiding this comment

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

  1. Location: consider putting this in https://nixos.org/manual/nixpkgs/unstable/#chap-testers or maybe keep it in cudaPackages but inherit in testers
  2. Naming: maybe hasCudaObjects or hasCudaCode or hasCuda?
  3. Granularity: can be left for later, but the tester could support multiple modes, namely hasDeviceCode (as in "any"), hasPTX (as in specifically PTX that can be compiled at runtime), hasSASS (takes a list, tests that concrete architectures are supported). Except I don't like these three names, say they're placeholders.
  4. Regarding passthru-vs-checkPhase: I think we should implement this as a checkPhase hook (because checkPhases absolutely must be separated into their own derivations) but in a way that it's easy to reuse in passthru (because it'll still take ages to separate them...)

CC @ConnorBaker who probably has good ideas regarding the proper signature

Copy link
Member Author

Choose a reason for hiding this comment

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

1,2 is done, 3 is done via optional arguments, i'll hold of on 4 until the check is finalized to save myself some rebuilds

@pbsds pbsds force-pushed the feat-cuobjdump-tester-1730028634 branch from 10e7436 to 5274586 Compare October 31, 2024 11:24
@github-actions github-actions bot added 8.has: documentation 6.topic: testing Tooling for automated testing of packages and modules labels Oct 31, 2024
@pbsds pbsds changed the title WIP: cudaPackages.testAnyCudaObject: init WIP: cudaPackages.hasCudaObjects: init Oct 31, 2024
Comment on lines +63 to +70
# TODO: does this work?
${lib.optionalString hasPTX ''
# we run cuobjdump again since --list-ptx interferes with requiredCapabilities
if cuobjdump --list-ptx "$fname" 1>/dev/null 2>/dev/null; then
echo " Has PTX"
else
echo " Does NOT have PTX"
all_requirements_found=false
fi
''}
Copy link
Member Author

@pbsds pbsds Oct 31, 2024

Choose a reason for hiding this comment

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

how can i test for runtime compiled PTX objects? Are there any examples in nixpkgs you can think of?

Copy link
Contributor

@SomeoneSerge SomeoneSerge Nov 1, 2024

Choose a reason for hiding this comment

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

You mean what packages we can test this tester against?

Copy link
Member Author

@pbsds pbsds Nov 1, 2024

Choose a reason for hiding this comment

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

Yes. Currently the test in its current form only checks the exit code of cuobjdump, but for librealsense it prints:

PTX file    1: librealsense2.so.2.56.1.sm_52.ptx
PTX file    2: librealsense2.so.2.56.2.sm_52.ptx
PTX file    3: librealsense2.so.2.56.3.sm_52.ptx

which targets sm_52, and thus I assume it is not runtime compiled?

@nix-owners nix-owners bot requested a review from philiptaron October 31, 2024 11:26
@pbsds pbsds force-pushed the feat-cuobjdump-tester-1730028634 branch from 5274586 to f3a5c16 Compare October 31, 2024 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: testing Tooling for automated testing of packages and modules 8.has: documentation 10.rebuild-darwin: 1-10 10.rebuild-linux: 1-10 11.by: package-maintainer This PR was created by the maintainer of the package it changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants