tensorrt: fix false fallback to tensorRTDefaultVersion

Throw an error if the default version of tensorrt does not support the
cuda version.

Adding cudatoolkit 11.8 fails to evaluate
tensorrt.{tensorRTDefaultVersion} as "11.8" is not listed on any
supportedCudaVersions of any tensorRTVersions attributes.
This commit is contained in:
David Guibert 2022-10-05 09:24:56 +02:00
parent 8a63fb0236
commit ad6aeedf56

View File

@ -24,7 +24,9 @@ final: prev: let
# Add all supported builds as attributes
allBuilds = mapAttrs' (version: file: nameValuePair (computeName version) (buildTensorRTPackage (removeAttrs file ["fileVersionCuda"]))) supportedVersions;
# Set the default attributes, e.g. tensorrt = tensorrt_8_4;
defaultBuild = { "tensorrt" = allBuilds.${computeName tensorRTDefaultVersion}; };
defaultBuild = { "tensorrt" = if allBuilds ? ${computeName tensorRTDefaultVersion}
then allBuilds.${computeName tensorRTDefaultVersion}
else throw "tensorrt-${tensorRTDefaultVersion} does not support your cuda version ${cudaVersion}"; };
in allBuilds // defaultBuild;
tensorRTVersions = {