This is an automated email from the ASF dual-hosted git repository. marcoabreu pushed a commit to branch devel-arm in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git
commit 48524773adbfa1b29455c9250a2e9ee42d44bad1 Author: Anton Chernov <mecher...@gmail.com> AuthorDate: Thu May 24 17:29:24 2018 +0200 Fixed armv7 wheel --- ci/docker/Dockerfile.build.armv7 | 23 +++++++---- ci/docker/runtime_functions.sh | 88 ++++++++++++++++++++++++++-------------- 2 files changed, 73 insertions(+), 38 deletions(-) diff --git a/ci/docker/Dockerfile.build.armv7 b/ci/docker/Dockerfile.build.armv7 index c249306..102409a 100755 --- a/ci/docker/Dockerfile.build.armv7 +++ b/ci/docker/Dockerfile.build.armv7 @@ -16,17 +16,24 @@ # 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 dockcross/linux-armv7 -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 fa9de61..6805446 100755 --- a/ci/docker/runtime_functions.sh +++ b/ci/docker/runtime_functions.sh @@ -31,6 +31,37 @@ clean_repo() { git submodule update --init --recursive } +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.<platform> should have a corresponding # function here with the same suffix: @@ -38,24 +69,12 @@ clean_repo() { build_jetson() { set -ex pushd . + mv make/crosscompile.jetson.mk make/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 } @@ -72,7 +91,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} \ -DUSE_CUDA=OFF \ -DUSE_OPENCV=OFF \ -DUSE_OPENMP=OFF \ @@ -83,11 +102,10 @@ 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 } @@ -95,19 +113,29 @@ build_armv7() { set -ex pushd . cd /work/build - cmake\ - -DUSE_CUDA=OFF\ - -DUSE_OPENCV=OFF\ - -DUSE_OPENMP=OFF\ - -DUSE_SIGNAL_HANDLER=ON\ - -DCMAKE_BUILD_TYPE=RelWithDebInfo\ - -DUSE_MKL_IF_AVAILABLE=OFF\ + + # 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 \ + -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 } -- To stop receiving notification emails like this one, please contact marcoab...@apache.org.