Index: Makefile --- Makefile.orig 2016-12-26 19:55:30.000000000 +0100 +++ Makefile 2016-12-26 23:38:47.939020000 +0100 @@ -88,9 +88,9 @@ INCLUDEPATH:= $(addprefix $(SOURCEDIR)/, Common/Include CNTKv2LibraryDll CNTKv2LibraryDll/API CNTKv2LibraryDll/proto Math CNTK ActionsLib ComputationNetworkLib SGDLib SequenceTrainingLib CNTK/BrainScript Readers/ReaderLib) INCLUDEPATH+=$(PROTOBUF_PATH)/include # COMMON_FLAGS include settings that are passed both to NVCC and C++ compilers. -COMMON_FLAGS:= -D_POSIX_SOURCE -D_XOPEN_SOURCE=600 -D__USE_XOPEN2K -std=c++11 +COMMON_FLAGS:= -std=c++11 CPPFLAGS:= -CXXFLAGS:= $(SSE_FLAGS) -std=c++0x -fopenmp -fpermissive -fPIC -Werror -fcheck-new +CXXFLAGS:= $(SSE_FLAGS) -std=c++0x -fopenmp -fpermissive -fPIC -fcheck-new LIBPATH:= LIBS_LIST:= LDFLAGS:= @@ -178,7 +178,7 @@ ifeq ("$(MATHLIB)","openblas") INCLUDEPATH += $(OPENBLAS_PATH)/include LIBPATH += $(OPENBLAS_PATH)/lib - LIBS_LIST += openblas m pthread + LIBS_LIST += openblas gfortran quadmath m pthread CPPFLAGS += -DUSE_OPENBLAS endif @@ -237,10 +237,10 @@ GENCODE_FLAGS := $(GENCODE_SM30) $(GENCODE_SM35) $(GENCODE_SM50) endif - CXXFLAGS += -g -O4 + CXXFLAGS += -O2 LDFLAGS += -rdynamic COMMON_FLAGS += -DNDEBUG -DNO_SYNC - CUFLAGS += -O3 -g -use_fast_math $(GENCODE_FLAGS) + CUFLAGS += -O2 -use_fast_math $(GENCODE_FLAGS) endif ifdef CNTK_CUDA_DEVICE_DEBUGINFO @@ -981,7 +981,7 @@ UNITTEST_MULTIVERSO := $(BINDIR)/multiversotests -ALL += $(UNITTEST_MULTIVERSO) +ALL += $(UNITTEST_MULTIVERSO): $(UNITTEST_MULTIVERSO_OBJ) | $(MULTIVERSO_LIB) @echo $(SEPARATOR) @@ -1057,7 +1057,7 @@ UNITTEST_EVAL := $(BINDIR)/evaltests -ALL += $(UNITTEST_EVAL) +ALL += SRC += $(UNITTEST_EVAL_SRC) $(UNITTEST_EVAL) : $(UNITTEST_EVAL_OBJ) | $(EVAL_LIB) $(CNTKMATH_LIB) @@ -1083,7 +1083,7 @@ UNITTEST_READER := $(BINDIR)/readertests -ALL += $(UNITTEST_READER) +ALL += SRC += $(UNITTEST_READER_SRC) $(UNITTEST_READER): $(UNITTEST_READER_OBJ) | $(HTKMLFREADER) $(HTKDESERIALIZERS) $(UCIFASTREADER) $(COMPOSITEDATAREADER) $(IMAGEREADER) $(CNTKMATH_LIB) @@ -1122,7 +1122,7 @@ UNITTEST_NETWORK := $(BINDIR)/networktests -ALL += $(UNITTEST_NETWORK) +ALL += SRC += $(UNITTEST_NETWORK_SRC) $(UNITTEST_NETWORK): $(UNITTEST_NETWORK_OBJ) | $(CNTKMATH_LIB) $(CNTKTEXTFORMATREADER) $(MULTIVERSO_LIB) @@ -1157,7 +1157,7 @@ UNITTEST_MATH := $(BINDIR)/mathtests -ALL += $(UNITTEST_MATH) +ALL += SRC += $(UNITTEST_MATH_SRC) $(UNITTEST_MATH): $(UNITTEST_MATH_OBJ) | $(CNTKMATH_LIB) @@ -1180,7 +1180,7 @@ UNITTEST_BRAINSCRIPT := $(BINDIR)/brainscripttests -ALL += $(UNITTEST_BRAINSCRIPT) +ALL += SRC += $(UNITTEST_BRAINSCRIPT_SRC) $(UNITTEST_BRAINSCRIPT): $(UNITTEST_BRAINSCRIPT_OBJ) | $(CNTKMATH_LIB) Index: Source/Common/File.cpp --- Source/Common/File.cpp.orig 2016-12-26 19:55:30.000000000 +0100 +++ Source/Common/File.cpp 2016-12-26 23:37:41.818954000 +0100 @@ -23,7 +23,7 @@ #endif #ifdef __unix__ #include -#include // for PATH_MAX +#include // for PATH_MAX #endif #define PCLOSE_ERROR -1 Index: Source/Common/Include/Basics.h --- Source/Common/Include/Basics.h.orig 2016-12-26 19:55:30.000000000 +0100 +++ Source/Common/Include/Basics.h 2016-12-26 23:37:41.819165000 +0100 @@ -461,10 +461,10 @@ static inline double todouble(const std::string& s) { double value = 0.0; + char *endptr; - size_t* idx = 0; - value = std::stod(s, idx); - if (idx) + value = strtod(s.c_str(), &endptr); + if (endptr == s.c_str()) RuntimeError("todouble: invalid input string '%s'", s.c_str()); return value; Index: Source/Common/Include/TensorShape.h --- Source/Common/Include/TensorShape.h.orig 2016-12-26 19:55:30.000000000 +0100 +++ Source/Common/Include/TensorShape.h 2016-12-26 23:37:41.819378000 +0100 @@ -13,6 +13,14 @@ #include #include +#include + +template std::string my_to_string(const T& n) { + std::ostringstream stm; + stm << n; + return stm.str(); +} + namespace Microsoft { namespace MSR { namespace CNTK { // ----------------------------------------------------------------------- @@ -722,7 +730,7 @@ { if (!s.empty()) s.append(" x "); - s.append(std::to_string(m_dims[k])); + s.append(my_to_string(m_dims[k])); } #if 0 // also emit the strides, easier for debugging s.append(" {"); Index: Source/Common/Include/TimerUtility.h --- Source/Common/Include/TimerUtility.h.orig 2016-12-26 19:55:30.000000000 +0100 +++ Source/Common/Include/TimerUtility.h 2016-12-26 23:37:41.819500000 +0100 @@ -1,5 +1,6 @@ #pragma once +#include #include #define MILLI_PER_SEC 1000 Index: Source/Common/Include/ssematrix.h --- Source/Common/Include/ssematrix.h.orig 2016-12-26 19:55:31.000000000 +0100 +++ Source/Common/Include/ssematrix.h 2016-12-26 23:37:41.819825000 +0100 @@ -21,7 +21,7 @@ #endif #include "fileutil.h" // for saving and reading matrices #include // for NaN -#include +#include #ifdef min #undef min // some garbage from some Windows header that conflicts with std::min() Index: Source/Math/BlockHandlerAVX.cpp --- Source/Math/BlockHandlerAVX.cpp.orig 2016-12-26 19:55:31.000000000 +0100 +++ Source/Math/BlockHandlerAVX.cpp 2016-12-26 23:37:41.819959000 +0100 @@ -3,7 +3,7 @@ // Licensed under the MIT license. See LICENSE.md file in the project root for full licence information. // #include "stdafx.h" -#include +#include #include #include #include Index: Source/Math/BlockMultiplier.h --- Source/Math/BlockMultiplier.h.orig 2016-12-26 19:55:31.000000000 +0100 +++ Source/Math/BlockMultiplier.h 2016-12-26 23:37:41.820218000 +0100 @@ -4,7 +4,7 @@ // #pragma once #include "BlockMultiplierPlatform.h" -#include +#include #include #include #include Index: Source/Readers/ImageReader/ImageDataDeserializer.cpp --- Source/Readers/ImageReader/ImageDataDeserializer.cpp.orig 2016-12-26 19:55:31.000000000 +0100 +++ Source/Readers/ImageReader/ImageDataDeserializer.cpp 2016-12-26 23:37:41.820542000 +0100 @@ -277,7 +277,7 @@ // Assume that only image path and class label is given (old format). classId = imagePath; imagePath = sequenceKey; - sequenceKey = std::to_string(lineIndex); + sequenceKey = my_to_string(lineIndex); if (classId.empty() || imagePath.empty()) RuntimeError("Invalid map file format, must contain 2 or 3 tab-delimited columns, line %" PRIu64 " in file %s.", lineIndex, mapPath.c_str()); Index: Source/Readers/Kaldi2Reader/ssematrix.h --- Source/Readers/Kaldi2Reader/ssematrix.h.orig 2016-12-26 19:55:31.000000000 +0100 +++ Source/Readers/Kaldi2Reader/ssematrix.h 2016-12-26 23:37:41.820862000 +0100 @@ -19,7 +19,7 @@ #endif #include "fileutil.h" // for saving and reading matrices #include // for NaN -#include +#include namespace msra { namespace math { Index: Source/Readers/LMSequenceReader/SequenceReader.cpp --- Source/Readers/LMSequenceReader/SequenceReader.cpp.orig 2016-12-26 19:55:31.000000000 +0100 +++ Source/Readers/LMSequenceReader/SequenceReader.cpp 2016-12-26 23:37:41.821208000 +0100 @@ -634,10 +634,10 @@ tokens = msra::strfun::split(line, "\t "); assert(tokens.size() == 4); - b = stoi(tokens[0]); - cnt = (size_t) stof(tokens[1]); + b = strtol(tokens[0].c_str(), NULL, 10); + cnt = (size_t) strtof(tokens[1].c_str(), NULL); strtmp = tokens[2]; - clsidx = stoi(tokens[3]); + clsidx = strtol(tokens[3].c_str(), NULL, 10); idx4cnt[b] = cnt; word4idx[strtmp] = b; Index: Source/Readers/ReaderLib/TruncatedBpttPacker.cpp --- Source/Readers/ReaderLib/TruncatedBpttPacker.cpp.orig 2016-12-26 19:55:31.000000000 +0100 +++ Source/Readers/ReaderLib/TruncatedBpttPacker.cpp 2016-12-26 23:37:41.821374000 +0100 @@ -8,6 +8,7 @@ #include #include +#include #include "TruncatedBpttPacker.h" #include "ElementTypeUtils.h" Index: Source/SGDLib/SGD.cpp --- Source/SGDLib/SGD.cpp.orig 2016-12-26 19:55:31.000000000 +0100 +++ Source/SGDLib/SGD.cpp 2016-12-26 23:37:41.821863000 +0100 @@ -1385,7 +1385,7 @@ prefixMsg.c_str(), epochNumber + 1, (int)m_maxEpochs, (int)(numMBsRunSinceLastLogged + 1), numMBsRun); if (epochNumber > 0 || (int)epochSize > 0) // got anything? --TODO: why cast epochSize to (int) for this comparison? - fprintf(stderr, (", %2." + to_string(mbProgNumPrecision) + "f%%").c_str(), mbProg * 100); // --TODO: use a * format? + fprintf(stderr, (", %2." + my_to_string(mbProgNumPrecision) + "f%%").c_str(), mbProg * 100); // --TODO: use a * format? fprintf(stderr, "]: "); epochCriterionSinceLastLogged.LogCriterion(criterionNodes[0]->NodeName()); for (size_t i = 0; i < epochEvalErrors.size(); i++) Index: Tools/generate_build_info --- Tools/generate_build_info.orig 2016-12-26 19:55:32.000000000 +0100 +++ Tools/generate_build_info 2016-12-26 23:37:41.822004000 +0100 @@ -107,11 +107,10 @@ config=$1 # Check whether we have git and what is the SHA-1 value -if Has_Git; then has_git=1; else has_git=0; usage "git does not exist"; fi -GIT_STATUS=' (modified)' -git diff --quiet && git diff --cached --quiet && GIT_STATUS='' -GIT_COMMIT=`git rev-parse HEAD`$GIT_STATUS -GIT_BRANCH=`git rev-parse --abbrev-ref HEAD` +has_git=0 +GIT_STATUS='' +GIT_COMMIT="0000" +GIT_BRANCH="master" # Looking into Config.make if [ ! -e $config ] ; then Index: configure --- configure.orig 2016-12-26 19:55:34.000000000 +0100 +++ configure 2016-12-26 23:37:41.822213000 +0100 @@ -1064,7 +1064,7 @@ # If we are not in the configure directory, generate a trampoline Makefile makefile=$build_top/Makefile -if test $(is_hardlinked "$configure" "$build_top/configure") = no +if false then echo Generating $makefile realconf=`readlink -f $configure` Index: Source/PerformanceProfilerDll/PerformanceProfiler.cpp --- Source/PerformanceProfilerDll/PerformanceProfiler.cpp.orig 2017-01-01 10:58:55.000000000 +0100 +++ Source/PerformanceProfilerDll/PerformanceProfiler.cpp 2017-01-01 11:10:31.383503000 +0100 @@ -381,8 +381,10 @@ { #ifdef _WIN32 return (unsigned int)GetCurrentThreadId(); -#else +#elif defined(SYS_gettid) return (unsigned int)syscall(SYS_gettid); +#else + return (unsigned int)0; #endif }