2022-08-12 12:06:08 +00:00
|
|
|
{ lib
|
|
|
|
, python
|
|
|
|
, buildPythonPackage
|
|
|
|
, autoPatchelfHook
|
|
|
|
, unzip
|
|
|
|
, cudaPackages
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
pyVersion = "${lib.versions.major python.version}${lib.versions.minor python.version}";
|
|
|
|
in
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "tensorrt";
|
2024-01-02 11:29:13 +00:00
|
|
|
version = lib.optionalString (cudaPackages ? tensorrt) cudaPackages.tensorrt.version;
|
2022-08-12 12:06:08 +00:00
|
|
|
|
|
|
|
src = cudaPackages.tensorrt.src;
|
|
|
|
|
|
|
|
format = "wheel";
|
|
|
|
# We unpack the wheel ourselves because of the odd packaging.
|
|
|
|
dontUseWheelUnpack = true;
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
unzip
|
|
|
|
autoPatchelfHook
|
|
|
|
cudaPackages.autoAddOpenGLRunpathHook
|
|
|
|
];
|
|
|
|
|
|
|
|
preUnpack = ''
|
|
|
|
mkdir -p dist
|
|
|
|
tar --strip-components=2 -xf "$src" --directory=dist \
|
|
|
|
"TensorRT-${version}/python/tensorrt-${version}-cp${pyVersion}-none-linux_x86_64.whl"
|
|
|
|
'';
|
|
|
|
|
|
|
|
sourceRoot = ".";
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
cudaPackages.cudnn
|
|
|
|
cudaPackages.tensorrt
|
|
|
|
];
|
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
pythonImportsCheck = [
|
2022-08-12 12:06:08 +00:00
|
|
|
"tensorrt"
|
|
|
|
];
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Python bindings for TensorRT, a high-performance deep learning interface";
|
|
|
|
homepage = "https://developer.nvidia.com/tensorrt";
|
|
|
|
license = licenses.unfree;
|
|
|
|
platforms = [ "x86_64-linux" ];
|
|
|
|
maintainers = with maintainers; [ aidalgol ];
|
2024-01-02 11:29:13 +00:00
|
|
|
broken =
|
|
|
|
!(cudaPackages ? tensorrt)
|
|
|
|
|| !(cudaPackages ? cudnn);
|
2022-08-12 12:06:08 +00:00
|
|
|
};
|
|
|
|
}
|