Merge pull request #255904 from ConnorBaker/fix/torch-descriptive-broken-messages

python3Packages.torch: add descriptive messages when marked broken

authored by Connor Baker and committed by GitHub 0ed41137 d35ac808

+12 -13
+12 -13
pkgs/development/python-modules/torch/default.nix
··· 51 }: 52 53 let 54 - inherit (lib) lists strings trivial; 55 inherit (cudaPackages) cudaFlags cudnn nccl; 56 57 setBool = v: if v then "1" else "0"; ··· 104 rocminfo rocm-thunk rocm-comgr rocm-device-libs 105 rocm-runtime rocm-opencl-runtime hipify 106 ]; 107 }; 108 in buildPythonPackage rec { 109 pname = "torch"; ··· 426 inherit cudaSupport cudaPackages; 427 # At least for 1.10.2 `torch.fft` is unavailable unless BLAS provider is MKL. This attribute allows for easy detection of its availability. 428 blasProvider = blas.provider; 429 } // lib.optionalAttrs cudaSupport { 430 # NOTE: supportedCudaCapabilities isn't computed unless cudaSupport is true, so we can't use 431 # it in the passthru set above because a downstream package might try to access it even ··· 441 license = licenses.bsd3; 442 maintainers = with maintainers; [ teh thoughtpolice tscholak ]; # tscholak esp. for darwin-related builds 443 platforms = with platforms; linux ++ lib.optionals (!cudaSupport && !rocmSupport) darwin; 444 - broken = builtins.any trivial.id [ 445 - # CUDA and ROCm are mutually exclusive 446 - (cudaSupport && rocmSupport) 447 - # CUDA is only supported on Linux 448 - (cudaSupport && !stdenv.isLinux) 449 - # Only CUDA 11 is currently supported 450 - (cudaSupport && (cudaPackages.cudaMajorVersion != "11")) 451 - # MPI cudatoolkit does not match cudaPackages.cudatoolkit 452 - (MPISupport && cudaSupport && (mpi.cudatoolkit != cudaPackages.cudatoolkit)) 453 - # Magma cudaPackages does not match cudaPackages 454 - (cudaSupport && (magma.cudaPackages != cudaPackages)) 455 - ]; 456 }; 457 }
··· 51 }: 52 53 let 54 + inherit (lib) attrsets lists strings trivial; 55 inherit (cudaPackages) cudaFlags cudnn nccl; 56 57 setBool = v: if v then "1" else "0"; ··· 104 rocminfo rocm-thunk rocm-comgr rocm-device-libs 105 rocm-runtime rocm-opencl-runtime hipify 106 ]; 107 + }; 108 + 109 + brokenConditions = attrsets.filterAttrs (_: cond: cond) { 110 + "CUDA and ROCm are not mutually exclusive" = cudaSupport && rocmSupport; 111 + "CUDA is not targeting Linux" = cudaSupport && !stdenv.isLinux; 112 + "Unsupported CUDA version" = cudaSupport && (cudaPackages.cudaMajorVersion != "11"); 113 + "MPI cudatoolkit does not match cudaPackages.cudatoolkit" = MPISupport && cudaSupport && (mpi.cudatoolkit != cudaPackages.cudatoolkit); 114 + "Magma cudaPackages does not match cudaPackages" = cudaSupport && (magma.cudaPackages != cudaPackages); 115 }; 116 in buildPythonPackage rec { 117 pname = "torch"; ··· 434 inherit cudaSupport cudaPackages; 435 # At least for 1.10.2 `torch.fft` is unavailable unless BLAS provider is MKL. This attribute allows for easy detection of its availability. 436 blasProvider = blas.provider; 437 + # To help debug when a package is broken due to CUDA support 438 + inherit brokenConditions; 439 } // lib.optionalAttrs cudaSupport { 440 # NOTE: supportedCudaCapabilities isn't computed unless cudaSupport is true, so we can't use 441 # it in the passthru set above because a downstream package might try to access it even ··· 451 license = licenses.bsd3; 452 maintainers = with maintainers; [ teh thoughtpolice tscholak ]; # tscholak esp. for darwin-related builds 453 platforms = with platforms; linux ++ lib.optionals (!cudaSupport && !rocmSupport) darwin; 454 + broken = builtins.any trivial.id (builtins.attrValues brokenConditions); 455 }; 456 }