szha closed pull request #10719: Fix compile error in Windows-MSVC 2015
URL: https://github.com/apache/incubator-mxnet/pull/10719
 
 
   

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/CMakeLists.txt b/CMakeLists.txt
index ffa4d6549d6..70ead436fb7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -187,6 +187,13 @@ if(USE_MKL_IF_AVAILABLE)
   endif()
 endif()
 
+if(FORCE_USE_MKLDNN AND MSVC)
+  include_directories(3rdparty/mkldnn/install/include)
+  list(APPEND mxnet_LINKER_LIBS 
${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/mkldnn/install/lib/mkldnn.lib)
+  add_definitions(-DMXNET_USE_MKLDNN=1)
+  message('Force the use of MKL-DNN even without MKL')
+endif()
+
 # Allow Cuda compiles outside of src tree to find things in 'src' and 'include'
 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)
diff --git a/install.sh b/install.sh
new file mode 100644
index 00000000000..c31f78204c0
--- /dev/null
+++ b/install.sh
@@ -0,0 +1,5 @@
+cp -r ./3rdparty/dmlc-core/include/dmlc /usr/include/
+cp -r ./3rdparty/nnvm/include/nnvm /usr/include/
+cp -r ./include/mxnet /usr/include/
+cp -r ./cpp-package/include/mxnet-cpp /usr/include/
+cp ./lib/* /usr/lib/
diff --git a/src/operator/nn/mkldnn/mkldnn_base.cc 
b/src/operator/nn/mkldnn/mkldnn_base.cc
index c0e1ee6aaa6..5febe9c6c84 100644
--- a/src/operator/nn/mkldnn/mkldnn_base.cc
+++ b/src/operator/nn/mkldnn/mkldnn_base.cc
@@ -349,7 +349,11 @@ static bool SimilarArray(const mxnet::NDArray &arr1, const 
mxnet::NDArray &arr2,
       arr2.IsMKLDNNData() ? buf2.data().dptr_: arr2.data().dptr_);
   std::atomic<bool> success(true);
 #pragma omp parallel for
+#ifdef _MSC_VER
+  for (long long i = 0; i < (long long)arr1.shape().Size(); i++) {
+#else
   for (size_t i = 0; i < arr1.shape().Size(); i++) {
+#endif
     if (std::abs(data1[i] - data2[i]) > atol + rtol * std::abs(data2[i]))
       success.store(false);
   }
diff --git a/src/operator/tensor/elemwise_sum.h 
b/src/operator/tensor/elemwise_sum.h
index acf73e722b4..51dd08c32bb 100644
--- a/src/operator/tensor/elemwise_sum.h
+++ b/src/operator/tensor/elemwise_sum.h
@@ -37,7 +37,7 @@
 namespace mxnet {
 namespace op {
 
-struct Sum {
+struct StructSum {
   template<typename DType>
   MSHADOW_XINLINE static DType sum(int i, const DType* a) {
     return a[i];
@@ -70,14 +70,14 @@ void ElementWiseSumCompute_(const nnvm::NodeAttrs& attrs,
     case 2: {
       DType* in_0_dptr = in_data[0].dptr<DType>();
       DType* in_1_dptr = in_data[1].dptr<DType>();
-      Kernel<Sum, xpu>::Launch(s, out_size, out_dptr, req[0], in_0_dptr, 
in_1_dptr);
+      Kernel<StructSum, xpu>::Launch(s, out_size, out_dptr, req[0], in_0_dptr, 
in_1_dptr);
       break;
     }
     case 3: {
       DType* in_0_dptr = in_data[0].dptr<DType>();
       DType* in_1_dptr = in_data[1].dptr<DType>();
       DType* in_2_dptr = in_data[2].dptr<DType>();
-      Kernel<Sum, xpu>::Launch(s, out_size, out_dptr, req[0], in_0_dptr, 
in_1_dptr, in_2_dptr);
+      Kernel<StructSum, xpu>::Launch(s, out_size, out_dptr, req[0], in_0_dptr, 
in_1_dptr, in_2_dptr);
       break;
     }
     case 4: {
@@ -85,16 +85,16 @@ void ElementWiseSumCompute_(const nnvm::NodeAttrs& attrs,
       DType* in_1_dptr = in_data[1].dptr<DType>();
       DType* in_2_dptr = in_data[2].dptr<DType>();
       DType* in_3_dptr = in_data[3].dptr<DType>();
-      Kernel<Sum, xpu>::Launch(s, out_size, out_dptr, req[0], in_0_dptr, 
in_1_dptr, in_2_dptr,
+      Kernel<StructSum, xpu>::Launch(s, out_size, out_dptr, req[0], in_0_dptr, 
in_1_dptr, in_2_dptr,
         in_3_dptr);
       break;
     }
     default: {
       DType* in_0_dptr = in_data[0].dptr<DType>();
-      Kernel<Sum, xpu>::Launch(s, out_size, out_dptr, req[0], in_0_dptr);
+      Kernel<StructSum, xpu>::Launch(s, out_size, out_dptr, req[0], in_0_dptr);
       for (size_t i = 1; i < size; ++i) {
         DType* in_dptr = in_data[i].dptr<DType>();
-        Kernel<Sum, xpu>::Launch(s, out_size, out_dptr, req[0], out_dptr, 
in_dptr);
+        Kernel<StructSum, xpu>::Launch(s, out_size, out_dptr, req[0], 
out_dptr, in_dptr);
       }
       break;
     }


 

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to