git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #170264 from armeenm/remove-caffe2

caffe2: remove

commitb98c8eabadeb4ee789663c174870bfb256b73cf2 authorRick van Schijndel <Mindavi@users.noreply.github.com> dateThu 5 May 2022, 08:15 (5 years ago) parent44667be8ddb45c
5 files changed+1−259
pkgs/development/libraries/science/math/caffe2/default.nix−151 pkgs/development/libraries/science/math/caffe2/fix_compilation_on_gcc7.patch−46 pkgs/development/libraries/science/math/caffe2/update_clang_cvtsh_bugfix.patch−55 pkgs/top-level/aliases.nix+1 pkgs/top-level/all-packages.nix−7
pkgs/development/libraries/science/math/caffe2/default.nixdeleted−151
@@ -1,151 +0,0 @@
1−{ stdenv, lib, config, fetchFromGitHub
2−, cmake
3−, glog, gflags, gtest
4−, protobuf, snappy
5−, python, future, six, python-protobuf, numpy, pydot
6−, eigen
7−, doxygen
8−, useCuda ? (config.cudaSupport or false), cudaPackages ? {}
9−, useCudnn ? (config.cudnnSupport or false)
10−, useOpenmp ? false, openmp ? null
11−, useOpencv3 ? true, opencv3 ? null
12−, useLeveldb ? false, leveldb ? null
13−, useLmdb ? true, lmdb ? null
14−, useRocksdb ? false, rocksdb ? null
15−, useZeromq ? false, zeromq ? null
16−, useMpi ? false, mpi ? null
17−# TODO: distributed computations
18−#, useGloo ? false
19−#, useNccl ? false
20−#, useNnpack ? false
21−}:
22−
23−let
24− inherit (cudaPackages) cudatoolkit cudnn;
25−in
26−
27−assert useCuda -> cudatoolkit != null;
28−assert useCudnn -> (useCuda && cudnn != null);
29−assert useOpencv3 -> opencv3 != null;
30−assert useLeveldb -> leveldb != null;
31−assert useLmdb -> lmdb != null;
32−assert useRocksdb -> rocksdb != null;
33−assert useZeromq -> zeromq != null;
34−assert useMpi -> mpi != null;
35−
36−let
37− # Third party modules that caffe2 holds as git submodules.
38− # Download them and create symlinks from caffe2/third_party.
39− installExtraSrc = extra: ''
40− rmdir "third_party/${extra.dst}"
41− ln -s "${extra.src}" "third_party/${extra.dst}"
42− '';
43−
44− cub = {
45− src = fetchFromGitHub {
46− owner = "NVlabs";
47− repo = "cub";
48− rev = "v1.7.4";
49− sha256 = "0ksd5n1lxqhm5l5cd2lps4cszhjkf6gmzahaycs7nxb06qci8c66";
50− };
51− dst = "cub";
52− };
53−
54− pybind11 = {
55− src = fetchFromGitHub {
56− owner = "pybind";
57− repo = "pybind11";
58− rev = "86e2ad4f77442c3350f9a2476650da6bee253c52";
59− sha256 = "05gi58dirvc8fgm0avpydvidzsbh2zrzgfaq671ym09f6dz0bcgz";
60− };
61− dst = "pybind11";
62− };
63−
64− ccVersion = lib.getVersion stdenv.cc;
65−in
66−
67−stdenv.mkDerivation rec {
68− pname = "caffe2";
69− version = "0.8.1";
70− src = fetchFromGitHub {
71− owner = "caffe2";
72− repo = "caffe2";
73− rev = "v${version}";
74− sha256 = "18y7zjc69j6n5642l9caddl641b0djf3pjn4wacdsc1wk1jiyqk8";
75− };
76−
77− nativeBuildInputs = [ cmake doxygen gtest ];
78− outputs = [ "bin" "out" ];
79− propagatedBuildOutputs = [ ]; # otherwise propagates out -> bin cycle
80−
81− buildInputs = [ glog gflags protobuf snappy eigen ]
82− ++ lib.optional useCuda cudatoolkit
83− ++ lib.optional useCudnn cudnn
84− ++ lib.optional useOpenmp openmp
85− ++ lib.optional useOpencv3 opencv3
86− ++ lib.optional useLeveldb leveldb
87− ++ lib.optional useLmdb lmdb
88− ++ lib.optional useRocksdb rocksdb
89− ++ lib.optional useZeromq zeromq
90− ;
91− propagatedBuildInputs = [ numpy future six python-protobuf pydot ];
92−
93− patches = lib.optional (stdenv.cc.isGNU && lib.versionAtLeast ccVersion "7.0.0") [
94− ./fix_compilation_on_gcc7.patch
95− ] ++ lib.optional stdenv.cc.isClang [ ./update_clang_cvtsh_bugfix.patch ];
96−
97− cmakeFlags = [ "-DBUILD_TEST=OFF"
98− "-DBUILD_PYTHON=ON"
99− ''-DUSE_CUDA=${if useCuda then "ON"else "OFF"}''
100− ''-DUSE_OPENMP=${if useOpenmp then "ON"else "OFF"}''
101− ''-DUSE_OPENCV=${if useOpencv3 then "ON"else "OFF"}''
102− ''-DUSE_MPI=${if useMpi then "ON"else "OFF"}''
103− ''-DUSE_LEVELDB=${if useLeveldb then "ON"else "OFF"}''
104− ''-DUSE_LMDB=${if useLmdb then "ON"else "OFF"}''
105− ''-DUSE_ROCKSDB=${if useRocksdb then "ON"else "OFF"}''
106− ''-DUSE_ZMQ=${if useZeromq then "ON"else "OFF"}''
107− "-DUSE_GLOO=OFF"
108− "-DUSE_NNPACK=OFF"
109− "-DUSE_NCCL=OFF"
110− "-DUSE_REDIS=OFF"
111− "-DUSE_FFMPEG=OFF"
112− ]
113− ++ lib.optional useCuda [
114− "-DCUDA_TOOLKIT_ROOT_DIR=${cudatoolkit}"
115− "-DCUDA_FAST_MATH=ON"
116− "-DCUDA_HOST_COMPILER=${cudatoolkit.cc}/bin/gcc"
117− ];
118−
119− preConfigure = ''
120− ${installExtraSrc cub}
121− ${installExtraSrc pybind11}
122− # XXX hack
123− export NIX_CFLAGS_COMPILE="-I ${eigen}/include/eigen3/ $NIX_CFLAGS_COMPILE"
124− '';
125−
126− postInstall = ''
127− moveToOutput "bin" "$bin"
128− mkdir -p $out/lib/${python.libPrefix}
129− ln -s $out/ $out/${python.sitePackages}
130− '';
131−
132− doCheck = false;
133−
134− meta = {
135− homepage = "https://caffe2.ai/";
136− description = "A new lightweight, modular, and scalable deep learning framework";
137− longDescription = ''
138− Caffe2 aims to provide an easy and straightforward way for you to experiment
139− with deep learning and leverage community contributions of new models and
140− algorithms. You can bring your creations to scale using the power of GPUs in the
141− cloud or to the masses on mobile with Caffe2's cross-platform libraries.
142− '';
143− platforms = with lib.platforms; linux;
144− license = lib.licenses.asl20;
145− maintainers = with lib.maintainers; [ yuriaisaka ];
146− # fails to compile with
147− # error: invalid conversion from 'const char*' to 'char*'
148− # TODO: Remove usage of python2, protobuf overwrite
149− broken = true;
150− };
151−}
pkgs/development/libraries/science/math/caffe2/fix_compilation_on_gcc7.patchdeleted−46
@@ -1,46 +0,0 @@
1−diff --git a/caffe2/operators/recurrent_network_op.cc b/caffe2/operators/recurrent_network_op.cc
2−index dd4fded..5995e8a 100644
3−--- a/caffe2/operators/recurrent_network_op.cc
4−+++ b/caffe2/operators/recurrent_network_op.cc
5−@@ -1,4 +1,4 @@
6−-#include "recurrent_network_op.h"
7−+#include "caffe2/operators/recurrent_network_op.h"
8− #include "caffe2/core/workspace.h"
9−
10− namespace caffe2 {
11−diff --git a/caffe2/operators/recurrent_network_op.h b/caffe2/operators/recurrent_network_op.h
12−index 55328e5..ea898bc 100644
13−--- a/caffe2/operators/recurrent_network_op.h
14−+++ b/caffe2/operators/recurrent_network_op.h
15−@@ -762,8 +762,8 @@ class AccumulateInputGradientOp : public Operator<Context> {
16− USE_OPERATOR_CONTEXT_FUNCTIONS;
17−
18− bool RunOnDevice() override {
19−- const auto t =
20−- OperatorBase::Input<Tensor<CPUContext>>(0).template data<int32_t>()[0];
21−+ const auto& t0 = OperatorBase::Input<Tensor<CPUContext>>(0);
22−+ const auto t = t0.template data<int32_t>()[0];
23− auto& og = Input(1);
24− auto* g = Output(0);
25−
26−diff --git a/caffe2/queue/queue_ops.h b/caffe2/queue/queue_ops.h
27−index f2c0a33..642343f 100644
28−--- a/caffe2/queue/queue_ops.h
29−+++ b/caffe2/queue/queue_ops.h
30−@@ -17,13 +17,10 @@ class CreateBlobsQueueOp final : public Operator<Context> {
31− name(operator_def.output().Get(0)) {}
32−
33− bool RunOnDevice() override {
34−- const auto capacity =
35−- OperatorBase::template GetSingleArgument<int>("capacity", 1);
36−- const auto numBlobs =
37−- OperatorBase::template GetSingleArgument<int>("num_blobs", 1);
38−+ const auto capacity = GetSingleArgument("capacity", 1);
39−+ const auto numBlobs = GetSingleArgument("num_blobs", 1);
40− const auto enforceUniqueName =
41−- OperatorBase::template GetSingleArgument<int>(
42−- "enforce_unique_name", false);
43−+ GetSingleArgument("enforce_unique_name", false);
44− const auto fieldNames =
45− OperatorBase::template GetRepeatedArgument<std::string>("field_names");
46− CAFFE_ENFORCE_EQ(this->OutputSize(), 1);
pkgs/development/libraries/science/math/caffe2/update_clang_cvtsh_bugfix.patchdeleted−55
@@ -1,55 +0,0 @@
1−diff --git a/caffe2/perfkernels/cvtsh_ss_bugfix.h b/caffe2/perfkernels/cvtsh_ss_bugfix.h
2−index bd06681..00172b7 100644
3−--- a/caffe2/perfkernels/cvtsh_ss_bugfix.h
4−+++ b/caffe2/perfkernels/cvtsh_ss_bugfix.h
5−@@ -1,10 +1,36 @@
6−+/**
7−+ * Copyright (c) 2016-present, Facebook, Inc.
8−+ *
9−+ * Licensed under the Apache License, Version 2.0 (the "License");
10−+ * you may not use this file except in compliance with the License.
11−+ * You may obtain a copy of the License at
12−+ *
13−+ * http://www.apache.org/licenses/LICENSE-2.0
14−+ *
15−+ * Unless required by applicable law or agreed to in writing, software
16−+ * distributed under the License is distributed on an "AS IS" BASIS,
17−+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18−+ * See the License for the specific language governing permissions and
19−+ * limitations under the License.
20−+ */
21−+
22− #pragma once
23−
24−-#if defined(__APPLE__) && (__clang_major__ < 8)
25−+// Apple clang was fixed in 8.1
26−+#if defined(__apple_build_version__) && ((__clang_major__ < 8) || ((__clang_major__ == 8) && (__clang_minor__ < 1)))
27−+#define __APPLE_NEED_FIX 1
28−+#endif
29−+
30−+// Regular clang was fixed in 3.9
31−+#if defined(__clang__) && (__clang_major__ < 4) && (__clang_minor__ < 9)
32−+#define __CLANG_NEED_FIX 1
33−+#endif
34−+
35−+#if __APPLE_NEED_FIX || __CLANG_NEED_FIX
36−
37− #include <emmintrin.h>
38−
39−-// This version of apple clang has a bug that _cvtsh_ss is not defined, see
40−+// This version of clang has a bug that _cvtsh_ss is not defined, see
41− // https://reviews.llvm.org/D16177
42− static __inline float
43− __attribute__((__always_inline__, __nodebug__, __target__("f16c")))
44−@@ -15,7 +41,10 @@ _cvtsh_ss(unsigned short a)
45− return r[0];
46− }
47−
48−-#endif // defined(__APPLE__) && (__clang_major__ < 8)
49−+#endif // __APPLE_NEED_FIX || __CLANG_NEED_FIX
50−+
51−+#undef __APPLE_NEED_FIX
52−+#undef __CLANG_NEED_FIX
53−
54− #ifdef _MSC_VER
55−
pkgs/top-level/aliases.nix+1
@@ -147,6 +147,7 @@ mapAliases ({
147147
148148 c14 = throw "c14 is deprecated and archived by upstream"; # Added 2022-04-10
149149 caddy1 = throw "caddy 1.x has been removed from nixpkgs, as it's unmaintained: https://github.com/caddyserver/caddy/blob/master/.github/SECURITY.md#supported-versions"; # Added 2020-10-02
150+ caffe2 = throw "caffe2 has been removed: subsumed under the PyTorch project"; # Added 2022-04-25
150151 calibre-py2 = throw "calibre-py2 has been removed from nixpkgs, as calibre has upgraded to python 3. Please use calibre as replacement"; # Added 2021-01-13
151152 calibre-py3 = throw "calibre-py3 has been removed from nixpkgs, as calibre's default python version is now 3. Please use calibre as replacement"; # Added 2021-01-13
152153 callPackage_i686 = pkgsi686Linux.callPackage;
pkgs/top-level/all-packages.nix−7
@@ -33416,13 +33416,6 @@ with pkgs;
3341633416
3341733417 caffeWithCuda = caffe.override { cudaSupport = true; };
3341833418
33419− caffe2 = callPackage ../development/libraries/science/math/caffe2 (rec {
33420− inherit (python3Packages) python future six numpy pydot;
33421− protobuf = protobuf3_1;
33422− python-protobuf = python3Packages.protobuf.override { inherit protobuf; };
33423− opencv3 = opencv3WithoutCuda; # Used only for image loading.
33424− });
33425−
3342633419 caffeine-ng = callPackage ../tools/X11/caffeine-ng {};
3342733420
3342833421 cntk = callPackage ../applications/science/math/cntk {