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

cudaPackages: lndir -> propagated-build-inputs #271792

Open
SomeoneSerge opened this issue Dec 3, 2023 · 0 comments · May be fixed by #306172
Open

cudaPackages: lndir -> propagated-build-inputs #271792

SomeoneSerge opened this issue Dec 3, 2023 · 0 comments · May be fixed by #306172
Assignees
Labels
6.topic: cuda Parallel computing platform and API

Comments

@SomeoneSerge
Copy link
Contributor

SomeoneSerge commented Dec 3, 2023

Issue description

The "redist" cudatoolkit packages provide the "throw-all-in" $out output in addition to the split dev/lib/static outputs. Currently $out is implemented as a symlink farm, combining all of the other outputs that contain the real content:

for output in $outputs; do
if [ "$output" = "out" ]; then
continue
fi
${getExe lndir} "''${!output}" "$out"
done

This has two disadvantages: we spawn more symlinks which are expensive on distributed network filesystems, and we get larger runtime closures for the less maintained packages that use the default .out instead of the individual outputs (e.g. libcublas instead of [ libcublas.dev libcublas.lib libcublas.static ], #271078 (comment)): if we refer to a symlink from a RUNPATH in another package, we cannot discard the rest of the symlink farm, and then we cannot discard .static at runtime even though it's obviously useless after the build. This the same issue as when packages use {cudatoolkit,rocm}_merged = symlinkJoin ...

Proposal

Make $out contain just a single directory: nix-support. Reference the "real" outputs in their respective propagated{,Native}BuildInputs. This way the build time closure would remain expensive, but we the runtime closures would likely only include the .lib outputs and only when linking dynamically.

This should work out of the box for all of the normal packages that e.g. use FindCUDAToolkit.cmake and do not intentionally try to break it

This would break packages that might be somehow peeking into $out's internal structure, e.g. accessing its content by paths or use build systems that expect some sort of XXXX_ROOT variables. In these cases we can resort to symlinkJoin or try to fix the issue upstream

A related detail: I think might be important to ensure that $out is otherwise empty, because that way we know there are no dangling references. Currently we forget to move the pkg-config/*.pc files to $dev (ConnorBaker/cuda-redist-find-features#10) and they should obviously include references to $dev and $lib except that we forget to patch out the fhs paths (#224119) out of them

@NixOS/cuda-maintainers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: cuda Parallel computing platform and API
Projects
Status: 🏗 In progress
Development

Successfully merging a pull request may close this issue.

2 participants