From 5aa1fe8ea995ab8baa1147ad99b9fc8842424edc Mon Sep 17 00:00:00 2001 From: Mitchell Pleune Date: Mon, 17 Feb 2025 18:10:59 +0000 Subject: [PATCH 1/2] mxnet: remove cuda support mxnet is unmaintained, and requires cuda<=11 to compile. Removed support completely as most projects are migrating away from mxnet, and nixpkgs will soon stop supporting these old cuda versions. --- .../science/math/mxnet/default.nix | 57 +++++-------------- .../python-modules/mxnet/default.nix | 5 +- pkgs/top-level/all-packages.nix | 4 +- 3 files changed, 15 insertions(+), 51 deletions(-) diff --git a/pkgs/applications/science/math/mxnet/default.nix b/pkgs/applications/science/math/mxnet/default.nix index 50576390ee02..64486df41151 100644 --- a/pkgs/applications/science/math/mxnet/default.nix +++ b/pkgs/applications/science/math/mxnet/default.nix @@ -12,22 +12,15 @@ gomp, llvmPackages, perl, + # mxnet cuda support is turned off, but dependencies like opencv can still be built with cudaSupport + # and fail to compile without the cudatoolkit + # mxnet cuda support will not be availaible, as mxnet requires version <=11 cudaSupport ? config.cudaSupport, cudaPackages ? { }, - nvidia_x11, - cudnnSupport ? cudaSupport, }: -let - inherit (cudaPackages) - backendStdenv - cudatoolkit - cudaFlags - cudnn - ; -in - -assert cudnnSupport -> cudaSupport; +# mxnet is not maintained, and other projects are migrating away from it. +# https://github.com/apache/mxnet/issues/21206 stdenv.mkDerivation rec { pname = "mxnet"; @@ -67,27 +60,16 @@ stdenv.mkDerivation rec { ] ++ lib.optional stdenv.cc.isGNU gomp ++ lib.optional stdenv.cc.isClang llvmPackages.openmp - # FIXME: when cuda build is fixed, remove nvidia_x11, and use /run/opengl-driver/lib ++ lib.optionals cudaSupport [ - cudatoolkit - nvidia_x11 - ] - ++ lib.optional cudnnSupport cudnn; + # needed for OpenCV cmake module + cudaPackages.cudatoolkit + ]; - cmakeFlags = - [ "-DUSE_MKL_IF_AVAILABLE=OFF" ] - ++ ( - if cudaSupport then - [ - "-DUSE_OLDCMAKECUDA=ON" # see https://github.com/apache/incubator-mxnet/issues/10743 - "-DCUDA_ARCH_NAME=All" - "-DCUDA_HOST_COMPILER=${backendStdenv.cc}/bin/cc" - "-DMXNET_CUDA_ARCH=${builtins.concatStringsSep ";" cudaFlags.realArches}" - ] - else - [ "-DUSE_CUDA=OFF" ] - ) - ++ lib.optional (!cudnnSupport) "-DUSE_CUDNN=OFF"; + cmakeFlags = [ + "-DUSE_MKL_IF_AVAILABLE=OFF" + "-DUSE_CUDA=OFF" + "-DUSE_CUDNN=OFF" + ]; env.NIX_CFLAGS_COMPILE = toString [ # Needed with GCC 12 @@ -107,24 +89,11 @@ stdenv.mkDerivation rec { rm "$out"/lib/*.a ''; - # used to mark cudaSupport in python310Packages.mxnet as broken; - # other attributes exposed for consistency - passthru = { - inherit - cudaSupport - cudnnSupport - cudatoolkit - cudnn - ; - }; - meta = with lib; { description = "Lightweight, Portable, Flexible Distributed/Mobile Deep Learning with Dynamic, Mutation-aware Dataflow Dep Scheduler"; homepage = "https://mxnet.incubator.apache.org/"; maintainers = with maintainers; [ abbradar ]; license = licenses.asl20; platforms = platforms.unix; - # Build failures when linking mxnet_unit_tests: https://gist.github.com/6d17447ee3557967ec52c50d93b17a1d - broken = cudaSupport; }; } diff --git a/pkgs/development/python-modules/mxnet/default.nix b/pkgs/development/python-modules/mxnet/default.nix index 75f9ff539146..a56d2ba49245 100644 --- a/pkgs/development/python-modules/mxnet/default.nix +++ b/pkgs/development/python-modules/mxnet/default.nix @@ -9,7 +9,6 @@ graphviz, python, isPy3k, - isPy310, }: buildPythonPackage { @@ -51,7 +50,5 @@ buildPythonPackage { ln -s ${pkgs.mxnet}/lib/libmxnet.so $out/${python.sitePackages}/mxnet ''; - meta = pkgs.mxnet.meta // { - broken = (pkgs.mxnet.broken or false) || (isPy310 && pkgs.mxnet.cudaSupport); - }; + meta = pkgs.mxnet.meta; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index e12ea2e5424a..9c5679d86d43 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -17313,9 +17313,7 @@ with pkgs; lisp-compiler = ecl; }; - mxnet = callPackage ../applications/science/math/mxnet { - inherit (linuxPackages) nvidia_x11; - }; + mxnet = callPackage ../applications/science/math/mxnet { }; wxmaxima = callPackage ../applications/science/math/wxmaxima { wxGTK = wxGTK32.override { From 2563f38d01ea1f18c8044d9395fcfb2bd61f33ad Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Fri, 28 Feb 2025 21:45:33 +0100 Subject: [PATCH 2/2] mxnet: don't try to build on darwin --- pkgs/applications/science/math/mxnet/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/applications/science/math/mxnet/default.nix b/pkgs/applications/science/math/mxnet/default.nix index 64486df41151..83e20d2c129f 100644 --- a/pkgs/applications/science/math/mxnet/default.nix +++ b/pkgs/applications/science/math/mxnet/default.nix @@ -94,6 +94,6 @@ stdenv.mkDerivation rec { homepage = "https://mxnet.incubator.apache.org/"; maintainers = with maintainers; [ abbradar ]; license = licenses.asl20; - platforms = platforms.unix; + platforms = platforms.linux; }; }