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/03/14 21:06:33 UTC

[GitHub] cjolivier01 closed pull request #10111: [WIP] Test CI build

cjolivier01 closed pull request #10111: [WIP] Test CI build
URL: https://github.com/apache/incubator-mxnet/pull/10111
 
 
   

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/3rdparty/openmp b/3rdparty/openmp
index 37c72127e90..29b515e1e6d 160000
--- a/3rdparty/openmp
+++ b/3rdparty/openmp
@@ -1 +1 @@
-Subproject commit 37c72127e90360a020f351f18d9cccfc30e5145a
+Subproject commit 29b515e1e6d26b5b0d32d47d28dcdb4b8a11470d
diff --git a/ci/docker/Dockerfile.build.jetson b/ci/docker/Dockerfile.build.jetson
index e49b48e7e1c..08043d257fd 100755
--- a/ci/docker/Dockerfile.build.jetson
+++ b/ci/docker/Dockerfile.build.jetson
@@ -59,6 +59,7 @@ RUN JETPACK_DOWNLOAD_PREFIX=http://developer.download.nvidia.com/devzone/devcent
     dpkg -i $ARM_CUDNN_DEV_INSTALLER_PACKAGE && \
     apt update -y  && \
     apt install -y unzip cuda-cudart-cross-aarch64-8-0 cuda-cublas-cross-aarch64-8-0 \
+    apt install -y python python-dev python3 python3-dev cython cython3 \
     cuda-nvml-cross-aarch64-8-0 cuda-nvrtc-cross-aarch64-8-0 cuda-cufft-cross-aarch64-8-0 \
     cuda-curand-cross-aarch64-8-0 cuda-cusolver-cross-aarch64-8-0 cuda-cusparse-cross-aarch64-8-0 \
     cuda-misc-headers-cross-aarch64-8-0 cuda-npp-cross-aarch64-8-0 libcudnn6  && \
diff --git a/cmake/UseCython.cmake b/cmake/UseCython.cmake
index f442d7203df..1f7749cd8db 100644
--- a/cmake/UseCython.cmake
+++ b/cmake/UseCython.cmake
@@ -96,10 +96,10 @@ if(NOT python_libs_version)
   message(STATUS "Looking for python dependencies, version: ${python_libs_version}")
 endif()
 
-find_package(PythonInterp ${python_libs_version} REQUIRED)
+find_package(PythonInterp ${python_libs_version})
 if(PYTHONINTERP_FOUND)
   message(STATUS "Python ${python_libs_version} executable: ${PYTHON_EXECUTABLE}")
-  find_package(PythonLibs ${python_libs_version} REQUIRED)
+  find_package(PythonLibs ${python_libs_version})
   if(PYTHONLIBS_FOUND)
     set(PYTHON_DEBUG_LIBRARY ${PYTHON_LIBRARY})
     set(PYTHON_DEBUG_LIBRARIES ${PYTHON_DEBUG_LIBRARIES})
@@ -110,7 +110,7 @@ if(PYTHONINTERP_FOUND)
     list(GET PYTHON_VERSION_LIST 1 PYTHON_VERSION_MINOR)
     list(GET PYTHON_VERSION_LIST 1 PYTHON_VERSION_PATCH)
 
-    find_package(Cython ${python_libs_version} REQUIRED)
+    find_package(Cython ${python_libs_version})
     if(CYTHON_FOUND)
       set(CYTHON${python_libs_version}_FOUND ${python_libs_version})
       message(STATUS  " CYTHON${python_libs_version}_FOUND: ${CYTHON${python_libs_version}_FOUND}")
diff --git a/mshadow b/mshadow
index f5b67f380cb..b3771de20ed 160000
--- a/mshadow
+++ b/mshadow
@@ -1 +1 @@
-Subproject commit f5b67f380cb0588be11e6f440f92f013139380ee
+Subproject commit b3771de20ed36f90ba7b8436ae4b79ea298a687a
diff --git a/python/mxnet/cython/__init__.py b/python/mxnet/cython/__init__.py
index 13a83393a91..4c679dd3e34 100644
--- a/python/mxnet/cython/__init__.py
+++ b/python/mxnet/cython/__init__.py
@@ -14,3 +14,32 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
+
+import importlib
+import sys
+
+
+def load_cython(package_name, module_name):
+    # How to pass something like '.' as package_name?
+    name = package_name + '.cyX.' + module_name
+    try:
+        if sys.version_info >= (3, 0):
+            if len(package_name) > 0 and package_name[0] != '.':
+                name = package_name + '.cy3.' + module_name
+                package_name = None
+            else:
+                name = 'cy3.' + module_name
+        else:
+            if len(package_name) > 0 and package_name[0] != '.':
+                name = package_name + '.cy2.' + module_name
+                package_name = None
+            else:
+                name = 'cy2.' + module_name
+        #print('Attemptiog to load cython module: {}'.format(name))
+        the_module = importlib.import_module(name, package=package_name)
+        #print('Loaded cython module: {}'.format(name))
+        return the_module
+    except:
+        # No cython found
+        print('Unable to load cython module: {}'.format(name))
+    return None
diff --git a/src/cython/cpp_api.cc b/src/cython/cpp_api.cc
index 44c80092468..f0f87366d31 100644
--- a/src/cython/cpp_api.cc
+++ b/src/cython/cpp_api.cc
@@ -18,12 +18,11 @@
  */
 #include <iostream>
 #include <cstdarg>
-#include <sys/time.h>
 #include <chrono>
-#include "cpp_api.h"
+#include "./cpp_api.h"
 
 extern "C" int CythonPrintFromCPP(const char *foo) {
-  if(foo) {
+  if (foo) {
     std::cout << foo << std::endl << std::flush;
   }
   return 0;
diff --git a/src/cython/cpp_api.h b/src/cython/cpp_api.h
index 249e33d4bec..89567b1163c 100644
--- a/src/cython/cpp_api.h
+++ b/src/cython/cpp_api.h
@@ -19,15 +19,17 @@
 #ifndef MXNET_CYTHON_CPP_API_H_
 #define MXNET_CYTHON_CPP_API_H_
 
+#include <mxnet/c_api.h>
+
 /*! \brief Inhibit C++ name-mangling for MXNet functions. */
 #ifdef __cplusplus
 extern "C" {
 #endif  // __cplusplus
 
-int CythonPrintFromCPP(const char *foo);
-int Printf(const char *fmt, ...);
-int TrivialCPPCall(int var);
-uint64_t TimeInMilliseconds();
+MXNET_DLL int CythonPrintFromCPP(const char *foo);
+MXNET_DLL int Printf(const char *fmt, ...);
+MXNET_DLL int TrivialCPPCall(int var);
+MXNET_DLL uint64_t TimeInMilliseconds();
 
 #ifdef __cplusplus
 }
@@ -35,7 +37,7 @@ uint64_t TimeInMilliseconds();
 
 namespace shapes {
 
-class Rectangle {
+class MXNET_DLL Rectangle {
  public:
   int x0, y0, x1, y1;
   Rectangle();
diff --git a/tests/python/unittest/test_cython.py b/tests/python/unittest/test_cython.py
index 5cb6829b3d7..650c6702f46 100644
--- a/tests/python/unittest/test_cython.py
+++ b/tests/python/unittest/test_cython.py
@@ -20,22 +20,11 @@
 
 from __future__ import print_function
 import sys
-import time
 from mxnet.base import _LIB
+import mxnet.cython as cy
 
-try:
-  if sys.version_info >= (3, 0):
-    import mxnet.cython.cy3.mxcython as mxc
-    import mxnet.ndarray.cy3.ndarray as ndcy
-    import mxnet.symbol.cy3.symbol   as symcy
-  else:
-    import mxnet.cython.cy2.mxcython as mxc
-    import mxnet.ndarray.cy2.ndarray as ndcy
-    import mxnet.symbol.cy2.symbol   as symcy
-except:
-  # No cython found
-  print('Unable to load cython modules')
-  exit(1)
+mxc  = cy.load_cython('mxnet.cython', 'mxcython')
+cynd = cy.load_cython('mxnet.ndarray', 'ndarray')
 
 def test_basic_cython():
   print('ENTER test_basic_cython')
@@ -69,6 +58,7 @@ def test_perf(count, make_c_call):
     msg = " WITH API CALL"
   print("PYTHON {}: {} items took {} seconds".format(msg, count, float(stop - start)/1000))
 
+
 def test_perf_bridge(count, do_cython_call, api_call_count):
   if do_cython_call == 0:
     assert api_call_count == 0  # Sanity on input values


 

----------------------------------------------------------------
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