From e85ee93d77d427131b40a6bc9d4efcba01b8161b Mon Sep 17 00:00:00 2001 From: Anton Chernov Date: Thu, 24 May 2018 17:29:24 +0200 Subject: [PATCH 01/10] Fixed armv7 wheel --- ci/docker/Dockerfile.build.armv7 | 23 +++++--- ci/docker/runtime_functions.sh | 90 +++++++++++++++++++++----------- 2 files changed, 74 insertions(+), 39 deletions(-) diff --git a/ci/docker/Dockerfile.build.armv7 b/ci/docker/Dockerfile.build.armv7 index 627486c0537d..c5801f0e7e8c 100755 --- a/ci/docker/Dockerfile.build.armv7 +++ b/ci/docker/Dockerfile.build.armv7 @@ -16,7 +16,7 @@ # specific language governing permissions and limitations # under the License. # -# Dockerfile to build MXNet for Android ARMv7 +# Dockerfile to build MXNet for ARMv7 (Android & RPi) FROM ubuntu:16.04 as ccachebuilder @@ -30,13 +30,20 @@ FROM dockcross/linux-armv7 # extract ccache binary into latest context COPY --from=ccachebuilder /usr/local/bin/ccache /usr/local/bin/ccache -ENV ARCH armv71 -ENV CC /usr/bin/arm-linux-gnueabihf-gcc -ENV CXX /usr/bin/arm-linux-gnueabihf-g++ +ENV ARCH armv7l +ENV HOSTCC gcc +ENV TARGET ARMV7 -RUN apt-get update && \ - apt-get install -y libopenblas-dev:armhf && \ - rm -rf /var/lib/apt/lists/* +WORKDIR /work/deps + +# Build OpenBLAS +RUN git clone --recursive -b v0.2.20 https://github.com/xianyi/OpenBLAS.git && \ + cd OpenBLAS && \ + make -j$(nproc) && \ + make PREFIX=$CROSS_ROOT install + +ENV OpenBLAS_HOME=${CROSS_ROOT} +ENV OpenBLAS_DIR=${CROSS_ROOT} COPY runtime_functions.sh /work/ -WORKDIR /work/build +WORKDIR /work/mxnet diff --git a/ci/docker/runtime_functions.sh b/ci/docker/runtime_functions.sh index 36e238797059..f8dfa783e6eb 100755 --- a/ci/docker/runtime_functions.sh +++ b/ci/docker/runtime_functions.sh @@ -63,6 +63,38 @@ build_ccache_wrappers() { export CXX=`pwd`/cxx } +build_wheel() { + + set -ex + pushd . + + PYTHON_DIR = ${1:/work/mxnet/python} + BUILD_DIR = ${2:/work/build} + + # build + + export MXNET_LIBRARY_PATH=${BUILD_DIR}/libmxnet.so + + cd ${PYTHON_DIR} + python setup.py bdist_wheel --universal + + # repackage + + # Fix pathing issues in the wheel. We need to move libmxnet.so from the data folder to the + # mxnet folder, then repackage the wheel. + WHEEL = `readlink -f dist/*.whl` + TMPDIR = `mktemp -d` + unzip -d ${TMPDIR} ${WHEEL} + rm ${WHEEL} + cd ${TMPDIR} + mv *.data/data/mxnet/libmxnet.so mxnet + zip -r ${WHEEL} . + cp ${WHEEL} ${BUILD_DIR} + rm -rf ${TMPDIR} + + popd +} + # Build commands: Every platform in docker/Dockerfile.build. should have a corresponding # function here with the same suffix: @@ -73,24 +105,10 @@ build_jetson() { build_ccache_wrappers cp -f make/crosscompile.jetson.mk ./config.mk - make -j$(nproc) - export MXNET_LIBRARY_PATH=`pwd`/libmxnet.so - cd /work/mxnet/python - python setup.py bdist_wheel --universal + build_wheel - # Fix pathing issues in the wheel. We need to move libmxnet.so from the data folder to the - # mxnet folder, then repackage the wheel. - WHEEL=`readlink -f dist/*.whl` - TMPDIR=`mktemp -d` - unzip -d $TMPDIR $WHEEL - rm $WHEEL - cd $TMPDIR - mv *.data/data/mxnet/libmxnet.so mxnet - zip -r $WHEEL . - cp $WHEEL /work/build - rm -rf $TMPDIR popd } @@ -107,7 +125,7 @@ build_armv6() { # We do not need OpenMP, since most armv6 systems have only 1 core cmake \ - -DCMAKE_TOOLCHAIN_FILE=$CROSS_ROOT/Toolchain.cmake \ + -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} \ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ -DCMAKE_C_COMPILER_LAUNCHER=ccache \ -DUSE_CUDA=OFF \ @@ -120,33 +138,43 @@ build_armv6() { -DBUILD_CPP_EXAMPLES=OFF \ -Dmxnet_LINKER_LIBS=-lgfortran \ -G Ninja /work/mxnet + ninja - export MXNET_LIBRARY_PATH=`pwd`/libmxnet.so - cd /work/mxnet/python - python setup.py bdist_wheel --universal - cp dist/*.whl /work/build + build_wheel + popd } build_armv7() { set -ex pushd . + cd /work/build + + # Lapack functionality will be included and statically linked to openblas. + # But USE_LAPACK needs to be set to OFF, otherwise the main CMakeLists.txt + # file tries to add -llapack. Lapack functionality though, requires -lgfortran + # to be linked additionally. + cmake \ + -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} \ + -DCMAKE_CROSSCOMPILING=ON \ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ - -DCMAKE_C_COMPILER_LAUNCHER=ccache \ - -DUSE_CUDA=OFF\ - -DUSE_OPENCV=OFF\ - -DUSE_OPENMP=OFF\ - -DUSE_SIGNAL_HANDLER=ON\ - -DCMAKE_BUILD_TYPE=RelWithDebInfo\ - -DUSE_MKL_IF_AVAILABLE=OFF\ + -DCMAKE_C_COMPILER_LAUNCHER=ccache \ + -DUSE_CUDA=OFF \ + -DUSE_OPENCV=OFF \ + -DUSE_OPENMP=ON \ + -DUSE_SIGNAL_HANDLER=ON \ + -DCMAKE_BUILD_TYPE=Release \ + -DUSE_MKL_IF_AVAILABLE=OFF \ + -DUSE_LAPACK=OFF \ + -DBUILD_CPP_EXAMPLES=OFF \ + -Dmxnet_LINKER_LIBS=-lgfortran \ -G Ninja /work/mxnet + ninja - export MXNET_LIBRARY_PATH=`pwd`/libmxnet.so - cd /work/mxnet/python - python setup.py bdist_wheel --universal - cp dist/*.whl /work/build + build_wheel + popd } From a6f2e8b25ef0874354e4af98b5963b2172438d30 Mon Sep 17 00:00:00 2001 From: Anton Chernov Date: Fri, 25 May 2018 14:11:39 +0200 Subject: [PATCH 02/10] Fixed bash default value substitution --- ci/docker/runtime_functions.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/docker/runtime_functions.sh b/ci/docker/runtime_functions.sh index f8dfa783e6eb..7eae1288200b 100755 --- a/ci/docker/runtime_functions.sh +++ b/ci/docker/runtime_functions.sh @@ -68,8 +68,8 @@ build_wheel() { set -ex pushd . - PYTHON_DIR = ${1:/work/mxnet/python} - BUILD_DIR = ${2:/work/build} + PYTHON_DIR = ${1:-/work/mxnet/python} + BUILD_DIR = ${2:-/work/build} # build From a92e45d2c54d18d853ff3508da419d1e0cdf2575 Mon Sep 17 00:00:00 2001 From: Anton Chernov Date: Fri, 25 May 2018 17:45:03 +0200 Subject: [PATCH 03/10] Fixed whitespace errors --- ci/docker/runtime_functions.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ci/docker/runtime_functions.sh b/ci/docker/runtime_functions.sh index 7eae1288200b..66cd23ecdb4d 100755 --- a/ci/docker/runtime_functions.sh +++ b/ci/docker/runtime_functions.sh @@ -68,8 +68,8 @@ build_wheel() { set -ex pushd . - PYTHON_DIR = ${1:-/work/mxnet/python} - BUILD_DIR = ${2:-/work/build} + PYTHON_DIR=${1:-/work/mxnet/python} + BUILD_DIR=${2:-/work/build} # build @@ -82,8 +82,8 @@ build_wheel() { # Fix pathing issues in the wheel. We need to move libmxnet.so from the data folder to the # mxnet folder, then repackage the wheel. - WHEEL = `readlink -f dist/*.whl` - TMPDIR = `mktemp -d` + WHEEL=`readlink -f dist/*.whl` + TMPDIR=`mktemp -d` unzip -d ${TMPDIR} ${WHEEL} rm ${WHEEL} cd ${TMPDIR} From dce641abd951263b33105e2080ca0b5a9728869c Mon Sep 17 00:00:00 2001 From: Anton Chernov Date: Fri, 25 May 2018 17:12:32 +0000 Subject: [PATCH 04/10] Added unzip installation to crosscompile docker images --- ci/docker/Dockerfile.build.arm64 | 4 ++++ ci/docker/Dockerfile.build.armv6 | 4 ++++ ci/docker/Dockerfile.build.armv7 | 5 +++++ ci/docker/Dockerfile.build.jetson | 4 ++++ 4 files changed, 17 insertions(+) diff --git a/ci/docker/Dockerfile.build.arm64 b/ci/docker/Dockerfile.build.arm64 index a1f752bbf64a..5a6d3eab6bcd 100755 --- a/ci/docker/Dockerfile.build.arm64 +++ b/ci/docker/Dockerfile.build.arm64 @@ -37,6 +37,10 @@ ENV FC /usr/bin/${CROSS_TRIPLE}-gfortran ENV HOSTCC gcc ENV TARGET ARMV8 +RUN apt-get update && \ + apt-get install -y unzip && \ + rm -rf /var/lib/apt/lists/* + WORKDIR /work # Build OpenBLAS diff --git a/ci/docker/Dockerfile.build.armv6 b/ci/docker/Dockerfile.build.armv6 index c073992406fb..b77f501cc81b 100755 --- a/ci/docker/Dockerfile.build.armv6 +++ b/ci/docker/Dockerfile.build.armv6 @@ -34,6 +34,10 @@ ENV ARCH armv6l ENV HOSTCC gcc ENV TARGET ARMV6 +RUN apt-get update && \ + apt-get install -y unzip && \ + rm -rf /var/lib/apt/lists/* + WORKDIR /work/deps # Build OpenBLAS diff --git a/ci/docker/Dockerfile.build.armv7 b/ci/docker/Dockerfile.build.armv7 index c5801f0e7e8c..0f33dac77644 100755 --- a/ci/docker/Dockerfile.build.armv7 +++ b/ci/docker/Dockerfile.build.armv7 @@ -33,6 +33,11 @@ COPY --from=ccachebuilder /usr/local/bin/ccache /usr/local/bin/ccache ENV ARCH armv7l ENV HOSTCC gcc ENV TARGET ARMV7 +ENV FC /usr/bin/${CROSS_TRIPLE}-gfortran + +RUN apt-get update && \ + apt-get install -y unzip && \ + rm -rf /var/lib/apt/lists/* WORKDIR /work/deps diff --git a/ci/docker/Dockerfile.build.jetson b/ci/docker/Dockerfile.build.jetson index 8a8bb97aa156..7166cccfc790 100755 --- a/ci/docker/Dockerfile.build.jetson +++ b/ci/docker/Dockerfile.build.jetson @@ -41,6 +41,10 @@ ENV FC /usr/bin/${CROSS_TRIPLE}-gfortran ENV HOSTCC gcc ENV TARGET ARMV8 +RUN apt-get update && \ + apt-get install -y unzip && \ + rm -rf /var/lib/apt/lists/* + WORKDIR /work # Build OpenBLAS From 6aa6840a48c4b9d58c911c8d3bfa4decd721fecf Mon Sep 17 00:00:00 2001 From: Anton Chernov Date: Tue, 29 May 2018 09:31:54 +0200 Subject: [PATCH 05/10] Removed deprecated apt lists removal --- ci/docker/Dockerfile.build.arm64 | 4 +--- ci/docker/Dockerfile.build.armv6 | 4 +--- ci/docker/Dockerfile.build.armv7 | 4 +--- ci/docker/Dockerfile.build.jetson | 4 +--- 4 files changed, 4 insertions(+), 12 deletions(-) diff --git a/ci/docker/Dockerfile.build.arm64 b/ci/docker/Dockerfile.build.arm64 index 5a6d3eab6bcd..46edd80698a4 100755 --- a/ci/docker/Dockerfile.build.arm64 +++ b/ci/docker/Dockerfile.build.arm64 @@ -37,9 +37,7 @@ ENV FC /usr/bin/${CROSS_TRIPLE}-gfortran ENV HOSTCC gcc ENV TARGET ARMV8 -RUN apt-get update && \ - apt-get install -y unzip && \ - rm -rf /var/lib/apt/lists/* +RUN apt update && apt install -y unzip WORKDIR /work diff --git a/ci/docker/Dockerfile.build.armv6 b/ci/docker/Dockerfile.build.armv6 index b77f501cc81b..6d1406de0238 100755 --- a/ci/docker/Dockerfile.build.armv6 +++ b/ci/docker/Dockerfile.build.armv6 @@ -34,9 +34,7 @@ ENV ARCH armv6l ENV HOSTCC gcc ENV TARGET ARMV6 -RUN apt-get update && \ - apt-get install -y unzip && \ - rm -rf /var/lib/apt/lists/* +RUN apt update && apt install -y unzip WORKDIR /work/deps diff --git a/ci/docker/Dockerfile.build.armv7 b/ci/docker/Dockerfile.build.armv7 index 0f33dac77644..689fdcf44e1a 100755 --- a/ci/docker/Dockerfile.build.armv7 +++ b/ci/docker/Dockerfile.build.armv7 @@ -35,9 +35,7 @@ ENV HOSTCC gcc ENV TARGET ARMV7 ENV FC /usr/bin/${CROSS_TRIPLE}-gfortran -RUN apt-get update && \ - apt-get install -y unzip && \ - rm -rf /var/lib/apt/lists/* +RUN apt update && apt install -y unzip WORKDIR /work/deps diff --git a/ci/docker/Dockerfile.build.jetson b/ci/docker/Dockerfile.build.jetson index 7166cccfc790..f5a826ab0000 100755 --- a/ci/docker/Dockerfile.build.jetson +++ b/ci/docker/Dockerfile.build.jetson @@ -41,9 +41,7 @@ ENV FC /usr/bin/${CROSS_TRIPLE}-gfortran ENV HOSTCC gcc ENV TARGET ARMV8 -RUN apt-get update && \ - apt-get install -y unzip && \ - rm -rf /var/lib/apt/lists/* +RUN apt update && apt-get install -y unzip WORKDIR /work From be5441bb494bcb4d77412bb525b10d3dc0956c57 Mon Sep 17 00:00:00 2001 From: Anton Chernov Date: Fri, 1 Jun 2018 12:29:10 +0000 Subject: [PATCH 06/10] Moved common parts to scripts for docker builds --- ci/docker/Dockerfile.build.arm64 | 15 +++++++------- ci/docker/Dockerfile.build.armv6 | 15 +++++++------- ci/docker/Dockerfile.build.armv7 | 12 +++++------ ci/docker/Dockerfile.build.jetson | 15 +++++++------- ci/docker/install/install_openblas.sh | 30 +++++++++++++++++++++++++++ ci/docker/install/ubuntu_arm.sh | 24 +++++++++++++++++++++ 6 files changed, 83 insertions(+), 28 deletions(-) create mode 100755 ci/docker/install/install_openblas.sh create mode 100755 ci/docker/install/ubuntu_arm.sh diff --git a/ci/docker/Dockerfile.build.arm64 b/ci/docker/Dockerfile.build.arm64 index 46edd80698a4..6d4dbb5d8ea6 100755 --- a/ci/docker/Dockerfile.build.arm64 +++ b/ci/docker/Dockerfile.build.arm64 @@ -37,15 +37,16 @@ ENV FC /usr/bin/${CROSS_TRIPLE}-gfortran ENV HOSTCC gcc ENV TARGET ARMV8 -RUN apt update && apt install -y unzip +WORKDIR /work/deps -WORKDIR /work +COPY install/ubuntu_arm.sh /work/ +RUN /work/ubuntu_arm.sh -# Build OpenBLAS -RUN git clone --recursive -b v0.2.20 https://github.com/xianyi/OpenBLAS.git && \ - cd OpenBLAS && \ - make -j$(nproc) && \ - PREFIX=${CROSS_ROOT} make install +COPY install/install_openblas.sh /work/ +RUN /work/install_openblas.sh + +ENV OpenBLAS_HOME=${CROSS_ROOT} +ENV OpenBLAS_DIR=${CROSS_ROOT} COPY runtime_functions.sh /work/ WORKDIR /work/mxnet diff --git a/ci/docker/Dockerfile.build.armv6 b/ci/docker/Dockerfile.build.armv6 index 6d1406de0238..876e7cfe02ed 100755 --- a/ci/docker/Dockerfile.build.armv6 +++ b/ci/docker/Dockerfile.build.armv6 @@ -34,15 +34,16 @@ ENV ARCH armv6l ENV HOSTCC gcc ENV TARGET ARMV6 -RUN apt update && apt install -y unzip - WORKDIR /work/deps -# Build OpenBLAS -RUN git clone --recursive -b v0.2.20 https://github.com/xianyi/OpenBLAS.git && \ - cd OpenBLAS && \ - make -j$(nproc) && \ - make PREFIX=$CROSS_ROOT install +COPY install/ubuntu_arm.sh /work/ +RUN /work/ubuntu_arm.sh + +COPY install/install_openblas.sh /work/ +RUN /work/install_openblas.sh + +ENV OpenBLAS_HOME=${CROSS_ROOT} +ENV OpenBLAS_DIR=${CROSS_ROOT} COPY runtime_functions.sh /work/ WORKDIR /work/mxnet diff --git a/ci/docker/Dockerfile.build.armv7 b/ci/docker/Dockerfile.build.armv7 index 689fdcf44e1a..cedf81d7e84f 100755 --- a/ci/docker/Dockerfile.build.armv7 +++ b/ci/docker/Dockerfile.build.armv7 @@ -35,15 +35,13 @@ ENV HOSTCC gcc ENV TARGET ARMV7 ENV FC /usr/bin/${CROSS_TRIPLE}-gfortran -RUN apt update && apt install -y unzip - WORKDIR /work/deps -# Build OpenBLAS -RUN git clone --recursive -b v0.2.20 https://github.com/xianyi/OpenBLAS.git && \ - cd OpenBLAS && \ - make -j$(nproc) && \ - make PREFIX=$CROSS_ROOT install +COPY install/ubuntu_arm.sh /work/ +RUN /work/ubuntu_arm.sh + +COPY install/install_openblas.sh /work/ +RUN /work/install_openblas.sh ENV OpenBLAS_HOME=${CROSS_ROOT} ENV OpenBLAS_DIR=${CROSS_ROOT} diff --git a/ci/docker/Dockerfile.build.jetson b/ci/docker/Dockerfile.build.jetson index f5a826ab0000..5981461140ac 100755 --- a/ci/docker/Dockerfile.build.jetson +++ b/ci/docker/Dockerfile.build.jetson @@ -41,15 +41,16 @@ ENV FC /usr/bin/${CROSS_TRIPLE}-gfortran ENV HOSTCC gcc ENV TARGET ARMV8 -RUN apt update && apt-get install -y unzip +WORKDIR /work/deps -WORKDIR /work +COPY install/ubuntu_arm.sh /work/ +RUN /work/ubuntu_arm.sh -# Build OpenBLAS -RUN git clone --recursive -b v0.2.20 https://github.com/xianyi/OpenBLAS.git && \ - cd OpenBLAS && \ - make -j$(nproc) && \ - PREFIX=${CROSS_ROOT} make install +COPY install/install_openblas.sh /work/ +RUN /work/install_openblas.sh + +ENV OpenBLAS_HOME=${CROSS_ROOT} +ENV OpenBLAS_DIR=${CROSS_ROOT} ENV OpenBLAS_HOME=${CROSS_ROOT} ENV OpenBLAS_DIR=${CROSS_ROOT} diff --git a/ci/docker/install/install_openblas.sh b/ci/docker/install/install_openblas.sh new file mode 100755 index 000000000000..fa2e5cae9cba --- /dev/null +++ b/ci/docker/install/install_openblas.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +# 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. + +set -ex + +git clone --recursive -b v0.2.20 https://github.com/xianyi/OpenBLAS.git + +cd OpenBLAS +make -j$(nproc) +PREFIX=${CROSS_ROOT} make install + +cd .. + +rm -rf OpenBLAS diff --git a/ci/docker/install/ubuntu_arm.sh b/ci/docker/install/ubuntu_arm.sh new file mode 100755 index 000000000000..becb012bd180 --- /dev/null +++ b/ci/docker/install/ubuntu_arm.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +# 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. + +set -ex + +apt update +apt install -y \ + unzip From 94a8f4fe5fdb8c6ce50e34f27a89fe0230264aec Mon Sep 17 00:00:00 2001 From: Anton Chernov Date: Tue, 5 Jun 2018 10:19:19 +0000 Subject: [PATCH 07/10] Disabled bundled OpenMP for cross compilation --- CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e57c00b69e92..962c73834222 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -340,7 +340,11 @@ if(USE_OPENMP) find_package(OpenMP REQUIRED) # This should build on Windows, but there's some problem and I don't have a Windows box, so # could a Windows user please fix? - if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/openmp/CMakeLists.txt AND SYSTEM_ARCHITECTURE STREQUAL "x86_64" AND NOT MSVC) + if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/openmp/CMakeLists.txt + AND SYSTEM_ARCHITECTURE STREQUAL "x86_64" + AND NOT MSVC + AND NOT CMAKE_CROSSCOMPILING) + # Intel/llvm OpenMP: https://github.com/llvm-mirror/openmp set(OPENMP_STANDALONE_BUILD TRUE) set(LIBOMP_ENABLE_SHARED TRUE) From b55e8670b2835d39ac3f4d0b6d2f89c0719f134d Mon Sep 17 00:00:00 2001 From: Anton Chernov Date: Wed, 6 Jun 2018 15:32:58 +0000 Subject: [PATCH 08/10] Added make based build for armv7 as option --- ci/docker/runtime_functions.sh | 2 +- make/crosscompile.armv7.mk | 198 +++++++++++++++++++++++++++++++++ 2 files changed, 199 insertions(+), 1 deletion(-) create mode 100644 make/crosscompile.armv7.mk diff --git a/ci/docker/runtime_functions.sh b/ci/docker/runtime_functions.sh index 66cd23ecdb4d..227805d2acb7 100755 --- a/ci/docker/runtime_functions.sh +++ b/ci/docker/runtime_functions.sh @@ -107,7 +107,7 @@ build_jetson() { cp -f make/crosscompile.jetson.mk ./config.mk make -j$(nproc) - build_wheel + build_wheel /work/mxnet/python /work/mxnet/lib popd } diff --git a/make/crosscompile.armv7.mk b/make/crosscompile.armv7.mk new file mode 100644 index 000000000000..47402451d8d5 --- /dev/null +++ b/make/crosscompile.armv7.mk @@ -0,0 +1,198 @@ +# 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 +# +# If you want to change the configuration, please use the following +# steps. Assume you are on the root directory of mxnet. First copy the this +# file so that any local changes will be ignored by git +# +# $ cp make/config.mk . +# +# Next modify the according entries, and then compile by +# +# $ make +# +# or build in parallel with 8 threads +# +# $ make -j8 +#------------------------------------------------------------------------------- + +#--------------------- +# For cross compilation we only explictily set a compiler when one is not already present. +#-------------------- + +ifndef CC +export CC = gcc +endif +ifndef CXX +export CXX = g++ +endif +ifndef NVCC +export NVCC = nvcc +endif + +# whether compile with options for MXNet developer +DEV = 0 + +# whether compile with debug +DEBUG = 0 + +# whether to turn on segfault signal handler to log the stack trace +USE_SIGNAL_HANDLER = 1 + +# the additional link flags you want to add +ADD_LDFLAGS = + +# the additional compile flags you want to add +ADD_CFLAGS = + +#--------------------------------------------- +# matrix computation libraries for CPU/GPU +#--------------------------------------------- + +# whether use CUDA during compile +USE_CUDA = 0 + +# 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 = NONE + +# whether to enable CUDA runtime compilation +ENABLE_CUDA_RTC = 0 + +# whether use CuDNN R3 library +USE_CUDNN = 0 + +#whether to use NCCL library +USE_NCCL = 0 +#add the path to NCCL library +USE_NCCL_PATH = NONE + +# whether use opencv during compilation +# you can disable it, however, you will not able to use +# imbin iterator +USE_OPENCV = 0 + +#whether use libjpeg-turbo for image decode without OpenCV wrapper +USE_LIBJPEG_TURBO = 0 +#add the path to libjpeg-turbo library +USE_LIBJPEG_TURBO_PATH = NONE + +# use openmp for parallelization +USE_OPENMP = 1 + +# whether use MKL-DNN library +USE_MKLDNN = 0 + +# whether use NNPACK library +USE_NNPACK = 0 + +# 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 +UNAME_S := $(shell uname -s) +USE_BLAS = openblas + +# 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 = + +# 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 only for BLAS, 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 +#---------------------------- +USE_SSE = 0 + +# Turn off F16C instruction set support +USE_F16C = 0 + +#---------------------------- +# distributed computing +#---------------------------- + +# whether or not to enable multi-machine supporting +USE_DIST_KVSTORE = 0 + +# 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 = NONE + +# 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 = 0 + +#---------------------------- +# performance settings +#---------------------------- +# Use operator tuning +USE_OPERATOR_TUNING = 1 + +# Use gperftools if found +USE_GPERFTOOLS = 1 + +# Use JEMalloc if found, and not using gperftools +USE_JEMALLOC = 1 + +#---------------------------- +# additional operators +#---------------------------- + +# path to folders containing projects specific operators that you don't want to put in src/operators +EXTRA_OPERATORS = + +#---------------------------- +# other features +#---------------------------- + +# Create C++ interface package +USE_CPP_PACKAGE = 0 + +#---------------------------- +# 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 + +# WARPCTC_PATH = $(HOME)/warp-ctc +# MXNET_PLUGINS += plugin/warpctc/warpctc.mk + +# whether to use sframe integration. This requires build sframe +# git@github.com:dato-code/SFrame.git +# SFRAME_PATH = $(HOME)/SFrame +# MXNET_PLUGINS += plugin/sframe/plugin.mk From 7324772679f1f125d6ef9ac6c5b919018562fff8 Mon Sep 17 00:00:00 2001 From: Anton Chernov Date: Wed, 6 Jun 2018 16:27:45 +0000 Subject: [PATCH 09/10] Renamed install_openblas.sh -> arm_openblas.sh --- ci/docker/Dockerfile.build.arm64 | 4 ++-- ci/docker/Dockerfile.build.armv6 | 4 ++-- ci/docker/Dockerfile.build.armv7 | 4 ++-- ci/docker/Dockerfile.build.jetson | 4 ++-- ci/docker/install/{install_openblas.sh => arm_openblas.sh} | 0 5 files changed, 8 insertions(+), 8 deletions(-) rename ci/docker/install/{install_openblas.sh => arm_openblas.sh} (100%) diff --git a/ci/docker/Dockerfile.build.arm64 b/ci/docker/Dockerfile.build.arm64 index 6d4dbb5d8ea6..d88b3805fb29 100755 --- a/ci/docker/Dockerfile.build.arm64 +++ b/ci/docker/Dockerfile.build.arm64 @@ -42,8 +42,8 @@ WORKDIR /work/deps COPY install/ubuntu_arm.sh /work/ RUN /work/ubuntu_arm.sh -COPY install/install_openblas.sh /work/ -RUN /work/install_openblas.sh +COPY install/arm_openblas.sh /work/ +RUN /work/arm_openblas.sh ENV OpenBLAS_HOME=${CROSS_ROOT} ENV OpenBLAS_DIR=${CROSS_ROOT} diff --git a/ci/docker/Dockerfile.build.armv6 b/ci/docker/Dockerfile.build.armv6 index 876e7cfe02ed..93be54025f42 100755 --- a/ci/docker/Dockerfile.build.armv6 +++ b/ci/docker/Dockerfile.build.armv6 @@ -39,8 +39,8 @@ WORKDIR /work/deps COPY install/ubuntu_arm.sh /work/ RUN /work/ubuntu_arm.sh -COPY install/install_openblas.sh /work/ -RUN /work/install_openblas.sh +COPY install/arm_openblas.sh /work/ +RUN /work/arm_openblas.sh ENV OpenBLAS_HOME=${CROSS_ROOT} ENV OpenBLAS_DIR=${CROSS_ROOT} diff --git a/ci/docker/Dockerfile.build.armv7 b/ci/docker/Dockerfile.build.armv7 index cedf81d7e84f..17df945893f7 100755 --- a/ci/docker/Dockerfile.build.armv7 +++ b/ci/docker/Dockerfile.build.armv7 @@ -40,8 +40,8 @@ WORKDIR /work/deps COPY install/ubuntu_arm.sh /work/ RUN /work/ubuntu_arm.sh -COPY install/install_openblas.sh /work/ -RUN /work/install_openblas.sh +COPY install/arm_openblas.sh /work/ +RUN /work/arm_openblas.sh ENV OpenBLAS_HOME=${CROSS_ROOT} ENV OpenBLAS_DIR=${CROSS_ROOT} diff --git a/ci/docker/Dockerfile.build.jetson b/ci/docker/Dockerfile.build.jetson index 5981461140ac..4867bb5421de 100755 --- a/ci/docker/Dockerfile.build.jetson +++ b/ci/docker/Dockerfile.build.jetson @@ -46,8 +46,8 @@ WORKDIR /work/deps COPY install/ubuntu_arm.sh /work/ RUN /work/ubuntu_arm.sh -COPY install/install_openblas.sh /work/ -RUN /work/install_openblas.sh +COPY install/arm_openblas.sh /work/ +RUN /work/arm_openblas.sh ENV OpenBLAS_HOME=${CROSS_ROOT} ENV OpenBLAS_DIR=${CROSS_ROOT} diff --git a/ci/docker/install/install_openblas.sh b/ci/docker/install/arm_openblas.sh similarity index 100% rename from ci/docker/install/install_openblas.sh rename to ci/docker/install/arm_openblas.sh From 6e0b64b16fdd81b8675628a9ea80ffb56ee312e3 Mon Sep 17 00:00:00 2001 From: Anton Chernov Date: Fri, 8 Jun 2018 12:45:54 +0000 Subject: [PATCH 10/10] Removed makefile build for armv7 --- make/crosscompile.armv7.mk | 198 ------------------------------------- 1 file changed, 198 deletions(-) delete mode 100644 make/crosscompile.armv7.mk diff --git a/make/crosscompile.armv7.mk b/make/crosscompile.armv7.mk deleted file mode 100644 index 47402451d8d5..000000000000 --- a/make/crosscompile.armv7.mk +++ /dev/null @@ -1,198 +0,0 @@ -# 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 -# -# If you want to change the configuration, please use the following -# steps. Assume you are on the root directory of mxnet. First copy the this -# file so that any local changes will be ignored by git -# -# $ cp make/config.mk . -# -# Next modify the according entries, and then compile by -# -# $ make -# -# or build in parallel with 8 threads -# -# $ make -j8 -#------------------------------------------------------------------------------- - -#--------------------- -# For cross compilation we only explictily set a compiler when one is not already present. -#-------------------- - -ifndef CC -export CC = gcc -endif -ifndef CXX -export CXX = g++ -endif -ifndef NVCC -export NVCC = nvcc -endif - -# whether compile with options for MXNet developer -DEV = 0 - -# whether compile with debug -DEBUG = 0 - -# whether to turn on segfault signal handler to log the stack trace -USE_SIGNAL_HANDLER = 1 - -# the additional link flags you want to add -ADD_LDFLAGS = - -# the additional compile flags you want to add -ADD_CFLAGS = - -#--------------------------------------------- -# matrix computation libraries for CPU/GPU -#--------------------------------------------- - -# whether use CUDA during compile -USE_CUDA = 0 - -# 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 = NONE - -# whether to enable CUDA runtime compilation -ENABLE_CUDA_RTC = 0 - -# whether use CuDNN R3 library -USE_CUDNN = 0 - -#whether to use NCCL library -USE_NCCL = 0 -#add the path to NCCL library -USE_NCCL_PATH = NONE - -# whether use opencv during compilation -# you can disable it, however, you will not able to use -# imbin iterator -USE_OPENCV = 0 - -#whether use libjpeg-turbo for image decode without OpenCV wrapper -USE_LIBJPEG_TURBO = 0 -#add the path to libjpeg-turbo library -USE_LIBJPEG_TURBO_PATH = NONE - -# use openmp for parallelization -USE_OPENMP = 1 - -# whether use MKL-DNN library -USE_MKLDNN = 0 - -# whether use NNPACK library -USE_NNPACK = 0 - -# 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 -UNAME_S := $(shell uname -s) -USE_BLAS = openblas - -# 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 = - -# 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 only for BLAS, 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 -#---------------------------- -USE_SSE = 0 - -# Turn off F16C instruction set support -USE_F16C = 0 - -#---------------------------- -# distributed computing -#---------------------------- - -# whether or not to enable multi-machine supporting -USE_DIST_KVSTORE = 0 - -# 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 = NONE - -# 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 = 0 - -#---------------------------- -# performance settings -#---------------------------- -# Use operator tuning -USE_OPERATOR_TUNING = 1 - -# Use gperftools if found -USE_GPERFTOOLS = 1 - -# Use JEMalloc if found, and not using gperftools -USE_JEMALLOC = 1 - -#---------------------------- -# additional operators -#---------------------------- - -# path to folders containing projects specific operators that you don't want to put in src/operators -EXTRA_OPERATORS = - -#---------------------------- -# other features -#---------------------------- - -# Create C++ interface package -USE_CPP_PACKAGE = 0 - -#---------------------------- -# 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 - -# WARPCTC_PATH = $(HOME)/warp-ctc -# MXNET_PLUGINS += plugin/warpctc/warpctc.mk - -# whether to use sframe integration. This requires build sframe -# git@github.com:dato-code/SFrame.git -# SFRAME_PATH = $(HOME)/SFrame -# MXNET_PLUGINS += plugin/sframe/plugin.mk