Skip to content

Commit 843c81c

Browse files
waytrue17Wei Chuleezu
authored andcommitted
[v1.7.x] update jetson dockerfile to support CUDA 10.0 (apache#18339)
* update dockerfile for jetson * add toolchain files * update build_jetson function * update ubuntu_julia.sh * update FindCUDAToolkit.cmake * Update centos7_python.sh * revert changes on ubuntu_julia.sh * disable TVM for gpu build * Disable TVM_OP on GPU builds Co-authored-by: Wei Chu <[email protected]> Co-authored-by: Leonard Lausen <[email protected]>
1 parent 9103f20 commit 843c81c

File tree

8 files changed

+288
-189
lines changed

8 files changed

+288
-189
lines changed

ci/docker/Dockerfile.build.jetson

Lines changed: 43 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -20,68 +20,58 @@
2020
# This script assumes /work/mxnet exists and contains the mxnet code you wish to compile and
2121
# that /work/build exists and is the target for your output.
2222

23-
FROM nvidia/cuda:9.0-cudnn7-devel as cudabuilder
23+
FROM nvidia/cuda:10.0-cudnn7-devel-ubuntu18.04
2424

25-
FROM dockcross/linux-arm64
25+
ENV ARCH=aarch64 \
26+
HOSTCC=gcc \
27+
TARGET=ARMV8
2628

27-
ENV ARCH aarch64
28-
ENV HOSTCC gcc
29-
ENV TARGET ARMV8
29+
WORKDIR /usr/local
3030

31-
# gh issue #11567 https://github.com/apache/incubator-mxnet/issues/11567
32-
#RUN sed -i '\#deb http://cdn-fastly.deb.debian.org/debian-security jessie/updates main#d' /etc/apt/sources.list
33-
#RUN sed -i 's/cdn-fastly.//' /etc/apt/sources.list
31+
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
32+
build-essential \
33+
ninja-build \
34+
git \
35+
curl \
36+
zip \
37+
unzip \
38+
python3 \
39+
python3-pip \
40+
awscli \
41+
crossbuild-essential-arm64 \
42+
&& rm -rf /var/lib/apt/lists/*
3443

44+
# cmake on Ubuntu 18.04 is too old
45+
RUN python3 -m pip install cmake
3546

36-
WORKDIR /work/deps
37-
38-
COPY install/ubuntu_arm.sh /work/
39-
RUN /work/ubuntu_arm.sh
40-
41-
COPY install/arm_openblas.sh /work/
42-
RUN /work/arm_openblas.sh
43-
44-
ENV OpenBLAS_HOME=${CROSS_ROOT}
45-
ENV OpenBLAS_DIR=${CROSS_ROOT}
46-
47+
# ccache on Ubuntu 18.04 is too old to support Cuda correctly
4748
COPY install/deb_ubuntu_ccache.sh /work/
4849
RUN /work/deb_ubuntu_ccache.sh
4950

50-
# Setup CUDA build env (including configuring and copying nvcc)
51-
COPY --from=cudabuilder /usr/local/cuda /usr/local/cuda
52-
ENV TARGET_ARCH aarch64
53-
ENV TARGET_OS linux
51+
COPY toolchains/aarch64-linux-gnu-toolchain.cmake /usr
52+
ENV CMAKE_TOOLCHAIN_FILE=/usr/aarch64-linux-gnu-toolchain.cmake
53+
54+
RUN git clone --recursive -b v0.3.9 https://github.com/xianyi/OpenBLAS.git && \
55+
cd /usr/local/OpenBLAS && \
56+
make NOFORTRAN=1 CC=aarch64-linux-gnu-gcc && \
57+
make PREFIX=/usr/aarch64-linux-gnu install && \
58+
cd /usr/local && \
59+
rm -rf OpenBLAS
5460

55-
# Install ARM depedencies based on Jetpack 3.3
56-
RUN JETPACK_DOWNLOAD_PREFIX=https://developer.download.nvidia.com/devzone/devcenter/mobile/jetpack_l4t/3.3/lw.xd42/JetPackL4T_33_b39 && \
57-
CUDA_REPO_PREFIX=/var/cuda-repo-9-0-local && \
58-
ARM_CUDA_INSTALLER_PACKAGE=cuda-repo-l4t-9-0-local_9.0.252-1_arm64.deb && \
59-
ARM_CUDNN_INSTALLER_PACKAGE=libcudnn7_7.1.5.14-1+cuda9.0_arm64.deb && \
60-
ARM_CUDNN_DEV_INSTALLER_PACKAGE=libcudnn7-dev_7.1.5.14-1+cuda9.0_arm64.deb && \
61-
ARM_LICENSE_INSTALLER=cuda-license-9-0_9.0.252-1_arm64.deb && \
62-
ARM_CUBLAS_INSTALLER=cuda-cublas-9-0_9.0.252-1_arm64.deb && \
63-
ARM_NVINFER_INSTALLER_PACKAGE=libnvinfer4_4.1.3-1+cuda9.0_arm64.deb && \
64-
ARM_NVINFER_DEV_INSTALLER_PACKAGE=libnvinfer-dev_4.1.3-1+cuda9.0_arm64.deb && \
65-
dpkg --add-architecture arm64 && \
66-
wget -nv $JETPACK_DOWNLOAD_PREFIX/$ARM_CUDA_INSTALLER_PACKAGE && \
67-
wget -nv $JETPACK_DOWNLOAD_PREFIX/$ARM_CUDNN_INSTALLER_PACKAGE && \
68-
wget -nv $JETPACK_DOWNLOAD_PREFIX/$ARM_CUDNN_DEV_INSTALLER_PACKAGE && \
69-
wget -nv $JETPACK_DOWNLOAD_PREFIX/$ARM_NVINFER_INSTALLER_PACKAGE && \
70-
wget -nv $JETPACK_DOWNLOAD_PREFIX/$ARM_NVINFER_DEV_INSTALLER_PACKAGE && \
71-
dpkg -i --force-architecture $ARM_CUDA_INSTALLER_PACKAGE && \
72-
apt-key add $CUDA_REPO_PREFIX/7fa2af80.pub && \
73-
dpkg -i --force-architecture $ARM_CUDNN_INSTALLER_PACKAGE && \
74-
dpkg -i --force-architecture $ARM_CUDNN_DEV_INSTALLER_PACKAGE && \
75-
dpkg -i --force-architecture $CUDA_REPO_PREFIX/$ARM_LICENSE_INSTALLER && \
76-
dpkg -i --force-architecture $CUDA_REPO_PREFIX/$ARM_CUBLAS_INSTALLER && \
77-
dpkg -i --force-architecture $ARM_NVINFER_INSTALLER_PACKAGE && \
78-
dpkg -i --force-architecture $ARM_NVINFER_DEV_INSTALLER_PACKAGE && \
79-
apt update -y || true && apt install -y cuda-libraries-dev-9-0 libcudnn7-dev libnvinfer-dev
80-
RUN ln -s /usr/include/aarch64-linux-gnu/cudnn_v7.h /usr/include/aarch64-linux-gnu/cudnn.h
81-
ENV PATH $PATH:/usr/local/cuda/bin
82-
ENV NVCCFLAGS "-m64"
83-
ENV CUDA_ARCH "-gencode arch=compute_53,code=sm_53 -gencode arch=compute_62,code=sm_62"
84-
ENV NVCC /usr/local/cuda/bin/nvcc
61+
# Install aarch64 cross depedencies based on Jetpack 4.3
62+
# Manually downloaded using SDK Manager tool and placed in a private S3 bucket.
63+
# We're not allowed to redistribute these files and there is no public version.
64+
RUN aws s3 cp s3://mxnet-ci-prod-private-slave-data/nvidia/sdkm_downloads/cuda-repo-ubuntu1804-10-0-local-10.0.326-410.108_1.0-1_amd64.deb . && \
65+
dpkg -i cuda-repo-ubuntu1804-10-0-local-10.0.326-410.108_1.0-1_amd64.deb && \
66+
rm cuda-repo-ubuntu1804-10-0-local-10.0.326-410.108_1.0-1_amd64.deb && \
67+
apt-key add /var/cuda-repo-10-0-local-10.0.326-410.108/7fa2af80.pub && \
68+
aws s3 cp s3://mxnet-ci-prod-private-slave-data/nvidia/sdkm_downloads/cuda-repo-cross-aarch64-10-0-local-10.0.326_1.0-1_all.deb . && \
69+
dpkg -i cuda-repo-cross-aarch64-10-0-local-10.0.326_1.0-1_all.deb && \
70+
rm cuda-repo-cross-aarch64-10-0-local-10.0.326_1.0-1_all.deb && \
71+
apt-get update && \
72+
apt-get install -y -f && \
73+
apt-get install -y cuda-cross-aarch64 cuda-cross-aarch64-10-0 && \
74+
rm -rf /var/lib/apt/lists/*
8575

8676
ARG USER_ID=0
8777
ARG GROUP_ID=0

ci/docker/install/centos7_python.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
set -ex
2424

2525
# Python 2.7 is installed by default, install 3.6 on top
26-
yum -y install https://repo.ius.io/ius-release-el7.rpm
26+
yum -y install https://repo.ius.io/ius-release-el7.rpm
2727
yum -y install python36u
2828

2929
# Install PIP

ci/docker/runtime_functions.sh

Lines changed: 26 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -249,15 +249,22 @@ build_dynamic_libmxnet() {
249249

250250
build_jetson() {
251251
set -ex
252-
pushd .
253-
254-
#build_ccache_wrappers
255-
256-
cp make/crosscompile.jetson.mk ./config.mk
257-
make -j$(nproc)
258-
259-
build_wheel /work/mxnet/python /work/mxnet/lib
260-
popd
252+
cd /work/build
253+
cmake \
254+
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} \
255+
-DUSE_CUDA=ON \
256+
-DMXNET_CUDA_ARCH="5.2" \
257+
-DENABLE_CUDA_RTC=OFF \
258+
-DSUPPORT_F16C=OFF \
259+
-DUSE_OPENCV=OFF \
260+
-DUSE_OPENMP=ON \
261+
-DUSE_LAPACK=OFF \
262+
-DUSE_SIGNAL_HANDLER=ON \
263+
-DCMAKE_BUILD_TYPE=Release \
264+
-DUSE_MKL_IF_AVAILABLE=OFF \
265+
-G Ninja /work/mxnet
266+
ninja
267+
build_wheel
261268
}
262269

263270
#
@@ -772,7 +779,7 @@ build_ubuntu_gpu_mkldnn() {
772779
USE_CUDA=1 \
773780
USE_CUDA_PATH=/usr/local/cuda \
774781
USE_CUDNN=1 \
775-
USE_TVM_OP=1 \
782+
USE_TVM_OP=0 \
776783
CUDA_ARCH="$CI_CUDA_COMPUTE_CAPABILITIES" \
777784
USE_SIGNAL_HANDLER=1 \
778785
-j$(nproc)
@@ -789,34 +796,13 @@ build_ubuntu_gpu_mkldnn_nocudnn() {
789796
USE_CUDA=1 \
790797
USE_CUDA_PATH=/usr/local/cuda \
791798
USE_CUDNN=0 \
792-
USE_TVM_OP=1 \
799+
USE_TVM_OP=0 \
793800
CUDA_ARCH="$CI_CUDA_COMPUTE_CAPABILITIES" \
794801
USE_SIGNAL_HANDLER=1 \
795802
-j$(nproc)
796803
}
797804

798805
build_ubuntu_gpu_cuda101_cudnn7() {
799-
set -ex
800-
build_ccache_wrappers
801-
make \
802-
DEV=1 \
803-
USE_BLAS=openblas \
804-
USE_MKLDNN=0 \
805-
USE_CUDA=1 \
806-
USE_CUDA_PATH=/usr/local/cuda \
807-
USE_CUDNN=1 \
808-
USE_TVM_OP=1 \
809-
USE_CPP_PACKAGE=1 \
810-
USE_DIST_KVSTORE=1 \
811-
CUDA_ARCH="$CI_CUDA_COMPUTE_CAPABILITIES" \
812-
USE_SIGNAL_HANDLER=1 \
813-
-j$(nproc)
814-
815-
make cython PYTHON=python2
816-
make cython PYTHON=python3
817-
}
818-
819-
build_ubuntu_gpu_cuda101_cudnn7_no_tvm_op() {
820806
set -ex
821807
build_ccache_wrappers
822808
make \
@@ -867,7 +853,7 @@ build_ubuntu_gpu_cmake_mkldnn() {
867853
-DUSE_SIGNAL_HANDLER=ON \
868854
-DUSE_CUDA=1 \
869855
-DUSE_CUDNN=1 \
870-
-DUSE_TVM_OP=1 \
856+
-DUSE_TVM_OP=0 \
871857
-DPython3_EXECUTABLE=/usr/bin/python3 \
872858
-DUSE_MKLML_MKL=1 \
873859
-DCMAKE_BUILD_TYPE=Release \
@@ -892,7 +878,7 @@ build_ubuntu_gpu_cmake() {
892878
-DUSE_SIGNAL_HANDLER=ON \
893879
-DUSE_CUDA=ON \
894880
-DUSE_CUDNN=ON \
895-
-DUSE_TVM_OP=ON \
881+
-DUSE_TVM_OP=OFF \
896882
-DPython3_EXECUTABLE=/usr/bin/python3 \
897883
-DUSE_MKL_IF_AVAILABLE=OFF \
898884
-DUSE_MKLML_MKL=OFF \
@@ -904,33 +890,31 @@ build_ubuntu_gpu_cmake() {
904890
-G Ninja \
905891
/work/mxnet
906892

907-
ninja -v
893+
ninja
908894
}
909895

910-
build_ubuntu_gpu_cmake_no_tvm_op() {
896+
build_ubuntu_gpu_cmake_no_rtc() {
911897
set -ex
912898
cd /work/build
913899
build_ccache_wrappers
914900
cmake \
915-
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
916-
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
917-
-DCMAKE_CUDA_COMPILER_LAUNCHER=ccache \
918901
-DUSE_SIGNAL_HANDLER=ON \
919902
-DUSE_CUDA=ON \
920903
-DUSE_CUDNN=ON \
921904
-DUSE_TVM_OP=OFF \
922905
-DPython3_EXECUTABLE=/usr/bin/python3 \
923906
-DUSE_MKL_IF_AVAILABLE=OFF \
924907
-DUSE_MKLML_MKL=OFF \
925-
-DUSE_MKLDNN=OFF \
908+
-DUSE_MKLDNN=ON \
926909
-DUSE_DIST_KVSTORE=ON \
927910
-DCMAKE_BUILD_TYPE=Release \
928911
-DMXNET_CUDA_ARCH="$CI_CMAKE_CUDA_ARCH" \
929912
-DBUILD_CYTHON_MODULES=1 \
913+
-DENABLE_CUDA_RTC=OFF \
930914
-G Ninja \
931915
/work/mxnet
932916

933-
ninja -v
917+
ninja
934918
}
935919

936920
build_ubuntu_cpu_large_tensor() {
@@ -964,7 +948,7 @@ build_ubuntu_gpu_large_tensor() {
964948
-DUSE_SIGNAL_HANDLER=ON \
965949
-DUSE_CUDA=ON \
966950
-DUSE_CUDNN=ON \
967-
-DUSE_TVM_OP=ON \
951+
-DUSE_TVM_OP=OFF \
968952
-DPython3_EXECUTABLE=/usr/bin/python3 \
969953
-DUSE_MKL_IF_AVAILABLE=OFF \
970954
-DUSE_MKLML_MKL=OFF \
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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+
set(CMAKE_SYSTEM_NAME Linux)
19+
set(CMAKE_SYSTEM_PROCESSOR "aarch64")
20+
set(CMAKE_C_COMPILER aarch64-linux-gnu-gcc)
21+
set(CMAKE_CXX_COMPILER aarch64-linux-gnu-g++)
22+
set(CMAKE_CUDA_HOST_COMPILER aarch64-linux-gnu-gcc)
23+
set(CMAKE_FIND_ROOT_PATH "/usr/aarch64-linux-gnu")
24+
25+
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
26+
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
27+
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
28+
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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+
set(CMAKE_SYSTEM_NAME Linux)
19+
set(CMAKE_SYSTEM_PROCESSOR "armv7l")
20+
set(CMAKE_C_COMPILER arm-linux-gnueabihf-gcc)
21+
set(CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++)
22+
set(CMAKE_FIND_ROOT_PATH "/usr/arm-linux-gnueabihf" "/usr/local/arm-linux-gnueabihf")
23+
24+
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
25+
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
26+
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
27+
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)

ci/jenkins/Jenkins_steps.groovy

Lines changed: 14 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -261,14 +261,14 @@ def compile_unix_full_gpu() {
261261
}]
262262
}
263263

264-
def compile_unix_full_gpu_no_tvm_op() {
265-
return ['GPU: CUDA10.1+cuDNN7 TVM_OP OFF': {
264+
def compile_unix_full_gpu_mkldnn_cpp_test() {
265+
return ['GPU: CUDA10.1+cuDNN7+MKLDNN+CPPTEST': {
266266
node(NODE_LINUX_CPU) {
267-
ws('workspace/build-gpu-no-tvm-op') {
267+
ws('workspace/build-gpu-mkldnn-cpp') {
268268
timeout(time: max_time, unit: 'MINUTES') {
269269
utils.init_git()
270-
utils.docker_run('ubuntu_build_cuda', 'build_ubuntu_gpu_cuda101_cudnn7_no_tvm_op', false)
271-
utils.pack_lib('gpu_no_tvm_op', mx_lib_cpp_examples_no_tvm_op)
270+
utils.docker_run('ubuntu_build_cuda', 'build_ubuntu_gpu_cuda101_cudnn7_mkldnn_cpp_test', false)
271+
utils.pack_lib('gpu_mkldnn_cpp_test', mx_lib_cpp_capi)
272272
}
273273
}
274274
}
@@ -303,16 +303,16 @@ def compile_unix_cmake_gpu() {
303303
}]
304304
}
305305

306-
def compile_unix_cmake_gpu_no_tvm_op() {
307-
return ['GPU: CMake TVM_OP OFF': {
308-
node(NODE_LINUX_CPU) {
309-
ws('workspace/build-cmake-gpu-no-tvm-op') {
310-
timeout(time: max_time, unit: 'MINUTES') {
311-
utils.init_git()
312-
utils.docker_run('ubuntu_gpu_cu101', 'build_ubuntu_gpu_cmake_no_tvm_op', false)
313-
}
306+
def compile_unix_cmake_gpu_no_rtc() {
307+
return ['GPU: CMake CUDA RTC OFF': {
308+
node(NODE_LINUX_CPU) {
309+
ws('workspace/build-cmake-gpu-no-rtc') {
310+
timeout(time: max_time, unit: 'MINUTES') {
311+
utils.init_git()
312+
utils.docker_run('ubuntu_gpu_cu101', 'build_ubuntu_gpu_cmake_no_rtc', false)
313+
}
314+
}
314315
}
315-
}
316316
}]
317317
}
318318

@@ -799,22 +799,6 @@ def test_unix_python3_gpu() {
799799
}]
800800
}
801801

802-
def test_unix_python3_gpu_no_tvm_op() {
803-
return ['Python3: GPU TVM_OP OFF': {
804-
node(NODE_LINUX_GPU) {
805-
ws('workspace/ut-python3-gpu-no-tvm-op') {
806-
try {
807-
utils.unpack_and_init('gpu_no_tvm_op', mx_lib_cpp_examples_no_tvm_op)
808-
python3_gpu_ut_cython('ubuntu_gpu_cu101')
809-
utils.publish_test_coverage()
810-
} finally {
811-
utils.collect_test_results_unix('nosetests_gpu.xml', 'nosetests_python3_gpu.xml')
812-
}
813-
}
814-
}
815-
}]
816-
}
817-
818802
def test_unix_python3_quantize_gpu() {
819803
return ['Python3: Quantize GPU': {
820804
node(NODE_LINUX_GPU_P3) {

0 commit comments

Comments
 (0)