• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

patch/H04-Nov-2021-244

LICENSE.binary.dependenciesH A D04-Nov-202114 KiB290216

README.mdH A D04-Nov-202110.4 KiB341277

cityhash.shH A D04-Nov-20211.3 KiB3513

curl.shH A D04-Nov-20212.4 KiB6947

eigen.shH A D04-Nov-20211.4 KiB4018

libpng.shH A D04-Nov-20211.6 KiB4523

libtiff.shH A D04-Nov-20211.4 KiB3715

libturbojpeg.shH A D04-Nov-20211.9 KiB5228

libz.shH A D04-Nov-20211.4 KiB4119

lz4.shH A D04-Nov-20211.3 KiB3614

make_shared_dependencies.shH A D04-Nov-20212.1 KiB7343

openblas.shH A D04-Nov-20212.2 KiB6029

opencv.shH A D04-Nov-20217.1 KiB197172

openssl.shH A D04-Nov-20211.6 KiB4321

protobuf.shH A D04-Nov-20211.5 KiB4723

zmq.shH A D04-Nov-20211.8 KiB5632

README.md

1<!--- Licensed to the Apache Software Foundation (ASF) under one -->
2<!--- or more contributor license agreements.  See the NOTICE file -->
3<!--- distributed with this work for additional information -->
4<!--- regarding copyright ownership.  The ASF licenses this file -->
5<!--- to you under the Apache License, Version 2.0 (the -->
6<!--- "License"); you may not use this file except in compliance -->
7<!--- with the License.  You may obtain a copy of the License at -->
8
9<!---   http://www.apache.org/licenses/LICENSE-2.0 -->
10
11<!--- Unless required by applicable law or agreed to in writing, -->
12<!--- software distributed under the License is distributed on an -->
13<!--- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -->
14<!--- KIND, either express or implied.  See the License for the -->
15<!--- specific language governing permissions and limitations -->
16<!--- under the License. -->
17
18# Overview
19
20This folder contains scripts for building the dependencies from source. The static libraries from
21the build artifacts can be used to create self-contained shared object for mxnet through static
22linking.
23
24# Settings
25
26The scripts use the following environment variables for setting behavior:
27
28`DEPS_PATH`: the location in which the libraries are downloaded, built, and installed.
29`PLATFORM`: name of the OS in lower case. Supported options are 'linux' and 'darwin'.
30
31It also expects the following build tools in path: make, cmake, tar, unzip, autoconf, nasm
32
33# FAQ
34
35## Build failure regarding to gcc, g++, gfortran
36Currently, we only support gcc-4.8 build. It's your own choice to use a higher version of gcc. Please make sure your gcc, g++ and gfortran always have the same version in order to eliminate build failure.
37
38## idn2 not found
39This issue appeared in the OSX build with XCode version 8.0 above (reproduced on 9.2). Please add the following build flag in `curl.sh` if your XCode version is more than 8.0:
40```
41--without-libidn2
42```
43
44***
45
46# Dependency Update Runbook
47
48MXNet is built on top of many dependencies. Managing these dependencies could be a big headache. This goal of this document is to give a overview of those dependencies and how to upgrade when new version of those are rolled out.
49
50## Overview
51
52The dependencies could be categorized by several groups: BLAS libraries, CPU-based performance boost library, i.e. MKLDNN and GPU-based performance boosting library including CUDA, cuDNN, NCCL. and others including OpenCV, Numpy, S3-related, PS-lite dependencies. The list below shows all the dependencies and their version. Except for CUDA, cuDNN, NCCL which the user is required to install on their environments, we statically link those dependencies into libmxnet.so when we build PyPi package. By doing this, the user can take advantage of these dependencies without being worry about it.
53
54| Dependencies  | MXNet Version |
55| :------------: |:-------------:|
56|OpenBLAS| 0.3.3 |
57|MKLDNN| 0.19 |
58|CUDA| 10.1 |
59|cuDNN| 7.5.1 |
60|NCCL| 2.4.2 |
61|numpy| >1.16.0,<2.0.0 |
62|request| >=2.20.0,< 3.0.0 |
63|graphviz| <0.9.0,>=0.8.1 |
64|OpenCV| 3.4.2 |
65|zlib| 1.2.6 |
66|libjpeg-turbo| 2.0.2 |
67|libpng| 1.6.35 |
68|libtiff| 4-0-10 |
69|eigen| 3.3.4 |
70|libcurl| 7.61.0 |
71|libssl-dev| 1.1.1b |
72|zmq| 4.2.2 |
73|protobuf| 3.5.1 |
74|lz4| r130 |
75|cityhash| 1.1.1 |
76
77## How to update them?
78
79#### 0. Prerequisite Software
80```
81sudo apt update
82sudo apt-get install -y git \
83    cmake \
84    libcurl4-openssl-dev \
85    unzip \
86    gcc-4.8 \
87    g++-4.8 \
88    gfortran \
89    gfortran-4.8 \
90    binutils \
91    nasm \
92    libtool \
93    curl \
94    wget \
95    sudo \
96    gnupg \
97    gnupg2 \
98    gnupg-agent \
99    pandoc \
100    python3-pip \
101    automake \
102    pkg-config
103```
104
105### MKL, MKLDNN
106
107@pengzhao-intel (https://github.com/apache/incubator-mxnet/commits?author=pengzhao-intel) and his team are tracking and updating these versions. Kudos to them!
108
109### CUDA, cuDNN, NCCL
110
111#### 1. Environment Setup
112We will install all the prerequsite software.
113We demonstrate with CUDA10/cuDNN7.5/NCCL 2.4.2.
114You might want to change these versions to suit your needs.
115
116```
117# CUDA installation
118# Take CUDA 10 for example, please follow the instructions on https://developer.nvidia.com/cuda-downloads
119# Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 410.48?
120# (y)es/(n)o/(q)uit: y
121#
122# Do you want to install the OpenGL libraries?
123# (y)es/(n)o/(q)uit [ default is yes ]:
124#
125# Do you want to run nvidia-xconfig?
126# This will update the system X configuration file so that the NVIDIA X driver
127# is used. The pre-existing X configuration file will be backed up.
128# This option should not be used on systems that require a custom
129# X configuration, such as systems with multiple GPU vendors.
130# (y)es/(n)o/(q)uit [ default is no ]:
131#
132# Install the CUDA 10.0 Toolkit?
133# (y)es/(n)o/(q)uit: y
134#
135# Enter Toolkit Location
136# [ default is /usr/local/cuda-10.0 ]:
137#
138# Do you want to install a symbolic link at /usr/local/cuda?
139# (y)es/(n)o/(q)uit: y
140#
141# Install the CUDA 10.0 Samples?
142# (y)es/(n)o/(q)uit: n
143
144# Set LD_LIBRARY_PATH
145export LD_LIBRARY_PATH=/usr/local/cuda/lib64:${LD_LIBRARY_PATH}
146
147# Check installation
148nvidia-smi
149
150# cuDNN Setup
151# Take cuDNN 7.5.0 with CUDA 10 for example
152# https://developer.nvidia.com/rdp/cudnn-download
153# Register with NVIDIA and download cudnn-10.0-linux-x64-v7.5.0.56.tgz
154# scp it to your instance
155# https://docs.nvidia.com/deeplearning/sdk/cudnn-install/index.html
156tar -xvzf cudnn-10.0-linux-x64-v7.5.0.56.tgz
157sudo cp cuda/include/cudnn.h /usr/local/cuda/include
158sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64
159sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*
160# Check cuDNN version
161cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2
162# #define CUDNN_MAJOR 7
163# #define CUDNN_MINOR 5
164# #define CUDNN_PATCHLEVEL 0
165# --
166# #define CUDNN_VERSION (CUDNN_MAJOR * 1000 + CUDNN_MINOR * 100 + CUDNN_PATCHLEVEL)
167#
168# #include "driver_types.h"
169
170# install NCCL
171# take NCCL 2.4.2 for example
172# https://developer.nvidia.com/nccl/nccl2-download-survey
173# Register with NVIDIA and download nccl-repo-ubuntu1604-2.4.2-ga-cuda10.0_1-1_amd64.deb
174sudo dpkg -i nccl-repo-ubuntu1604-2.4.2-ga-cuda10.0_1-1_amd64.deb
175sudo apt-key add /var/nccl-repo-2.4.2-ga-cuda10.0/7fa2af80.pub
176sudo apt update
177sudo apt install libnccl2 libnccl-dev
178# we will check the NCCL version later
179```
180#### 2. Build
181We will build MXNet with statically linked dependencies.
182```
183# Clone MXNet repo
184git clone --recursive https://github.com/apache/incubator-mxnet.git
185cd incubator-mxnet
186# Make sure you pin to specific commit for all the performance sanity check to make fair comparison
187# Make corresponding change on tools/setup_gpu_build_tools.sh
188# to upgrade CUDA version, please refer to PR #14887.
189# Make sure you add new makefile and right debs CUDA uses on the website
190# http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/
191
192# Build PyPi package
193tools/staticbuild/build.sh cu100mkl
194
195# Wait for 10 - 30 mins, you will find libmxnet.so under the incubator-mxnet/lib
196
197# Install python frontend
198pip install -e python
199# Test MXNet
200>>> import mxnet as mx
201>>> mx.runtime.feature_list()
202
203# Test NCCL version
204export NCCL_DEBUG=VERSION
205vim tests/python/gpu/test_nccl.py
206# Remove @unittest.skip("Test requires NCCL library installed and enabled during build") then run
207nosetests --verbose tests/python/gpu/test_nccl.py
208# test_nccl.test_nccl_pushpull ... NCCL version 2.4.2+cuda10.0
209# ok
210# ----------------------------------------------------------------------
211# Ran 1 test in 67.666s
212
213OK
214```
215#### 3. Performance Sanity Check
216Please run performance test aginast the MXNet you build before raising the PR.
217
218#### 4. Raise a PR
2191. Update the tools/setup_gpu_build_tools.sh please refer to PR [#14988](https://github.com/apache/incubator-mxnet/pull/14988), [#14887](https://github.com/apache/incubator-mxnet/pull/14887/files)
2202. (optional) Update the CI-related configuration/shell script/Dockerfile. Please refer to PR [#14986](https://github.com/apache/incubator-mxnet/pull/14986/files), [#14950](https://github.com/apache/incubator-mxnet/pull/14950/files)
221
222#### 5. CI Test
2231. Our CI would test PyPi and Scala publish of latest CUDA version i.e. mxnet-cu101mkl
224
225### numpy, requests, graphviz (python dependencies)
2261. Please refer to [#14588](https://github.com/apache/incubator-mxnet/pull/14588/files) and make sure the version have both of upper bound and lower bound
227#### Checklist
228- [ ] Python/setup.py
229- [ ] tools/pip/setup.py
230- [ ] ci/docker/install/requirements
231- [ ] ci/docker/install/ubuntu_publish.sh
232- [ ] ci/docker/install/ubuntu_python.sh
233- [ ] ci/qemu/mxnet_requirements.txt
234- [ ] docs/install/requirements.txt
235
2362. Build from source to do sanity check
237```
238# Compile mxnet to get libmxnet.so
239pip install -e python
240python
241>>> import mxnet as mx
242>>> mx.nd.ones((1, 2))
243[[1. 1.]]
244<NDArray 1x2 @cpu(0)>
245```
246
247### OpenCV and its dependencies: zlib, libjpeg-turbo, libpng, libtiff, eigen
248
249#### Update the build script
2501. Find the library under `tools/dependencies` and update the version.
251
252#### Sanity Check
2531. Environment Setup
254```python
255# Take Ubuntu 16.04 for example
256sudo apt update
257sudo apt-get install -y git \
258    cmake \
259    libcurl4-openssl-dev \
260    unzip \
261    gcc-4.8 \
262    g++-4.8 \
263    gfortran \
264    gfortran-4.8 \
265    binutils \
266    nasm \
267    libtool \
268    curl \
269    wget \
270    sudo \
271    gnupg \
272    gnupg2 \
273    gnupg-agent \
274    pandoc \
275    python3-pip \
276    automake \
277    pkg-config
278```
2792. Build PyPi package
280```
281# Update the dependency under tools/dependencies, then
282tools/staticbuild/build.sh mkl
283
284# Wait for 10 - 30 mins, you will find libmxnet.so under the incubator-mxnet/lib
285
286# Install python frontend
287pip install -e python
288# Test MXNet
289>>> import mxnet as mx
290>>> mx.runtime.feature_list()
291```
292
2933. Run performance tests against image related tasks
294
295
296### Other dependencies under tools/dependencies
297
298#### Update the build script
2991. Find the library under `tools/dependencies` and update the version.
300
301#### Sanity Check
3021. Environment Setup
303```python
304# Take Ubuntu 16.04 for example
305sudo apt update
306sudo apt-get install -y git \
307    cmake \
308    libcurl4-openssl-dev \
309    unzip \
310    gcc-4.8 \
311    g++-4.8 \
312    gfortran \
313    gfortran-4.8 \
314    binutils \
315    nasm \
316    libtool \
317    curl \
318    wget \
319    sudo \
320    gnupg \
321    gnupg2 \
322    gnupg-agent \
323    pandoc \
324    python3-pip \
325    automake \
326    pkg-config
327```
3282. Build PyPi package
329```
330# Update the dependency under tools/dependencies, then
331tools/staticbuild/build.sh mkl
332
333# Wait for 10 - 30 mins, you will find libmxnet.so under the incubator-mxnet/lib
334
335# Install python frontend
336pip install -e python
337# Test MXNet
338>>> import mxnet as mx
339>>> mx.runtime.feature_list()
340```
341