diff options
author | phikoehn <pkoehn@inf.ed.ac.uk> | 2014-01-05 06:26:47 +0400 |
---|---|---|
committer | phikoehn <pkoehn@inf.ed.ac.uk> | 2014-01-05 06:26:47 +0400 |
commit | 6c34ff207fc9d431c190ab98aa09164e8f68af1c (patch) | |
tree | 4edcddd8bb54988a8cef4fb95c51c7de8b3dad42 /moses-cmd/Main.cpp | |
parent | 6846089089500852e94e6cf3dbd9894aa2bd1ee0 (diff) |
additional time reporting and stardardization
Diffstat (limited to 'moses-cmd/Main.cpp')
-rw-r--r-- | moses-cmd/Main.cpp | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/moses-cmd/Main.cpp b/moses-cmd/Main.cpp index 42d6a4e25..02620b8fd 100644 --- a/moses-cmd/Main.cpp +++ b/moses-cmd/Main.cpp @@ -109,16 +109,17 @@ public: /** Translate one sentence * gets called by main function implemented at end of this source file */ void Run() { + Timer translationTime; + translationTime.start(); // report thread number #if defined(WITH_THREADS) && defined(BOOST_HAS_PTHREADS) TRACE_ERR("Translating line " << m_lineNumber << " in thread id " << pthread_self() << std::endl); #endif - Timer translationTime; - translationTime.start(); // shorthand for "global data" const StaticData &staticData = StaticData::Instance(); + // input sentence Sentence sentence; @@ -128,6 +129,10 @@ public: Manager manager(m_lineNumber, *m_source,staticData.GetSearchAlgorithm()); manager.ProcessSentence(); + // we are done with search, let's look what we got + Timer additionalReportingTime; + additionalReportingTime.start(); + // output word graph if (m_wordGraphCollector) { ostringstream out; @@ -266,6 +271,7 @@ public: delete file; } } + additionalReportingTime.stop(); // apply decision rule and output best translation(s) if (m_outputCollector) { @@ -275,9 +281,14 @@ public: // all derivations - send them to debug stream if (staticData.PrintAllDerivations()) { + additionalReportingTime.start(); manager.PrintAllDerivations(m_lineNumber, debug); + additionalReportingTime.stop(); } + Timer decisionRuleTime; + decisionRuleTime.start(); + // MAP decoding: best hypothesis const Hypothesis* bestHypo = NULL; if (!staticData.UseMBR()) { @@ -379,8 +390,13 @@ public: // report best translation to output collector m_outputCollector->Write(m_lineNumber,out.str(),debug.str()); + + decisionRuleTime.stop(); + VERBOSE(1, "Line " << m_lineNumber << ": Decision rule took " << decisionRuleTime << " seconds total" << endl); } + additionalReportingTime.start(); + // output n-best list if (m_nbestCollector && !staticData.UseLatticeMBR()) { TrellisPathList nBestList; @@ -421,12 +437,12 @@ public: } // report additional statistics + manager.CalcDecoderStatistics(); + VERBOSE(1, "Line " << m_lineNumber << ": Additional reporting took " << additionalReportingTime << " seconds total" << endl); + VERBOSE(1, "Line " << m_lineNumber << ": Translation took " << translationTime << " seconds total" << endl); IFVERBOSE(2) { PrintUserTime("Sentence Decoding Time:"); } - manager.CalcDecoderStatistics(); - - VERBOSE(1, "Line " << m_lineNumber << ": Translation took " << translationTime << " seconds total" << endl); } ~TranslationTask() { @@ -466,7 +482,6 @@ static void ShowWeights() { //TODO: Find a way of ensuring this order is synced with the nbest fix(cout,6); - const StaticData& staticData = StaticData::Instance(); const vector<const StatelessFeatureFunction*>& slf = StatelessFeatureFunction::GetStatelessFeatureFunctions(); const vector<const StatefulFeatureFunction*>& sff = StatefulFeatureFunction::GetStatefulFeatureFunctions(); @@ -512,7 +527,6 @@ void OutputFeatureWeightsForHypergraph(std::ostream &outputSearchGraphStream) outputSearchGraphStream.setf(std::ios::fixed); outputSearchGraphStream.precision(6); - const StaticData& staticData = StaticData::Instance(); const vector<const StatelessFeatureFunction*>& slf =StatelessFeatureFunction::GetStatelessFeatureFunctions(); const vector<const StatefulFeatureFunction*>& sff = StatefulFeatureFunction::GetStatefulFeatureFunctions(); size_t featureIndex = 1; |