From 4d34cbeeced65607945be9af329b826794cb81b3 Mon Sep 17 00:00:00 2001 From: Weijia Wang <9713184+wegank@users.noreply.github.com> Date: Mon, 9 Oct 2023 16:52:23 +0200 Subject: [PATCH] cntk: drop --- .../science/math/cntk/default.nix | 134 ------------------ .../python-modules/cntk/default.nix | 61 -------- pkgs/top-level/aliases.nix | 1 + pkgs/top-level/all-packages.nix | 7 - pkgs/top-level/python-aliases.nix | 1 + pkgs/top-level/python-packages.nix | 2 - 6 files changed, 2 insertions(+), 204 deletions(-) delete mode 100644 pkgs/applications/science/math/cntk/default.nix delete mode 100644 pkgs/development/python-modules/cntk/default.nix diff --git a/pkgs/applications/science/math/cntk/default.nix b/pkgs/applications/science/math/cntk/default.nix deleted file mode 100644 index 91d208a56ede..000000000000 --- a/pkgs/applications/science/math/cntk/default.nix +++ /dev/null @@ -1,134 +0,0 @@ -{ lib, stdenv, fetchFromGitHub, cmake -, fetchpatch -, openblas, blas, lapack, opencv3, libzip, boost, protobuf, mpi -, onebitSGDSupport ? false -, config -, cudaSupport ? config.cudaSupport, cudaPackages ? { }, addOpenGLRunpath, cudatoolkit, nvidia_x11 -, cudnnSupport ? cudaSupport -}: - -let - inherit (cudaPackages) cudatoolkit cudnn; -in - -assert cudnnSupport -> cudaSupport; -assert blas.implementation == "openblas" && lapack.implementation == "openblas"; - -let - # Old specific version required for CNTK. - cub = fetchFromGitHub { - owner = "NVlabs"; - repo = "cub"; - rev = "1.7.4"; - sha256 = "0ksd5n1lxqhm5l5cd2lps4cszhjkf6gmzahaycs7nxb06qci8c66"; - }; - -in stdenv.mkDerivation rec { - pname = "CNTK"; - version = "2.7"; - - src = fetchFromGitHub { - owner = "Microsoft"; - repo = "CNTK"; - rev = "v${version}"; - sha256 = "sha256-2rIrPJyvZhnM5EO6tNhF6ARTocfUHce4N0IZk/SZiaI="; - fetchSubmodules = true; - }; - - patches = [ - # Fix build with protobuf 3.18+ - # Remove with onnx submodule bump to 1.9+ - (fetchpatch { - url = "https://github.com/onnx/onnx/commit/d3bc82770474761571f950347560d62a35d519d7.patch"; - extraPrefix = "Source/CNTKv2LibraryDll/proto/onnx/onnx_repo/"; - stripLen = 1; - sha256 = "00raqj8wx30b06ky6cdp5vvc1mrzs7hglyi6h58hchw5lhrwkzxp"; - }) - ]; - - postPatch = '' - # Fix build with protobuf 3.18+ - substituteInPlace Source/CNTKv2LibraryDll/Serialization.cpp \ - --replace 'SetTotalBytesLimit(INT_MAX, INT_MAX)' \ - 'SetTotalBytesLimit(INT_MAX)' \ - --replace 'SetTotalBytesLimit(limit, limit)' \ - 'SetTotalBytesLimit(limit)' - ''; - - nativeBuildInputs = [ cmake ] ++ lib.optional cudaSupport addOpenGLRunpath; - - # Force OpenMPI to use g++ in PATH. - OMPI_CXX = "g++"; - - # Uses some deprecated tensorflow functions - env.NIX_CFLAGS_COMPILE = "-Wno-error=deprecated-declarations"; - - buildInputs = [ openblas opencv3 libzip boost protobuf mpi ] - ++ lib.optional cudaSupport cudatoolkit - ++ lib.optional cudnnSupport cudnn; - - configureFlags = [ - "--with-opencv=${opencv3}" - "--with-libzip=${libzip.dev}" - "--with-openblas=${openblas.dev}" - "--with-boost=${boost.dev}" - "--with-protobuf=${protobuf}" - "--with-mpi=${mpi}" - "--cuda=${if cudaSupport then "yes" else "no"}" - # FIXME - "--asgd=no" - ] ++ lib.optionals cudaSupport [ - "--with-cuda=${cudatoolkit}" - "--with-gdk-include=${cudatoolkit}/include" - "--with-gdk-nvml-lib=${nvidia_x11}/lib" - "--with-cub=${cub}" - ] ++ lib.optional onebitSGDSupport "--1bitsgd=yes"; - - configurePhase = '' - sed -i \ - -e 's,^GIT_STATUS=.*,GIT_STATUS=,' \ - -e 's,^GIT_COMMIT=.*,GIT_COMMIT=v${version},' \ - -e 's,^GIT_BRANCH=.*,GIT_BRANCH=v${version},' \ - -e 's,^BUILDER=.*,BUILDER=nixbld,' \ - -e 's,^BUILDMACHINE=.*,BUILDMACHINE=machine,' \ - -e 's,^BUILDPATH=.*,BUILDPATH=/homeless-shelter,' \ - -e '/git does not exist/d' \ - Tools/generate_build_info - - patchShebangs . - mkdir build - cd build - ${lib.optionalString cudnnSupport '' - mkdir cuda - ln -s ${cudnn}/include cuda - export configureFlags="$configureFlags --with-cudnn=$PWD" - ''} - - ../configure $configureFlags - ''; - - installPhase = '' - mkdir -p $out/bin - # Moving to make patchelf remove references later. - mv lib $out - cp bin/cntk $out/bin - ''; - - postFixup = lib.optionalString cudaSupport '' - for lib in $out/lib/*; do - addOpenGLRunpath "$lib" - done - ''; - - meta = with lib; { - homepage = "https://github.com/Microsoft/CNTK"; - description = "An open source deep-learning toolkit"; - license = if onebitSGDSupport then licenses.unfreeRedistributable else licenses.mit; - platforms = [ "x86_64-linux" ]; - maintainers = with maintainers; [ abbradar ]; - # Newer cub is included with cudatoolkit now and it breaks the build. - # https://github.com/Microsoft/CNTK/issues/3191 - # broken = cudaSupport; - broken = true; # at 2022-11-23 - }; -} diff --git a/pkgs/development/python-modules/cntk/default.nix b/pkgs/development/python-modules/cntk/default.nix deleted file mode 100644 index b1bba8cf1e0f..000000000000 --- a/pkgs/development/python-modules/cntk/default.nix +++ /dev/null @@ -1,61 +0,0 @@ -{ lib -, buildPythonPackage -, pkgs -, numpy -, scipy -, mpi -, enum34 -, protobuf -, pip -, python -, swig -}: - -let - cntk = pkgs.cntk; -in -buildPythonPackage { - inherit (cntk) name version src; - - nativeBuildInputs = [ swig mpi ]; - buildInputs = [ cntk mpi ]; - propagatedBuildInputs = [ numpy scipy enum34 protobuf pip ]; - - CNTK_LIB_PATH = "${cntk}/lib"; - CNTK_COMPONENT_VERSION = cntk.version; - CNTK_VERSION = cntk.version; - CNTK_VERSION_BANNER = cntk.version; - - postPatch = '' - cd bindings/python - sed -i 's,"libmpi.so.12","${mpi}/lib/libmpi.so",g' cntk/train/distributed.py - - # Remove distro and libs checks; they aren't compatible with NixOS and besides we guarantee - # compatibility by providing a package. - cat < cntk/cntk_py_init.py - def cntk_check_distro_info(): - pass - def cntk_check_libs(): - pass - EOF - ''; - - postInstall = '' - rm -rf $out/${python.sitePackages}/cntk/libs - ln -s ${cntk}/lib $out/${python.sitePackages}/cntk/libs - # It's not installed for some reason. - cp cntk/cntk_py.py $out/${python.sitePackages}/cntk - ''; - - # Actual tests are broken. - checkPhase = '' - cd $NIX_BUILD_TOP - ${python.interpreter} -c "import cntk" - ''; - - meta = { - inherit (cntk.meta) homepage description license maintainers platforms; - # doesn't support Python 3.7 - broken = lib.versionAtLeast python.version "3.7"; - }; -} diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix index e8a8f03a4841..2cc4a5685521 100644 --- a/pkgs/top-level/aliases.nix +++ b/pkgs/top-level/aliases.nix @@ -135,6 +135,7 @@ mapAliases ({ crispyDoom = crispy-doom; # Added 2023-05-01 clasp = clingo; # added 2022-12-22 claws-mail-gtk3 = claws-mail; # Added 2021-07-10 + cntk = throw "'cntk' has been removed from nixpkgs, as it was broken and unmaintained"; # Added 2023-10-09 codimd = hedgedoc; # Added 2020-11-29 inherit (libsForQt5.mauiPackages) communicator; # added 2022-05-17 compton = throw "'compton' has been renamed to/replaced by 'picom'"; # Converted to throw 2023-09-10 diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index d86b30b3a4de..e7d25a49da57 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -40054,13 +40054,6 @@ with pkgs; caffeine-ng = callPackage ../tools/X11/caffeine-ng { }; - cntk = callPackage ../applications/science/math/cntk { - stdenv = gcc7Stdenv; - inherit (linuxPackages) nvidia_x11; - opencv3 = opencv3WithoutCuda; # Used only for image loading. - inherit (config) cudaSupport; - }; - dap = callPackage ../applications/science/math/dap { }; ecm = callPackage ../applications/science/math/ecm { }; diff --git a/pkgs/top-level/python-aliases.nix b/pkgs/top-level/python-aliases.nix index bf8e221fdfa4..32cf95500d49 100644 --- a/pkgs/top-level/python-aliases.nix +++ b/pkgs/top-level/python-aliases.nix @@ -74,6 +74,7 @@ mapAliases ({ carrot = throw "carrot has been removed, as its development was discontinued in 2012"; # added 2022-01-18 cchardet = faust-cchardet; # added 2023-03-02 class-registry = phx-class-registry; # added 2021-10-05 + cntk = throw "cntk has been removed from nixpkgs, as it was broken and unmaintained"; # Added 2023-10-09 codespell = throw "codespell has been promoted to a top-level attribute"; # Added 2022-10-02 ColanderAlchemy = colanderalchemy; # added 2023-02-19 CommonMark = commonmark; # added 2023-02-1 diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 39dd6a6b11a9..eeb310dd886f 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -2149,8 +2149,6 @@ self: super: with self; { cmsis-svd = callPackage ../development/python-modules/cmsis-svd { }; - cntk = callPackage ../development/python-modules/cntk { }; - cnvkit = callPackage ../development/python-modules/cnvkit { }; co2signal = callPackage ../development/python-modules/co2signal { };