You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2018/06/07 16:51:05 UTC

[GitHub] larroy closed pull request #10297: [MXNET-244] Fixes for cross compilation in ARM

larroy closed pull request #10297: [MXNET-244] Fixes for cross compilation in ARM
URL: https://github.com/apache/incubator-mxnet/pull/10297
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/ci/build.py b/ci/build.py
index e52fa794bc9..9e933195047 100755
--- a/ci/build.py
+++ b/ci/build.py
@@ -221,47 +221,52 @@ def script_name() -> str:
                         help="go in a shell inside the container",
                         action='store_true')
 
-    parser.add_argument("--docker-registry",
-                        help="Dockerhub registry name to retrieve cache from",
+    parser.add_argument("-d", "--docker-registry",
+                        help="Dockerhub registry name to retrieve cache from. Default is 'mxnetci'",
                         default='mxnetci',
                         type=str)
 
+    parser.add_argument("-c", "--cache", action="store_true",
+                        help="Enable docker registry cache")
+
     parser.add_argument("command",
                         help="command to run in the container",
                         nargs='*', action='append', type=str)
 
     args = parser.parse_args()
-    docker_registry = args.docker_registry
+    def use_cache():
+        return args.cache or 'JOB_NAME' in os.environ # we are in Jenkins
+
     command = list(chain(*args.command))
     docker_binary = get_docker_binary(args.nvidiadocker)
     shared_memory_size = args.shared_memory_size
 
-    print("into container: {}".format(args.into_container))
     if args.list:
         list_platforms()
     elif args.platform:
         platform = args.platform
-        tag = get_docker_tag(platform=platform, registry=docker_registry)
-        load_docker_cache(tag=tag, docker_registry=args.docker_registry)
-        build_docker(platform, docker_binary, registry=docker_registry)
+        tag = get_docker_tag(platform=platform, registry=args.docker_registry)
+        if use_cache():
+            load_docker_cache(tag=tag, docker_registry=args.docker_registry)
+        build_docker(platform, docker_binary, registry=args.docker_registry)
         if args.build_only:
             logging.warning("Container was just built. Exiting due to build-only.")
             return 0
 
         if command:
             container_run(platform=platform, docker_binary=docker_binary, shared_memory_size=shared_memory_size,
-                          command=command, docker_registry=docker_registry)
+                          command=command, docker_registry=args.docker_registry)
         elif args.print_docker_run:
             print(container_run(platform=platform, docker_binary=docker_binary, shared_memory_size=shared_memory_size,
-                                command=[], dry_run=True, docker_registry=docker_registry))
+                                command=[], dry_run=True, docker_registry=args.docker_registry))
         elif args.into_container:
             container_run(platform=platform, docker_binary=docker_binary, shared_memory_size=shared_memory_size,
-                          command=[], dry_run=False, into_container=True, docker_registry=docker_registry)
+                          command=[], dry_run=False, into_container=True, docker_registry=args.docker_registry)
         else:
             cmd = ["/work/mxnet/ci/docker/runtime_functions.sh", "build_{}".format(platform)]
             logging.info("No command specified, trying default build: %s", ' '.join(cmd))
             container_run(platform=platform, docker_binary=docker_binary, shared_memory_size=shared_memory_size,
-                          command=cmd, docker_registry=docker_registry)
+                          command=cmd, docker_registry=args.docker_registry)
 
     elif args.all:
         platforms = get_platforms()
@@ -269,8 +274,9 @@ def script_name() -> str:
         logging.info("Artifacts will be produced in the build/ directory.")
         for platform in platforms:
             tag = get_docker_tag(platform=platform, registry=docker_registry)
-            load_docker_cache(tag=tag, docker_registry=args.docker_registry)
-            build_docker(platform, docker_binary)
+            if use_cache():
+                load_docker_cache(tag=tag, docker_registry=args.docker_registry)
+            build_docker(platform, docker_binary, args.docker_registry)
             if args.build_only:
                 continue
             build_platform = "build_{}".format(platform)
diff --git a/ci/docker/Dockerfile.build.armv6 b/ci/docker/Dockerfile.build.armv6
index 20739dabe2e..11646f441cd 100755
--- a/ci/docker/Dockerfile.build.armv6
+++ b/ci/docker/Dockerfile.build.armv6
@@ -20,6 +20,9 @@
 
 FROM dockcross/linux-armv6
 
+RUN apt-get update
+RUN apt-get install -y unzip
+
 ENV ARCH armv6l
 ENV FC=/usr/bin/${CROSS_TRIPLE}-gfortran
 ENV HOSTCC gcc
diff --git a/ci/docker/Dockerfile.build.armv7 b/ci/docker/Dockerfile.build.armv7
index c2493063518..09594621461 100755
--- a/ci/docker/Dockerfile.build.armv7
+++ b/ci/docker/Dockerfile.build.armv7
@@ -20,13 +20,13 @@
 
 FROM dockcross/linux-armv7
 
-ENV ARCH armv71
+ENV ARCH armv7
 ENV CC /usr/bin/arm-linux-gnueabihf-gcc
 ENV CXX /usr/bin/arm-linux-gnueabihf-g++
 
-RUN apt-get update && \
-    apt-get install -y libopenblas-dev:armhf && \
-    rm -rf /var/lib/apt/lists/*
+RUN apt-get update
+RUN apt-get install -y libopenblas-dev:armhf unzip
+RUN rm -rf /var/lib/apt/lists/*
 
 COPY runtime_functions.sh /work/
 WORKDIR /work/build
diff --git a/ci/docker/runtime_functions.sh b/ci/docker/runtime_functions.sh
index fa9de6112ff..3912ef99969 100755
--- a/ci/docker/runtime_functions.sh
+++ b/ci/docker/runtime_functions.sh
@@ -40,19 +40,24 @@ build_jetson() {
     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
+    popd
+}
 
-    # Fix pathing issues in the wheel.  We need to move libmxnet.so from the data folder to the
-    # mxnet folder, then repackage the wheel.
+build_wheel() {
+    set -ex
+    pushd .
+    python setup.py bdist_wheel --universal
     WHEEL=`readlink -f dist/*.whl`
     TMPDIR=`mktemp -d`
     unzip -d $TMPDIR $WHEEL
     rm $WHEEL
     cd $TMPDIR
     mv *.data/data/mxnet/libmxnet.so mxnet
+    cd $TMPDIR
+    #zip -r $WHEEL $TMPDIR
     zip -r $WHEEL .
     cp $WHEEL /work/build
     rm -rf $TMPDIR
@@ -77,7 +82,7 @@ build_armv6() {
         -DUSE_OPENCV=OFF \
         -DUSE_OPENMP=OFF \
         -DUSE_SIGNAL_HANDLER=ON \
-        -DCMAKE_BUILD_TYPE=Release \
+        -DCMAKE_BUILD_TYPE=Release\
         -DUSE_MKL_IF_AVAILABLE=OFF \
         -DUSE_LAPACK=OFF \
         -DBUILD_CPP_EXAMPLES=OFF \
@@ -86,8 +91,7 @@ build_armv6() {
     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
 }
 
@@ -100,14 +104,13 @@ build_armv7() {
         -DUSE_OPENCV=OFF\
         -DUSE_OPENMP=OFF\
         -DUSE_SIGNAL_HANDLER=ON\
-        -DCMAKE_BUILD_TYPE=RelWithDebInfo\
+        -DCMAKE_BUILD_TYPE=Release\
         -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_wheel
     popd
 }
 
@@ -270,6 +273,10 @@ build_ubuntu_cpu_mkldnn() {
         -j$(nproc)
 }
 
+build_ubuntu_gpu() {
+    build_ubuntu_gpu_cuda91_cudnn7
+}
+
 build_ubuntu_gpu_mkldnn() {
     set -ex
     make  \
diff --git a/tests/python/unittest/test_ndarray.py b/tests/python/unittest/test_ndarray.py
index a0604658ee1..7c50a424b40 100644
--- a/tests/python/unittest/test_ndarray.py
+++ b/tests/python/unittest/test_ndarray.py
@@ -711,9 +711,8 @@ def get_values(ensure_unique):
                  k=dat_size*dat_size*dat_size*dat_size, is_ascend=False)
     assert_almost_equal(nd_ret_argsort, gt)
 
-    # test topk with a big shape
-    a = mx.nd.arange(0, 54686454, step=1, repeat=1)
-    assert_almost_equal(a.topk(k=54686454).asnumpy(), a.asnumpy()[::-1])
+    a = mx.nd.arange(0, 1024, step=1, repeat=1)
+    assert_almost_equal(a.topk(k=1024).asnumpy(), a.asnumpy()[::-1])
 
     # Repeat those tests that don't involve indices.  These should pass even with
     # duplicated input data values (over many repeated runs with different random seeds,


 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services