From efd64b5f0b0794fd15492e867078be2bb0c0c95c Mon Sep 17 00:00:00 2001 From: Someone Serge Date: Fri, 8 Dec 2023 19:09:41 +0000 Subject: [PATCH] cudaPackages: move cuda tests from passthru.tests Otherwise we crash Ofborg --- pkgs/applications/misc/blender/default.nix | 8 ++++---- pkgs/development/cuda-modules/saxpy/default.nix | 2 +- pkgs/development/python-modules/pynvml/default.nix | 3 +-- pkgs/development/python-modules/torch/bin.nix | 2 +- pkgs/development/python-modules/torch/default.nix | 8 ++------ 5 files changed, 9 insertions(+), 14 deletions(-) diff --git a/pkgs/applications/misc/blender/default.nix b/pkgs/applications/misc/blender/default.nix index 357bbbe0e6f6..284ee5778101 100644 --- a/pkgs/applications/misc/blender/default.nix +++ b/pkgs/applications/misc/blender/default.nix @@ -373,16 +373,16 @@ stdenv.mkDerivation (finalAttrs: { done ''; - cudaAvailable = runCommand + }; + gpuChecks.cudaAvailable = { blenderWithCuda, runCommand }: runCommand "blender-cuda-available" { - nativeBuildInputs = [ finalAttrs.finalPackage ]; + nativeBuildInputs = [ blenderWithCuda ]; requiredSystemFeatures = [ "cuda" ]; } '' blender --background -noaudio --python-exit-code 1 --python ${./test-cuda.py} && touch $out - ''; - }; + '' { }; }; meta = { diff --git a/pkgs/development/cuda-modules/saxpy/default.nix b/pkgs/development/cuda-modules/saxpy/default.nix index 520fa5b68a44..3da3dc08f0eb 100644 --- a/pkgs/development/cuda-modules/saxpy/default.nix +++ b/pkgs/development/cuda-modules/saxpy/default.nix @@ -59,7 +59,7 @@ backendStdenv.mkDerivation { (lib.cmakeFeature "CMAKE_CUDA_ARCHITECTURES" flags.cmakeCudaArchitecturesString) ]; - passthru.tests.withCuda = saxpy.overrideAttrs ( + passthru.gpuChecks.withCuda = saxpy.overrideAttrs ( _: { requiredSystemFeatures = ["cuda"]; doInstallCheck = true; diff --git a/pkgs/development/python-modules/pynvml/default.nix b/pkgs/development/python-modules/pynvml/default.nix index e76913a63df4..79624e5298a6 100644 --- a/pkgs/development/python-modules/pynvml/default.nix +++ b/pkgs/development/python-modules/pynvml/default.nix @@ -51,8 +51,7 @@ 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 { }; - + passthru.gpuChecks.nvmlInit = callPackage ./test-gpu.nix { }; meta = with lib; { description = "Python bindings for the NVIDIA Management Library"; diff --git a/pkgs/development/python-modules/torch/bin.nix b/pkgs/development/python-modules/torch/bin.nix index 37170ea9adf4..e2899c081e08 100644 --- a/pkgs/development/python-modules/torch/bin.nix +++ b/pkgs/development/python-modules/torch/bin.nix @@ -121,7 +121,7 @@ buildPythonPackage { pythonImportsCheck = [ "torch" ]; - passthru.tests.cudaAvailable = callPackage ./test-cuda.nix { torch = torch-bin; }; + passthru.gpuChecks.cudaAvailable = callPackage ./test-cuda.nix { torch = torch-bin; }; meta = { description = "PyTorch: Tensors and Dynamic neural networks in Python with strong GPU acceleration"; diff --git a/pkgs/development/python-modules/torch/default.nix b/pkgs/development/python-modules/torch/default.nix index 671e76dfe02d..62c69905609e 100644 --- a/pkgs/development/python-modules/torch/default.nix +++ b/pkgs/development/python-modules/torch/default.nix @@ -26,7 +26,7 @@ # tests.cudaAvailable: callPackage, - torch, + torchWithCuda, # Native build inputs cmake, @@ -648,11 +648,7 @@ buildPythonPackage rec { blasProvider = blas.provider; # To help debug when a package is broken due to CUDA support inherit brokenConditions; - } // lib.optionalAttrs cudaSupport { - - tests = lib.optionalAttrs cudaSupport { - cudaAvailable = callPackage ./test-cuda.nix { inherit torch; }; - }; + gpuChecks.cudaAvailable = callPackage ./test-cuda.nix { torch = torchWithCuda; }; }; meta = {