python3Packages.pynvml: add a gpu test

This commit is contained in:
Someone Serge 2023-09-20 07:02:35 +03:00
parent b9299696ab
commit 7ed2cba5e8
2 changed files with 27 additions and 0 deletions

View File

@ -1,6 +1,7 @@
{
lib,
buildPythonPackage,
callPackage,
fetchFromGitHub,
substituteAll,
pythonOlder,
@ -50,6 +51,9 @@ buildPythonPackage rec {
# OSError: /run/opengl-driver/lib/libnvidia-ml.so.1: cannot open shared object file: No such file or directory
doCheck = false;
passthru.tests.nvmlInit = callPackage ./test-gpu.nix { };
meta = with lib; {
description = "Python bindings for the NVIDIA Management Library";
homepage = "https://github.com/gpuopenanalytics/pynvml";

View File

@ -0,0 +1,23 @@
{ runCommandNoCC
, python
}:
runCommandNoCC "pynvml-gpu-test"
{
nativeBuildInputs = [
(python.withPackages (ps: [ ps.pynvml ]))
];
requiredSystemFeatures = [
"cuda"
];
} ''
python3 << EOF
import pynvml
from pynvml.smi import nvidia_smi
pynvml.nvmlInit()
EOF
touch $out
''