Skip to content

cudnn: add rpath to helper libraries for cudnn 8#3399

Open
Markus92 wants to merge 2 commits intospack:developfrom
Markus92:cudnn
Open

cudnn: add rpath to helper libraries for cudnn 8#3399
Markus92 wants to merge 2 commits intospack:developfrom
Markus92:cudnn

Conversation

@Markus92
Copy link
Contributor

CuDNN versions prior to 7 shipped with one library: libcudnn.so. This made linking easy as there is only one thing to link to.

CuDNN 8 changed this: the CuDNN library was split into 6 libraries and a shim libcudnn.so. To make sure libcudnn.so can find it's helper libraries, it has its rpath set to $ORIGIN. As all libs come into the same folder, this works fine for the most part. However, the individual split libraries do not have an rpath set, so they cannot see each other. When using pytorch this can lead to library not found errors during runtime, as the libraries do link to each other: e.g. libcudnn_adv_infer.so links to libcudnn_ops_infer.so.8

CuDNN 9 has the rpath set to $ORIGIN in all helper libraries off-the-shelf, so is not affected by this behavior. This PR adds that behavior to CuDNN 8.

@Markus92
Copy link
Contributor Author

Thanks for the comments, @haampie ! Took care of them hopefully

@haampie
Copy link
Member

haampie commented Feb 12, 2026

Would be good to test drive a bit, cause patchelf's mechanism for growing the dynamic section is a rather involved operation. Plus look if the file size is much larger than before (probably won't matter cause of how big the rest of cuda is).

I don't have an nvidia gpu to test on though

@Markus92
Copy link
Contributor Author

Markus92 commented Feb 12, 2026

File sizes differ a bit but not much, 7mb on a 2.3gb package for CuDNN 8.9.7

Some simple tests seem to indicate it works (simple MNIST example). I'll deploy it across our users and report back if it fixes their issues.

@haampie
Copy link
Member

haampie commented Feb 12, 2026

sounds good to me

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants