singa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wang...@apache.org
Subject [1/8] incubator-singa git commit: SINGA-247 Add windows support for singa
Date Mon, 10 Oct 2016 15:46:07 GMT
Repository: incubator-singa
Updated Branches:
  refs/heads/master 80555151a -> e9b2c964c


SINGA-247 Add windows support for singa

Fix some warnings, most of which are type transferring.
Add a target named "singa_static" to generate static libs.


Project: http://git-wip-us.apache.org/repos/asf/incubator-singa/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-singa/commit/d0317a75
Tree: http://git-wip-us.apache.org/repos/asf/incubator-singa/tree/d0317a75
Diff: http://git-wip-us.apache.org/repos/asf/incubator-singa/diff/d0317a75

Branch: refs/heads/master
Commit: d0317a75c3dd7bd8e878ead0ea2b7a44273d07bd
Parents: 350bdf4
Author: xiezl <xiezhongle@comp.nus.edu.sg>
Authored: Tue Sep 20 01:47:05 2016 +0800
Committer: Wei Wang <wangwei@comp.nus.edu.sg>
Committed: Mon Oct 10 17:41:28 2016 +0800

----------------------------------------------------------------------
 src/CMakeLists.txt                      | 9 ++++++---
 src/core/tensor/sparse_tensor.cc        | 2 ++
 src/core/tensor/tensor.cc               | 2 +-
 src/io/image_transformer.cc             | 2 +-
 src/model/feed_forward_net.cc           | 2 +-
 src/model/layer/batchnorm.cc            | 2 +-
 src/model/layer/pooling.cc              | 2 +-
 src/model/optimizer/local_all_reduce.cc | 2 ++
 8 files changed, 15 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/d0317a75/src/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 7b94580..adafdf2 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -81,15 +81,18 @@ ENDFOREACH()
 ADD_LIBRARY(singa_objects OBJECT ${singa_sources})
 IF(WIN32) 
   IF (MSVC)
-	SET_TARGET_PROPERTIES(singa_objects 
-	  PROPERTIES COMPILE_FLAGS "/wd4244 /wd4267 /wd4018 /wd4005 /wd4804 /wd4800")
+	#SET_TARGET_PROPERTIES(singa_objects 
+	#  PROPERTIES COMPILE_FLAGS "/wd4244 /wd4267 /wd4018 /wd4005 /wd4804 /wd4800")
   ENDIF()
 ENDIF()
-#ADD_DEPENDENCIES(singa_objects copy_protobuf)
+ADD_DEPENDENCIES(singa_objects copy_protobuf)
 
 ADD_LIBRARY(singa SHARED $<TARGET_OBJECTS:singa_objects> ${cuda_objs})
 TARGET_LINK_LIBRARIES(singa ${SINGA_LINKER_LIBS})
 
+ADD_LIBRARY(singa_static STATIC $<TARGET_OBJECTS:singa_objects> ${cuda_objs})
+TARGET_LINK_LIBRARIES(singa ${SINGA_LINKER_LIBS})
+
 #pass configure infor to swig 
 FILE(REMOVE "${CMAKE_CURRENT_SOURCE_DIR}/api/config.i")
 CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/api/config.i.in" "${CMAKE_CURRENT_SOURCE_DIR}/api/config.i")

http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/d0317a75/src/core/tensor/sparse_tensor.cc
----------------------------------------------------------------------
diff --git a/src/core/tensor/sparse_tensor.cc b/src/core/tensor/sparse_tensor.cc
index 46ea850..68021d1 100644
--- a/src/core/tensor/sparse_tensor.cc
+++ b/src/core/tensor/sparse_tensor.cc
@@ -15,6 +15,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+#include "singa/singa_config.h"
+
 #ifndef DISABLE_WARNINGS
 
 #include "singa/core/tensor.h"

http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/d0317a75/src/core/tensor/tensor.cc
----------------------------------------------------------------------
diff --git a/src/core/tensor/tensor.cc b/src/core/tensor/tensor.cc
index 516a088..40d85a2 100644
--- a/src/core/tensor/tensor.cc
+++ b/src/core/tensor/tensor.cc
@@ -282,7 +282,7 @@ Tensor Tensor::T() const {
   Tensor t;
   t.device_ = device_;
   t.data_type_ = data_type_;
-  t.transpose_ = ~transpose_;
+  t.transpose_ = !transpose_;
   t.shape_.push_back(shape_[1]);
   t.shape_.push_back(shape_[0]);
   t.block_ = block_;

http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/d0317a75/src/io/image_transformer.cc
----------------------------------------------------------------------
diff --git a/src/io/image_transformer.cc b/src/io/image_transformer.cc
index f233ad3..6e5567d 100644
--- a/src/io/image_transformer.cc
+++ b/src/io/image_transformer.cc
@@ -31,7 +31,7 @@ namespace singa {
     CHECK_GE(input.nDim(), 2u);
     CHECK_EQ(input.data_type(), kFloat32) << "Data type " << input.data_type()
       << " is invalid for an raw image";
-    srand(time(NULL));
+    srand((unsigned int)time(NULL));
     /// TODO
     /// currently only consider one sample each time
 

http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/d0317a75/src/model/feed_forward_net.cc
----------------------------------------------------------------------
diff --git a/src/model/feed_forward_net.cc b/src/model/feed_forward_net.cc
index 3875430..c5c894e 100644
--- a/src/model/feed_forward_net.cc
+++ b/src/model/feed_forward_net.cc
@@ -129,7 +129,7 @@ void FeedForwardNet::AsType(DataType dtype) {
 void FeedForwardNet::Train(size_t batchsize, int nb_epoch, const Tensor& x,
                            const Tensor& y, float val_split) {
   CHECK_EQ(x.shape(0), y.shape(0)) << "Diff num of sampels in x and y";
-  size_t num_train = x.shape(0) * val_split;
+  size_t num_train = (size_t) (x.shape(0) * val_split);
   if (val_split == 0.0f) {
     Tensor dummy;
     Train(batchsize, nb_epoch, x, y, dummy, dummy);

http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/d0317a75/src/model/layer/batchnorm.cc
----------------------------------------------------------------------
diff --git a/src/model/layer/batchnorm.cc b/src/model/layer/batchnorm.cc
index 2ca7742..ad7b2b3 100644
--- a/src/model/layer/batchnorm.cc
+++ b/src/model/layer/batchnorm.cc
@@ -28,7 +28,7 @@ RegisterLayerClass(singacl_batchnorm, BatchNorm);
 void BatchNorm::Setup(const Shape& in_sample, const LayerConf& conf) {
   Layer::Setup(in_sample, conf);
   out_sample_shape_ = in_sample;
-  factor_ = conf.batchnorm_conf().factor();
+  factor_ = (float) conf.batchnorm_conf().factor();
   channels_ = in_sample.at(0);
   if (in_sample.size() == 3u)
     height_ = in_sample.at(1);

http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/d0317a75/src/model/layer/pooling.cc
----------------------------------------------------------------------
diff --git a/src/model/layer/pooling.cc b/src/model/layer/pooling.cc
index ff8d58e..cf42891 100644
--- a/src/model/layer/pooling.cc
+++ b/src/model/layer/pooling.cc
@@ -173,7 +173,7 @@ void Pooling::ForwardMaxPooling(const float* bottom, const int num,
               const int index = h * width + w;
               if (bottom[index] > top[top_index]) {
                 top[top_index] = bottom[index];
-                mask[top_index] = index;
+                mask[top_index] = (float) index;
               }
             }
           }

http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/d0317a75/src/model/optimizer/local_all_reduce.cc
----------------------------------------------------------------------
diff --git a/src/model/optimizer/local_all_reduce.cc b/src/model/optimizer/local_all_reduce.cc
index 9cda321..e496efa 100644
--- a/src/model/optimizer/local_all_reduce.cc
+++ b/src/model/optimizer/local_all_reduce.cc
@@ -15,6 +15,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+#include "singa/singa_config.h"
+
 #ifndef DISABLE_WARNINGS
 
 #ifndef SRC_MODEL_OPTIMIZER_LOCAL_ALL_REDUCE_H_


Mime
View raw message