lebeg commented on a change in pull request #9943: [Don't MERGE] CI 2.0, revamp 
ci scripts and dockerfiles, integrate IoT builds
URL: https://github.com/apache/incubator-mxnet/pull/9943#discussion_r171568102
 
 

 ##########
 File path: ci/build_functions.sh
 ##########
 @@ -0,0 +1,254 @@
+#!/bin/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.
+
+# build and install are separated so changes to build don't invalidate
+# the whole docker cache for the image
+
+set -ex
+
+clean_repo() {
+    set -ex
+    git clean -xfd
+    git submodule foreach --recursive git clean -xfd
+    git reset --hard
+    git submodule foreach --recursive git reset --hard
+    git submodule update --init --recursive
+}
+
+
+# Build commands: Every platform in docker/Dockerfile.build.<platform> should 
have a corresponding
+# function here with the same suffix:
+
+build_jetson() {
+    set -ex
+    pushd .
+    cd /work/build
+    cmake\
+        -DUSE_CUDA=OFF\
+        -DUSE_OPENCV=OFF\
+        -DUSE_OPENMP=ON\
+        -DUSE_SIGNAL_HANDLER=ON\
+        -DUSE_MKL_IF_AVAILABLE=OFF\
+        -DUSE_LAPACK=OFF\
+        -DCMAKE_BUILD_TYPE=RelWithDebInfo\
+        -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
+    popd
+}
+
+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\
+        -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
+    popd
+}
+
+build_ubuntu_cpu() {
+    set -ex
+    pushd .
+    cd /work/build
+    cmake\
+        -DUSE_CPP_PACKAGE=ON\
+        -DUSE_CUDA=OFF\
+        -DUSE_OPENCV=ON\
+        -DUSE_OPENMP=ON\
+        -DUSE_SIGNAL_HANDLER=ON\
+        -DUSE_MKL_IF_AVAILABLE=OFF\
+        -DCMAKE_BUILD_TYPE=RelWithDebInfo\
+        -G Ninja /work/mxnet
+    ninja
+    popd
+}
+
+test_ubuntu_cpu_python2() {
+    set -ex
+    pushd .
+    export MXNET_LIBRARY_PATH=/work/build/libmxnet.so
+
+    VENV=mxnet_py2_venv
+    virtualenv -p `which python2` $VENV
+    source $VENV/bin/activate
+    pip install nose nose-timer
+
+    cd /work/mxnet/python
+    pip install -e .
+    cd /work/mxnet
+    python -m "nose" --with-timer --verbose tests/python/unittest
+    popd
+}
+
+test_ubuntu_cpu_python3() {
+    set -ex
+    pushd .
+    export MXNET_LIBRARY_PATH=/work/build/libmxnet.so
+    VENV=mxnet_py3_venv
+    virtualenv -p `which python3` $VENV
+    source $VENV/bin/activate
+
+    cd /work/mxnet/python
+    pip3 install nose nose-timer
+    pip3 install -e .
+    cd /work/mxnet
+    python3 -m "nose" --with-timer --verbose tests/python/unittest
+
+    popd
+}
+
+build_amzn_linux_cpu() {
+    cd /work/build
+    cmake\
+        -DUSE_CUDA=OFF\
+        -DUSE_OPENCV=ON\
+        -DUSE_OPENMP=ON\
+        -DUSE_SIGNAL_HANDLER=ON\
+        -DCMAKE_BUILD_TYPE=RelWithDebInfo\
+        -DUSE_MKL_IF_AVAILABLE=OFF\
+        -DUSE_LAPACK=OFF\
+        -G Ninja /work/mxnet
+    ninja
+    export MXNET_LIBRARY_PATH=`pwd`/libmxnet.so
+}
+
+build_arm64() {
+    cmake\
+        -DUSE_CUDA=OFF\
+        -DUSE_OPENCV=OFF\
+        -DUSE_OPENMP=OFF\
+        -DUSE_SIGNAL_HANDLER=ON\
+        -DCMAKE_BUILD_TYPE=RelWithDebInfo\
+        -DUSE_MKL_IF_AVAILABLE=OFF\
+        -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_android_arm64() {
+    set -ex
+    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\
+        -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_ubuntu_gpu() {
+    # TODO
+    set -ex
+    echo FIXME
+}
+
+build_centos7_cpu() {
+    set -ex
+    cd /work/mxnet
+    make \
+        DEV=1 \
+        USE_PROFILER=1 \
+        USE_BLAS=openblas \
+        -j$(nproc)
+}
+
+build_centos7_gpu() {
+    set -ex
+    cd /work/mxnet
+    make \
+        DEV=1 \
+        USE_PROFILER=1 \
+        USE_BLAS=openblas \
+        USE_CUDA=1 \
+        USE_CUDA_PATH=/usr/local/cuda \
+        USE_CUDNN=1 \
+        -j$(nproc)
+}
+
+test_centos7_cpu() {
+    set -ex
+    cd /work/mxnet
+    python3.6 -m "nose" --with-timer --verbose tests/python/unittest
+    python3.6 -m "nose" --with-timer --verbose tests/python/train
+}
+
+test_centos7_gpu() {
+    set -ex
+    cd /work/mxnet
+    python3.6 -m "nose" --with-timer --verbose tests/python/gpu
+}
+
+
+
+
+# Testing
+
+sanity_check() {
+    set -ex
+    tools/license_header.py check
+    make cpplint rcpplint jnilint
+    make pylint
+}
+
+
+##############################################################
+# MAIN
+#
+# Run function passed as argument
+set +x
+if [ $# -gt 0 ]
+then
+    $@
+else
+    cat<<EOF
 
 Review comment:
   is EOF correct?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to