How to install a specific version of CUDA and CUDNN?

Our project relies on OnnxRumtime 1.12 (https://onnxruntime.ai/docs/execution-providers/CUDA-ExecutionProvider.html) for Linux, which requires cuda 11.4 and cudnn 8.2.4 (Linux).

Digging thru the Nixos packages, we can find ‘cudaPackages_11_4.cudatoolkit’ which appears to address the first requirement (i.e. cuda 11.4 toolkit), however, the only version of cudnn we can see that’s available is ‘cudaPackages_11_4.cudnn_8_3_2’ – which is several version ahead of the requirement cudnn 8.2.4.

How do we acquire the exact versions we need?

Thanks!

2 Likes

Hello! It’s a pity nobody followed up on this earlier

I think the current way would be for you to package cudnn 8.2.4 yourself.
You’d have to add a definition in pkgs/development/libraries/science/math/cudnn/extension.nix.
And maybe add a cuDnnVersion argument for cuda-packages.nix to override the default cudnn version.
Then you can make your own cudaPackages_11_4_cudnn_8_2_4 = callPackage ... { cudaVersion = "11.4"; cuDnnVersion = "8.2.4"; } package set on the target machine

Are you following the https://matrix.to/#/#cuda:nixos.org channel?

1 Like

@SergeK Thanks for the response. Yes, we’re still trying to figure this out but pushed it to the back burner to fight other fires.

We’re completely new to NixOS and therefore, while your description “conceptually” make sense, a real example would be the most helpful. Do you have or can you point us to something to get us started?

No, we weren’t aware of the https://matrix.to/#/#cuda:nixos.org channel – we’ll jump in and take a look. Sounds like it would be quite useful.

Thanks again for your thoughts and suggestions.

1 Like

It’s not much, but you could refer to some of the cudaPackages update/extension PRs that were merged after the overhaul of cuda infra in nixpkgs:

CUDA 11.8 has been released the other day, so there’s plenty of causes to review the whole thing again

2 Likes

@SergeK Thanks! Will take a look.

https://github.com/NixOS/nixpkgs/pull/215578