You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@singa.apache.org by wa...@apache.org on 2016/10/10 15:46:11 UTC
[5/8] incubator-singa git commit: SINGA-247 Add windows support for
singa.
SINGA-247 Add windows support for singa.
Fix an error on max function and a warning due to improper conversion.
Link the static libs to the test target.
Project: http://git-wip-us.apache.org/repos/asf/incubator-singa/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-singa/commit/af30903f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-singa/tree/af30903f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-singa/diff/af30903f
Branch: refs/heads/master
Commit: af30903f421984ecb64a816138ab6a601ba060d7
Parents: 37d3b39
Author: xiezl <xi...@comp.nus.edu.sg>
Authored: Thu Sep 22 17:26:52 2016 +0800
Committer: Wei Wang <wa...@comp.nus.edu.sg>
Committed: Mon Oct 10 17:44:53 2016 +0800
----------------------------------------------------------------------
src/CMakeLists.txt | 2 +-
src/core/tensor/tensor_math_cpp.h | 4 ++--
src/io/binfile_reader.cc | 2 +-
test/CMakeLists.txt | 4 ++--
4 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/af30903f/src/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 6704960..7493ffb 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -92,7 +92,7 @@ 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})
+TARGET_LINK_LIBRARIES(singa_static ${SINGA_LINKER_LIBS})
#pass configure infor to swig
FILE(REMOVE "${CMAKE_CURRENT_SOURCE_DIR}/api/config.i")
http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/af30903f/src/core/tensor/tensor_math_cpp.h
----------------------------------------------------------------------
diff --git a/src/core/tensor/tensor_math_cpp.h b/src/core/tensor/tensor_math_cpp.h
index e978e8e..edae209 100644
--- a/src/core/tensor/tensor_math_cpp.h
+++ b/src/core/tensor/tensor_math_cpp.h
@@ -570,7 +570,7 @@ void ComputeCrossEntropy<float, lang::Cpp>(const size_t batchsize,
int truth_idx = tPtr[i];
CHECK_GE(truth_idx, 0);
float prob_of_truth = pPtr[i * dim + truth_idx];
- lossPtr[i] = -std::log(std::max(prob_of_truth, FLT_MIN));
+ lossPtr[i] = -std::log((std::max)(prob_of_truth, FLT_MIN));
}
}
@@ -600,7 +600,7 @@ void RowMax<float, lang::Cpp>(const size_t nrow, const size_t ncol,
int offset = (int)(r * ncol);
float maxval = inPtr[offset];
for (size_t c = 1; c < ncol; c++)
- maxval = std::max(maxval, inPtr[offset + c]);
+ maxval = (std::max)(maxval, inPtr[offset + c]);
outPtr[r] = maxval;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/af30903f/src/io/binfile_reader.cc
----------------------------------------------------------------------
diff --git a/src/io/binfile_reader.cc b/src/io/binfile_reader.cc
index 9167451..a6081e3 100644
--- a/src/io/binfile_reader.cc
+++ b/src/io/binfile_reader.cc
@@ -105,7 +105,7 @@ bool BinFileReader::ReadField(std::string* content) {
content->clear();
int ssize = sizeof(size_t);
if (!PrepareNextField(ssize)) return false;
- int len = *reinterpret_cast<size_t*>(buf_ + offset_);
+ int len = *reinterpret_cast<int*>(buf_ + offset_);
offset_ += ssize;
if (!PrepareNextField(len)) return false;
content->reserve(len);
http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/af30903f/test/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index e1487d2..a996413 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -31,9 +31,9 @@ AUX_SOURCE_DIRECTORY(singa singa_test_source)
LIST(REMOVE_ITEM singa_test_source "singa/test_ep.cc")
ADD_EXECUTABLE(test_singa "gtest/gtest_main.cc" ${singa_test_source})
-ADD_DEPENDENCIES(test_singa singa)
+ADD_DEPENDENCIES(test_singa singa_static)
#MESSAGE(STATUS "link libs" ${singa_linker_libs})
-TARGET_LINK_LIBRARIES(test_singa gtest singa ${SINGA_LINKER_LIBS})
+TARGET_LINK_LIBRARIES(test_singa gtest singa_static ${SINGA_LINKER_LIBS})
IF(UNIX AND (NOT APPLE))
LIST(APPEND LINK_FLAGS "-pthread")
ENDIF()