blob: 56c060c14434b78936ee2820a935455106adf2fe (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
|
# Maintainer: Jingbei Li <i@jingbei.li>
pkgname=cntk-cuda
pkgver=2.7
pkgrel=1
pkgdesc="Microsoft Cognitive Toolkit (CNTK), an open source deep-learning toolkit"
arch=('x86_64')
url="https://github.com/Microsoft/cntk"
license=('CUSTOM')
depends=('boost' 'cub' 'cuda' 'cudnn' 'libzip' 'nccl' 'openblas-lapack' 'openmp' 'openmpi' 'protobuf-static' 'python-numpy' 'python-scipy')
makedepends=('cmake' 'gcc7' 'git' 'inetutils' 'python-pip' 'python-setuptools' 'python-wheel' 'swig')
optdepends=('swig')
source=("${pkgname}::git+$url#tag=v$pkgver"
'git+https://github.com/onnx/onnx'
'git+https://github.com/Microsoft/onnxruntime'
'git+https://github.com/Microsoft/Multiverso'
'gsl::git+https://github.com/Microsoft/GSL'
'git+https://github.com/google/benchmark'
'git+https://github.com/pybind/pybind11'
'git+https://github.com/wjakob/clang-cindex-python3'
'git+https://github.com/HowardHinnant/date'
'git+https://github.com/google/gemmlowp'
'git+https://github.com/google/googletest'
'git+https://github.com/google/nsync'
'git+https://github.com/stevenlix/onnx-tensorrt'
'git+https://github.com/google/protobuf'
'git+https://github.com/google/re2'
'git+https://github.com/dmlc/tvm'
'git+https://github.com/dmlc/HalideIR'
'git+https://github.com/dmlc/dlpack'
'git+https://github.com/dmlc/dmlc-core'
'dcasgd::git+https://github.com/Microsoft/Delayed-Compensation-Asynchronous-Stochastic-Gradient-Descent-for-Multiverso'
)
md5sums=('SKIP'
'SKIP'
'SKIP'
'SKIP'
'SKIP'
'SKIP'
'SKIP'
'SKIP'
'SKIP'
'SKIP'
'SKIP'
'SKIP'
'SKIP'
'SKIP'
'SKIP'
'SKIP'
'SKIP'
'SKIP'
'SKIP'
'SKIP')
prepare(){
cd $srcdir/$pkgname
git config submodule.Source/CNTKv2LibraryDll/proto/onnx/onnx_repo.url $srcdir/onnx
git config submodule.Source/CNTKv2LibraryDll/proto/onnx/onnxruntime.url $srcdir/onnxruntime
git config submodule.Source/Multiverso.url $srcdir/Multiverso
git config submodule.external/gsl.url $srcdir/gsl
git submodule update --init
cd $srcdir/$pkgname/Source/CNTKv2LibraryDll/proto/onnx/onnx_repo
git config submodule.third_party/benchmark.url $srcdir/benchmark
git config submodule.third_party/pybind11.url $srcdir/pybind11
git submodule update --init
cd $srcdir/$pkgname/Source/CNTKv2LibraryDll/proto/onnx/onnx_repo/third_party/pybind11
git config submodule.tools/clang.url $srcdir/clang-cindex-python3
git submodule update --init
cd $srcdir/$pkgname/Source/CNTKv2LibraryDll/proto/onnx/onnxruntime
for i in date gemmlowp googletest gsl nsync onnx onnx-tensorrt re2 tvm
do
git config submodule.cmake/external/$i.url $srcdir/$i
done
git config submodule.external/protobuf.url $srcdir/protobuf
git submodule update --init
cd $srcdir/$pkgname/Source/CNTKv2LibraryDll/proto/onnx/onnxruntime/cmake/external/onnx
git config submodule.third_party/benchmark.url $srcdir/benchmark
git config submodule.third_party/pybind11.url $srcdir/pybind11
git submodule update --init
cd $srcdir/$pkgname/Source/CNTKv2LibraryDll/proto/onnx/onnxruntime/cmake/external/onnx/third_party/pybind11
git config submodule.tools/clang.url $srcdir/clang-cindex-python3
git submodule update --init
cd $srcdir/$pkgname/Source/CNTKv2LibraryDll/proto/onnx/onnxruntime/cmake/external/onnx-tensorrt
git config submodule.third_party/onnx.url $srcdir/onnx
git submodule update --init
cd $srcdir/$pkgname/Source/CNTKv2LibraryDll/proto/onnx/onnxruntime/cmake/external/onnx-tensorrt/third_party/onnx
git config submodule.third_party/benchmark.url $srcdir/benchmark
git config submodule.third_party/pybind11.url $srcdir/pybind11
git submodule update --init
cd $srcdir/$pkgname/Source/CNTKv2LibraryDll/proto/onnx/onnxruntime/cmake/external/onnx-tensorrt/third_party/onnx/third_party/pybind11
git config submodule.tools/clang.url $srcdir/clang-cindex-python3
git submodule update --init
cd $srcdir/$pkgname/Source/CNTKv2LibraryDll/proto/onnx/onnxruntime/cmake/external/protobuf
git config submodule.third_party/benchmark.url $srcdir/benchmark
git config submodule.third_party/googletest.url $srcdir/googletest
git submodule update --init
cd $srcdir/$pkgname/Source/CNTKv2LibraryDll/proto/onnx/onnxruntime/cmake/external/tvm
git config submodule.HalideIR.url $srcdir/HalideIR
git config submodule.dlpack.url $srcdir/dlpack
git config submodule.dmlc-core.url $srcdir/dmlc-core
git submodule update --init
cd $srcdir/$pkgname/Source/Multiverso
git config submodule.include/multiverso/updater/dcasgd.url $srcdir/dcasgd
git submodule update --init
cd $srcdir/$pkgname
git submodule update --init --recursive
sed \
-e 's|cuda/include/cudnn.h|include/cudnn.h|' \
-e 's/36/37/g' \
-i configure
# https://github.com/Microsoft/CNTK/issues/62
sed 's|/var/lock/|/tmp/cntk/|g' -i `grep '/var/lock' . -rIl`
# https://github.com/Microsoft/CNTK/issues/3191
sed '120s/.*/return cub::ShuffleIndex<CUB_PTX_WARP_THREADS>(input, srcLane, mask);/' -i Source/Math/CntkBatchNormalization.cuh
# CUDA 10
#sed 's|device_functions.h|cuda_runtime_api.h|' -i Source/Math/GPUMatrixCUDAKernels.cuh
mkdir -p build
sed \
-e 's|$(CUDNN_PATH)/cuda|$(CUDNN_PATH)|g'\
-e 's/36/37/g'\
-i Makefile
sed \
-e 's|libmpi.so.12|libmpi.so|g' \
-i bindings/python/cntk/train/distributed.py
common_flags="--with-build-top=build --with-py37-path --with-swig"
cuda_flags="--with-cuda=/opt/cuda --with-cub=/usr/include --with-gdk-include=/opt/cuda/include --with-gdk-nvml-lib=/opt/cuda/lib64/stubs --with-cudnn=/usr --with-nccl=/usr"
cd $srcdir/$pkgname
export OMPI_MPICXX=g++-7
./configure $common_flags \
--with-openblas \
$cuda_flags
}
build() {
cd $srcdir/$pkgname/build
export OMPI_MPICXX=g++-7
make CXXFLAGS='-Wno-sign-compare -fPIC'
}
package() {
cd $srcdir/$pkgname/build
mkdir -p $pkgdir/usr
cp -r bin lib $pkgdir/usr
cd $srcdir/$pkgname/build/python
PIP_CONFIG_FILE=/dev/null pip install --isolated --root="$pkgdir" --ignore-installed --no-deps cntk*-$pkgver-cp37-cp37m-linux_x86_64.whl
rm -rf $pkgdir/usr/lib/python3.7/site-packages/$pkgname/libs
install -Dm644 $srcdir/$pkgname/LICENSE.md "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
|