Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

[v1.8.x] Backport PR #19272 to v1.8.x #19273

Merged
merged 3 commits into from
Oct 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
173 changes: 173 additions & 0 deletions make/staticbuild/linux_cu110.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
#-------------------------------------------------------------------------------
# Template configuration for compiling mxnet for making python wheel
#-------------------------------------------------------------------------------

#---------------------
# choice of compiler
#--------------------

export CC = gcc
export CXX = g++
export NVCC = nvcc

# whether compile with options for MXNet developer
DEV = 0

# whether compile with debug
DEBUG = 0

# whether to turn on signal handler (e.g. segfault logger)
USE_SIGNAL_HANDLER = 1

# the additional link flags you want to add
ADD_LDFLAGS += -L$(DEPS_PATH)/lib $(DEPS_PATH)/lib/libculibos.a -lpng -ltiff -ljpeg -lz -ldl -lgfortran -Wl,--version-script=$(CURDIR)/make/config/libmxnet.ver,-rpath,'$${ORIGIN}',--gc-sections

# the additional compile flags you want to add
ADD_CFLAGS += -I$(DEPS_PATH)/include -ffunction-sections -fdata-sections

#---------------------------------------------
# matrix computation libraries for CPU/GPU
#---------------------------------------------

# choose the version of blas you want to use
# can be: mkl, blas, atlas, openblas
# in default use atlas for linux while apple for osx
USE_BLAS=openblas

# whether use opencv during compilation
# you can disable it, however, you will not able to use
# imbin iterator
USE_OPENCV = 1
# Add OpenCV include path, in which the directory `opencv2` exists
USE_OPENCV_INC_PATH = NONE
# Add OpenCV shared library path, in which the shared library exists
USE_OPENCV_LIB_PATH = NONE

# whether use CUDA during compile
USE_CUDA = 1

# add the path to CUDA library to link and compile flag
# if you have already add them to environment variable, leave it as NONE
# USE_CUDA_PATH = /usr/local/cuda
USE_CUDA_PATH = $(DEPS_PATH)/usr/local/cuda-11.0

# whether to use CuDNN library
USE_CUDNN = 1

# whether to use NCCL library
USE_NCCL = 1

# CUDA architecture setting: going with all of them.
# For CUDA < 6.0, comment the *_50 lines for compatibility.
# CUDA_ARCH :=

# whether use cuda runtime compiling for writing kernels in native language (i.e. Python)
ENABLE_CUDA_RTC = 1

USE_NVTX=1

# use openmp for parallelization
USE_OPENMP = 1
USE_OPERATOR_TUNING = 1
USE_LIBJPEG_TURBO = 1

# whether use MKL-DNN library
USE_MKLDNN = 1

# whether use NNPACK library
USE_NNPACK = 0

# whether use lapack during compilation
# only effective when compiled with blas versions openblas/apple/atlas/mkl
USE_LAPACK = 1

# path to lapack library in case of a non-standard installation
USE_LAPACK_PATH = $(DEPS_PATH)/lib

# add path to intel library, you may need it for MKL, if you did not add the path
# to environment variable
USE_INTEL_PATH = NONE

# If use MKL, choose static link automatically to allow python wrapper
ifeq ($(USE_BLAS), mkl)
USE_STATIC_MKL = 1
else
USE_STATIC_MKL = NONE
endif

#----------------------------
# Settings for power and arm arch
#----------------------------
ARCH := $(shell uname -a)
ifneq (,$(filter $(ARCH), armv6l armv7l powerpc64le ppc64le aarch64))
USE_SSE=0
else
USE_SSE=1
endif

#----------------------------
# distributed computing
#----------------------------

# whether or not to enable multi-machine supporting
USE_DIST_KVSTORE = 1

# whether or not allow to read and write HDFS directly. If yes, then hadoop is
# required
USE_HDFS = 0

# path to libjvm.so. required if USE_HDFS=1
LIBJVM=$(JAVA_HOME)/jre/lib/amd64/server

# whether or not allow to read and write AWS S3 directly. If yes, then
# libcurl4-openssl-dev is required, it can be installed on Ubuntu by
# sudo apt-get install -y libcurl4-openssl-dev
USE_S3 = 1

#----------------------------
# additional operators
#----------------------------

# path to folders containing projects specific operators that you don't want to put in src/operators
EXTRA_OPERATORS =


#----------------------------
# plugins
#----------------------------

# whether to use caffe integration. This requires installing caffe.
# You also need to add CAFFE_PATH/build/lib to your LD_LIBRARY_PATH
# CAFFE_PATH = $(HOME)/caffe
# MXNET_PLUGINS += plugin/caffe/caffe.mk

# whether to use torch integration. This requires installing torch.
# You also need to add TORCH_PATH/install/lib to your LD_LIBRARY_PATH
# TORCH_PATH = $(HOME)/torch
# MXNET_PLUGINS += plugin/torch/torch.mk

# WARPCTC_PATH = $(HOME)/warp-ctc
# MXNET_PLUGINS += plugin/warpctc/warpctc.mk

# whether to use sframe integration. This requires build sframe
# [email protected]:dato-code/SFrame.git
# SFRAME_PATH = $(HOME)/SFrame
# MXNET_PLUGINS += plugin/sframe/plugin.mk

5 changes: 4 additions & 1 deletion tools/pip/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ def skip_markdown_comments(md):
if variant == 'CPU':
libraries.append('openblas')
else:
if variant.startswith('CU102'):
if variant.startswith('CU110'):
libraries.append('CUDA-11.0')
elif variant.startswith('CU102'):
libraries.append('CUDA-10.2')
elif variant.startswith('CU101'):
libraries.append('CUDA-10.1')
Expand Down Expand Up @@ -216,3 +218,4 @@ def skip_markdown_comments(md):
'Topic :: Software Development :: Libraries :: Python Modules',
],
url='https://github.com/apache/incubator-mxnet')

61 changes: 51 additions & 10 deletions tools/setup_gpu_build_tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,22 @@
# the following environment variables:
# PATH, CPLUS_INCLUDE_PATH, C_INCLUDE_PATH, LIBRARY_PATH, LD_LIBRARY_PATH, NVCC

set -e

VARIANT=$1
DEPS_PATH=$2

>&2 echo "Setting CUDA versions for $VARIANT"
if [[ $VARIANT == cu102* ]]; then
if [[ $VARIANT == cu110* ]]; then
CUDA_VERSION='11.0.221-1'
CUDA_PATCH_VERSION='11.2.0.252-1'
CUDA_LIBS_VERSION='10.2.1.245-1'
CUDA_SOLVER_VERSION='10.6.0.245-1'
CUDA_NVTX_VERSION='11.0.167-1'
LIBCUDA_VERSION='450.51.06-0ubuntu1'
LIBCUDNN_VERSION='8.0.3.33-1+cuda11.0'
LIBNCCL_VERSION='2.7.8-1+cuda11.0'
elif [[ $VARIANT == cu102* ]]; then
CUDA_VERSION='10.2.89-1'
CUDA_PATCH_VERSION='10.2.2.89-1'
LIBCUDA_VERSION='440.33.01-0ubuntu1'
Expand Down Expand Up @@ -86,7 +97,7 @@ if [[ $VARIANT == cu* ]]; then
os_name=$(cat /etc/*release | grep '^ID=' | sed 's/^.*=//g')
os_version=$(cat /etc/*release | grep VERSION_ID | sed 's/^.*"\([0-9]*\)\.\([0-9]*\)"/\1\2/g')
os_id="${os_name}${os_version}"
if [[ $CUDA_MAJOR_DASH == 9-* ]] || [[ $CUDA_MAJOR_DASH == 10-* ]]; then
if [[ $CUDA_MAJOR_DASH == 9-* ]] || [[ $CUDA_MAJOR_DASH == 10-* ]] || [[ $CUDA_MAJOR_DASH == 11-* ]]; then
os_id="ubuntu1604"
fi
export PATH=/usr/lib/binutils-2.26/bin/:${PATH}:$DEPS_PATH/usr/local/cuda-$CUDA_MAJOR_VERSION/bin
Expand All @@ -98,7 +109,31 @@ if [[ $VARIANT == cu* ]]; then
fi

# list of debs to download from nvidia
if [[ $VARIANT == cu102* ]]; then
if [[ $VARIANT == cu110* ]]; then
cuda_files=( \
"libcublas-${CUDA_MAJOR_DASH}_${CUDA_PATCH_VERSION}_amd64.deb" \
"libcublas-dev-${CUDA_MAJOR_DASH}_${CUDA_PATCH_VERSION}_amd64.deb" \
"cuda-cudart-${CUDA_MAJOR_DASH}_${CUDA_VERSION}_amd64.deb" \
"cuda-cudart-dev-${CUDA_MAJOR_DASH}_${CUDA_VERSION}_amd64.deb" \
"libcurand-${CUDA_MAJOR_DASH}_${CUDA_LIBS_VERSION}_amd64.deb" \
"libcurand-dev-${CUDA_MAJOR_DASH}_${CUDA_LIBS_VERSION}_amd64.deb" \
"libcufft-${CUDA_MAJOR_DASH}_${CUDA_LIBS_VERSION}_amd64.deb" \
"libcufft-dev-${CUDA_MAJOR_DASH}_${CUDA_LIBS_VERSION}_amd64.deb" \
"cuda-nvrtc-${CUDA_MAJOR_DASH}_${CUDA_VERSION}_amd64.deb" \
"cuda-nvrtc-dev-${CUDA_MAJOR_DASH}_${CUDA_VERSION}_amd64.deb" \
"libcusolver-${CUDA_MAJOR_DASH}_${CUDA_SOLVER_VERSION}_amd64.deb" \
"libcusolver-dev-${CUDA_MAJOR_DASH}_${CUDA_SOLVER_VERSION}_amd64.deb" \
"cuda-nvcc-${CUDA_MAJOR_DASH}_${CUDA_VERSION}_amd64.deb" \
"cuda-nvtx-${CUDA_MAJOR_DASH}_${CUDA_NVTX_VERSION}_amd64.deb" \
"libcuda1-${LIBCUDA_MAJOR}_${LIBCUDA_VERSION}_amd64.deb" \
"cuda-nvprof-${CUDA_MAJOR_DASH}_${CUDA_VERSION}_amd64.deb" \
"nvidia-${LIBCUDA_MAJOR}_${LIBCUDA_VERSION}_amd64.deb" \
)
ml_files=( \
"libcudnn${LIBCUDNN_MAJOR}-dev_${LIBCUDNN_VERSION}_amd64.deb" \
"libnccl-dev_${LIBNCCL_VERSION}_amd64.deb" \
)
elif [[ $VARIANT == cu102* ]]; then
cuda_files=( \
"cuda-core-${CUDA_MAJOR_DASH}_${CUDA_VERSION}_amd64.deb" \
"libcublas10_${CUDA_PATCH_VERSION}_amd64.deb" \
Expand Down Expand Up @@ -312,11 +347,17 @@ if [[ ! -d $DEPS_PATH/usr/local/cuda-${CUDA_MAJOR_VERSION} ]]; then
rm package.deb
done

mkdir -p ${prefix}/include
mkdir -p ${prefix}/lib
cp ${prefix}/usr/include/x86_64-linux-gnu/cudnn_v${LIBCUDNN_MAJOR}.h ${prefix}/include/cudnn.h
ln -s libcudnn_static_v${LIBCUDNN_MAJOR}.a ${prefix}/usr/lib/x86_64-linux-gnu/libcudnn.a
cp ${prefix}/usr/local/cuda-${CUDA_MAJOR_VERSION}/lib64/*.a ${prefix}/lib/
cp ${prefix}/usr/include/nccl.h ${prefix}/include/nccl.h
ln -s libnccl_static.a ${prefix}/usr/lib/x86_64-linux-gnu/libnccl.a
mkdir -p ${prefix}/include ${prefix}/lib ${prefix}/usr/lib/x86_64-linux-gnu
if [[ $LIBCUDNN_MAJOR == 8 ]]; then
for h in ${prefix}/usr/include/x86_64-linux-gnu/cudnn_*_v8.h; do
newfile=$(basename $h | sed 's/_v8//')
cp $h ${prefix}/include/$newfile
done
fi
cp -f ${prefix}/usr/include/x86_64-linux-gnu/cudnn_v${LIBCUDNN_MAJOR}.h ${prefix}/include/cudnn.h
ln -sf libcudnn_static_v${LIBCUDNN_MAJOR}.a ${prefix}/usr/lib/x86_64-linux-gnu/libcudnn.a
cp -f ${prefix}/usr/local/cuda-${CUDA_MAJOR_VERSION}/lib64/*.a ${prefix}/lib/
cp -f ${prefix}/usr/include/nccl.h ${prefix}/include/nccl.h
ln -sf libnccl_static.a ${prefix}/usr/lib/x86_64-linux-gnu/libnccl.a
fi