diff --git a/MachineLearning/CNTK/CNTK.cpp b/MachineLearning/CNTK/CNTK.cpp index 1ec502ebf8e2..e8376f43e3f4 100644 --- a/MachineLearning/CNTK/CNTK.cpp +++ b/MachineLearning/CNTK/CNTK.cpp @@ -58,40 +58,6 @@ using namespace std; using namespace Microsoft::MSR; using namespace Microsoft::MSR::CNTK; -// The following section is to explicitly disable some legacy usage to avoid implicit configuration errors - -void DisableLegcyTruncationSettings(const ConfigParameters& TopLevelConfig, const ConfigParameters& commandConfig) -{ - if (TopLevelConfig.ExistsCurrent("Truncated")) - { - return; - } - - // if any of the action has set a reader/SGD section and has different Truncated value for reader and SGD section - ConfigArray actions = commandConfig("action"); - for (size_t i = 0; i < actions.size(); i++) - { - if (actions[i] == "train" || actions[i] == "trainRNN") - { - - ConfigParameters sgd = ConfigParameters(commandConfig("SGD")); - ConfigParameters reader = ConfigParameters(commandConfig("reader")); - // reader and SGD sections are two must-have sections in train/trainRNN - if (reader.ExistsCurrent("Truncated") && !sgd.ExistsCurrent("Truncated")) - { - InvalidArgument("DisableLegacyUsage: setting Truncated only in reader section are not allowed. Please move Truncated=true/false to the top level section."); - } - } - } -} -void DisableLegacyUsage(const ConfigParameters& TopLevelConfig, const ConfigArray& commands) -{ - for (size_t i = 0; i < commands.size(); i++) - { - ConfigParameters cfgParameters(TopLevelConfig(commands[i])); - DisableLegcyTruncationSettings(TopLevelConfig, cfgParameters); - } -} // internal test routine forward declaration template void TestCn(const ConfigParameters& config); @@ -1324,6 +1290,40 @@ size_t GetMaxEpochs(const ConfigParameters& configParams) return maxEpochs; } +// special temporary function to guard against a now invalid usage of "truncated" which exists in some IPG production setups +static void DisableLegacyTruncationSettings(const ConfigParameters& TopLevelConfig, const ConfigParameters& commandConfig) +{ + if (TopLevelConfig.ExistsCurrent("Truncated")) + { + return; + } + + // if any of the action has set a reader/SGD section and has different Truncated value for reader and SGD section + ConfigArray actions = commandConfig("action"); + for (size_t i = 0; i < actions.size(); i++) + { + if (actions[i] == "train" || actions[i] == "trainRNN") + { + + ConfigParameters sgd = ConfigParameters(commandConfig("SGD")); + ConfigParameters reader = ConfigParameters(commandConfig("reader")); + // reader and SGD sections are two must-have sections in train/trainRNN + if (reader.ExistsCurrent("Truncated") && !sgd.ExistsCurrent("Truncated")) + { + InvalidArgument("DisableLegacyUsage: setting Truncated only in reader section are not allowed. Please move Truncated=true/false to the top level section."); + } + } + } +} +static void DisableLegacyUsage(const ConfigParameters& TopLevelConfig, const ConfigArray& commands) +{ + for (size_t i = 0; i < commands.size(); i++) + { + ConfigParameters cfgParameters(TopLevelConfig(commands[i])); + DisableLegacyTruncationSettings(TopLevelConfig, cfgParameters); + } +} + // process the command template void DoCommand(const ConfigParameters& config) @@ -1338,7 +1338,8 @@ void DoCommand(const ConfigParameters& config) std::cerr << "Using " << numCPUThreads << " CPU threads" << endl; } - DisableLegacyUsage(config, command); + // temporary hack to prevent users from failling for a small breaking change related to the "truncated" flag (will be redone bigger and better some day) + DisableLegacyUsage(config, command); // summarize command info upfront in the log and stdout size_t fullTotalMaxEpochs = 0; diff --git a/Makefile b/Makefile index 5a411b15dfd8..04205cfd1f42 100644 --- a/Makefile +++ b/Makefile @@ -54,7 +54,7 @@ endif # The actual compiler/linker flags added can be viewed by running 'mpic++ --showme:compile' and 'mpic++ --showme:link' CXX = mpic++ -INCLUDEPATH:= Common/Include Math/Math MachineLearning/CNTK MachineLearning/CNTKComputationNetworkLib MachineLearning/CNTKSGDLib MachineLearning/CNTKSequenceTrainingLib BrainScript +INCLUDEPATH:= Common/Include Math/Math MachineLearning/CNTK MachineLearning/CNTKActionsLib MachineLearning/CNTKComputationNetworkLib MachineLearning/CNTKSGDLib MachineLearning/CNTKSequenceTrainingLib BrainScript CPPFLAGS:= -D_POSIX_SOURCE -D_XOPEN_SOURCE=600 -D__USE_XOPEN2K CXXFLAGS:= -msse3 -std=c++0x -std=c++11 -fopenmp -fpermissive -fPIC -Werror -fcheck-new LIBPATH:=