Skip to content

Commit

Permalink
Migrate from private to public jetson toolchain files (apache#18677)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChaiBapchya committed Jul 17, 2020
1 parent 63e2b19 commit d6b6720
Showing 1 changed file with 44 additions and 34 deletions.
78 changes: 44 additions & 34 deletions ci/docker/Dockerfile.build.jetson
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,26 @@
# This script assumes /work/mxnet exists and contains the mxnet code you wish to compile and
# that /work/build exists and is the target for your output.

FROM nvidia/cuda:9.0-cudnn7-devel as cudabuilder
FROM nvidia/cuda:10.2-cudnn7-devel-ubuntu18.04

FROM dockcross/linux-arm64

ENV ARCH aarch64
ENV HOSTCC gcc
ENV TARGET ARMV8

# gh issue #11567 https://github.com/apache/incubator-mxnet/issues/11567
#RUN sed -i '\#deb http://cdn-fastly.deb.debian.org/debian-security jessie/updates main#d' /etc/apt/sources.list
#RUN sed -i 's/cdn-fastly.//' /etc/apt/sources.list
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
build-essential \
ninja-build \
git \
wget \
zip \
unzip \
python3 \
python3-pip \
awscli \
crossbuild-essential-arm64 \
&& rm -rf /var/lib/apt/lists/*


WORKDIR /work/deps
Expand All @@ -52,36 +61,37 @@ COPY --from=cudabuilder /usr/local/cuda /usr/local/cuda
ENV TARGET_ARCH aarch64
ENV TARGET_OS linux

# Install ARM depedencies based on Jetpack 3.3
RUN JETPACK_DOWNLOAD_PREFIX=https://developer.download.nvidia.com/devzone/devcenter/mobile/jetpack_l4t/3.3/lw.xd42/JetPackL4T_33_b39 && \
CUDA_REPO_PREFIX=/var/cuda-repo-9-0-local && \
ARM_CUDA_INSTALLER_PACKAGE=cuda-repo-l4t-9-0-local_9.0.252-1_arm64.deb && \
ARM_CUDNN_INSTALLER_PACKAGE=libcudnn7_7.1.5.14-1+cuda9.0_arm64.deb && \
ARM_CUDNN_DEV_INSTALLER_PACKAGE=libcudnn7-dev_7.1.5.14-1+cuda9.0_arm64.deb && \
ARM_LICENSE_INSTALLER=cuda-license-9-0_9.0.252-1_arm64.deb && \
ARM_CUBLAS_INSTALLER=cuda-cublas-9-0_9.0.252-1_arm64.deb && \
ARM_NVINFER_INSTALLER_PACKAGE=libnvinfer4_4.1.3-1+cuda9.0_arm64.deb && \
ARM_NVINFER_DEV_INSTALLER_PACKAGE=libnvinfer-dev_4.1.3-1+cuda9.0_arm64.deb && \
dpkg --add-architecture arm64 && \
wget -nv $JETPACK_DOWNLOAD_PREFIX/$ARM_CUDA_INSTALLER_PACKAGE && \
wget -nv $JETPACK_DOWNLOAD_PREFIX/$ARM_CUDNN_INSTALLER_PACKAGE && \
wget -nv $JETPACK_DOWNLOAD_PREFIX/$ARM_CUDNN_DEV_INSTALLER_PACKAGE && \
wget -nv $JETPACK_DOWNLOAD_PREFIX/$ARM_NVINFER_INSTALLER_PACKAGE && \
wget -nv $JETPACK_DOWNLOAD_PREFIX/$ARM_NVINFER_DEV_INSTALLER_PACKAGE && \
dpkg -i --force-architecture $ARM_CUDA_INSTALLER_PACKAGE && \
apt-key add $CUDA_REPO_PREFIX/7fa2af80.pub && \
dpkg -i --force-architecture $ARM_CUDNN_INSTALLER_PACKAGE && \
dpkg -i --force-architecture $ARM_CUDNN_DEV_INSTALLER_PACKAGE && \
dpkg -i --force-architecture $CUDA_REPO_PREFIX/$ARM_LICENSE_INSTALLER && \
dpkg -i --force-architecture $CUDA_REPO_PREFIX/$ARM_CUBLAS_INSTALLER && \
dpkg -i --force-architecture $ARM_NVINFER_INSTALLER_PACKAGE && \
dpkg -i --force-architecture $ARM_NVINFER_DEV_INSTALLER_PACKAGE && \
apt update -y || true && apt install -y cuda-libraries-dev-9-0 libcudnn7-dev libnvinfer-dev
RUN ln -s /usr/include/aarch64-linux-gnu/cudnn_v7.h /usr/include/aarch64-linux-gnu/cudnn.h
ENV PATH $PATH:/usr/local/cuda/bin
ENV NVCCFLAGS "-m64"
ENV CUDA_ARCH "-gencode arch=compute_53,code=sm_53 -gencode arch=compute_62,code=sm_62"
ENV NVCC /usr/local/cuda/bin/nvcc
# Install aarch64 cross depedencies based on Jetpack 4.4
# Dependencies require cuda-toolkit-10.2 which isn't installed in nvidia docker container
# It contains cuda-compat instead. However deb files currently depend on cuda-toolkit alone.
# Hence force dpkg configure
RUN wget https://repo.download.nvidia.com/jetson/x86_64/pool/r32.4/c/cuda/cuda-cross-aarch64-10-2_10.2.89-1_all.deb && \
wget https://repo.download.nvidia.com/jetson/x86_64/pool/r32.4/c/cuda/cuda-cross-aarch64_10.2.89-1_all.deb && \
wget https://repo.download.nvidia.com/jetson/x86_64/pool/r32.4/c/cuda/cuda-cudart-cross-aarch64-10-2_10.2.89-1_all.deb && \
wget https://repo.download.nvidia.com/jetson/x86_64/pool/r32.4/c/cuda/cuda-cufft-cross-aarch64-10-2_10.2.89-1_all.deb && \
wget https://repo.download.nvidia.com/jetson/x86_64/pool/r32.4/c/cuda/cuda-cupti-cross-aarch64-10-2_10.2.89-1_all.deb && \
wget https://repo.download.nvidia.com/jetson/x86_64/pool/r32.4/c/cuda/cuda-curand-cross-aarch64-10-2_10.2.89-1_all.deb && \
wget https://repo.download.nvidia.com/jetson/x86_64/pool/r32.4/c/cuda/cuda-cusolver-cross-aarch64-10-2_10.2.89-1_all.deb && \
wget https://repo.download.nvidia.com/jetson/x86_64/pool/r32.4/c/cuda/cuda-cusparse-cross-aarch64-10-2_10.2.89-1_all.deb && \
wget https://repo.download.nvidia.com/jetson/x86_64/pool/r32.4/c/cuda/cuda-driver-cross-aarch64-10-2_10.2.89-1_all.deb && \
wget https://repo.download.nvidia.com/jetson/x86_64/pool/r32.4/c/cuda/cuda-misc-headers-cross-aarch64-10-2_10.2.89-1_all.deb && \
wget https://repo.download.nvidia.com/jetson/x86_64/pool/r32.4/c/cuda/cuda-npp-cross-aarch64-10-2_10.2.89-1_all.deb && \
wget https://repo.download.nvidia.com/jetson/x86_64/pool/r32.4/c/cuda/cuda-nsight-compute-addon-l4t-10-2_10.2.89-1_all.deb && \
wget https://repo.download.nvidia.com/jetson/x86_64/pool/r32.4/c/cuda/cuda-nvgraph-cross-aarch64-10-2_10.2.89-1_all.deb && \
wget https://repo.download.nvidia.com/jetson/x86_64/pool/r32.4/c/cuda/cuda-nvml-cross-aarch64-10-2_10.2.89-1_all.deb && \
wget https://repo.download.nvidia.com/jetson/x86_64/pool/r32.4/c/cuda/cuda-nvrtc-cross-aarch64-10-2_10.2.89-1_all.deb && \
wget https://repo.download.nvidia.com/jetson/x86_64/pool/r32.4/c/cublas/libcublas-cross-aarch64_10.2.2.89-1_all.deb && \
wget https://repo.download.nvidia.com/jetson/x86_64/pool/r32.4/n/nsight-compute/nsight-compute-addon-l4t-2019.5.0_2019.5.0.14-1_all.deb && \
dpkg -i --force-all *.deb && \
rm *.deb && \
apt-get update && \
apt-get install -y -f && \
apt-get install -y cuda-cross-aarch64 cuda-cross-aarch64-10-2 && \
rm -rf /var/lib/apt/lists/*

# nvidia jetpack 4.4 installs libcublas.so at /usr/lib/aarch64-linux-gnu
# while previously it used to store it at /usr/local/cuda/targets/aarch64-linux/lib/stubs
RUN ln -s /usr/lib/aarch64-linux-gnu/libcublas.so /usr/local/cuda/targets/aarch64-linux/lib/stubs/libcublas.so

ARG USER_ID=0
ARG GROUP_ID=0
Expand Down

0 comments on commit d6b6720

Please sign in to comment.