From f212d9384a011b984a1f9f6967474f4a1d25a99e Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Mon, 6 Oct 2025 10:48:37 +0200 Subject: [PATCH 1/2] cudaPackages.writeGpuTestPython: add gpuCheckArgs parameter Allows to provide nativeBuildInputs to the test derivation (gpuCheck). Co-authored-by: "Else, Someone" --- .../packages/writeGpuTestPython.nix | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/pkgs/development/cuda-modules/packages/writeGpuTestPython.nix b/pkgs/development/cuda-modules/packages/writeGpuTestPython.nix index 23282e916929..ea7a52e6fe2c 100644 --- a/pkgs/development/cuda-modules/packages/writeGpuTestPython.nix +++ b/pkgs/development/cuda-modules/packages/writeGpuTestPython.nix @@ -3,11 +3,13 @@ runCommand, python3Packages, makeWrapper, + writableTmpDirAsHomeHook, }: { feature ? "cuda", name ? if feature == null then "cpu" else feature, libraries ? [ ], # [PythonPackage] | (PackageSet -> [PythonPackage]) + gpuCheckArgs ? { }, ... }@args: @@ -28,6 +30,7 @@ let runCommand "tester-${name}" ( lib.removeAttrs args [ + "gpuCheckArgs" "libraries" "name" ] @@ -52,10 +55,18 @@ let tester' = tester.overrideAttrs (oldAttrs: { passthru.gpuCheck = runCommand "test-${name}" - { - nativeBuildInputs = [ tester' ]; - requiredSystemFeatures = lib.optionals (feature != null) [ feature ]; - } + ( + gpuCheckArgs + // { + nativeBuildInputs = [ + tester' + ] + ++ gpuCheckArgs.nativeBuildInputs or [ ]; + + requiredSystemFeatures = + lib.optionals (feature != null) [ feature ] ++ gpuCheckArgs.requiredSystemFeatures or [ ]; + } + ) '' set -e ${tester.meta.mainProgram or (lib.getName tester')} From 7e72e8ab03d600565f1769a800eab49b6bf6c365 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Mon, 6 Oct 2025 10:56:28 +0200 Subject: [PATCH 2/2] python3Packages.torch.tests.tester-compileCuda.gpuCheck: fix by setting HOME to tmpdir --- .../python-modules/torch/tests/mk-torch-compile-check.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkgs/development/python-modules/torch/tests/mk-torch-compile-check.nix b/pkgs/development/python-modules/torch/tests/mk-torch-compile-check.nix index 9741902dab2a..2082877ef628 100644 --- a/pkgs/development/python-modules/torch/tests/mk-torch-compile-check.nix +++ b/pkgs/development/python-modules/torch/tests/mk-torch-compile-check.nix @@ -5,6 +5,7 @@ libraries, name ? if feature == null then "torch-compile-cpu" else "torch-compile-${feature}", stdenv, + writableTmpDirAsHomeHook, }: let deviceStr = if feature == null then "" else '', device="cuda"''; @@ -12,6 +13,12 @@ in cudaPackages.writeGpuTestPython { inherit name feature libraries; + + # This could be accomplished with propagatedBuildInputs instead of introducing + gpuCheckArgs.nativeBuildInputs = [ + # torch._inductor.exc.InductorError: PermissionError: [Errno 13] Permission denied: '/homeless-shelter' + writableTmpDirAsHomeHook + ]; makeWrapperArgs = [ "--suffix" "PATH"