mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-09-11 19:27:11 +03:00
re-introduced the initialization and cleaning up into the constructor and destructor of Managers object. And I moved the check for LM cache cleanup into LanguageModelIRST
git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@3202 1f5c12ca-751b-0410-a591-d2e778427230
This commit is contained in:
parent
1a638746f3
commit
1c615ea751
@ -145,7 +145,6 @@ int main(int argc, char* argv[])
|
||||
//cerr << *source << endl;
|
||||
|
||||
MosesChart::Manager manager(*source);
|
||||
StaticData::Instance().InitializeBeforeSentenceProcessing(*source);
|
||||
manager.ProcessSentence();
|
||||
|
||||
assert(!staticData.UseMBR());
|
||||
@ -202,8 +201,7 @@ int main(int argc, char* argv[])
|
||||
|
||||
IFVERBOSE(2) { PrintUserTime("Sentence Decoding Time:"); }
|
||||
|
||||
manager.CalcDecoderStatistics();
|
||||
StaticData::Instance().CleanUpAfterSentenceProcessing(lineCount);
|
||||
manager.CalcDecoderStatistics();
|
||||
} // while(ReadInput
|
||||
|
||||
delete ioWrapper;
|
||||
|
@ -44,13 +44,13 @@ Manager::Manager(InputType const& source)
|
||||
,m_hypoStackColl(source, *this)
|
||||
,m_transOptColl(source, StaticData::Instance().GetDecodeStepVL(source), m_hypoStackColl)
|
||||
{
|
||||
// const StaticData &staticData = StaticData::Instance();
|
||||
// staticData.InitializeBeforeSentenceProcessing(source);
|
||||
const StaticData &staticData = StaticData::Instance();
|
||||
staticData.InitializeBeforeSentenceProcessing(source);
|
||||
}
|
||||
|
||||
Manager::~Manager()
|
||||
{
|
||||
// StaticData::Instance().CleanUpAfterSentenceProcessing();
|
||||
StaticData::Instance().CleanUpAfterSentenceProcessing();
|
||||
}
|
||||
|
||||
void Manager::ProcessSentence()
|
||||
|
@ -130,7 +130,6 @@ int main(int argc, char* argv[])
|
||||
VERBOSE(2,"\nTRANSLATING(" << lineCount << "): " << *source);
|
||||
|
||||
Manager manager(*source, staticData.GetSearchAlgorithm());
|
||||
StaticData::Instance().InitializeBeforeSentenceProcessing(*source);
|
||||
manager.ProcessSentence();
|
||||
|
||||
|
||||
@ -230,7 +229,6 @@ int main(int argc, char* argv[])
|
||||
IFVERBOSE(2) { PrintUserTime("Sentence Decoding Time:"); }
|
||||
|
||||
manager.CalcDecoderStatistics();
|
||||
StaticData::Instance().CleanUpAfterSentenceProcessing(lineCount);
|
||||
}
|
||||
|
||||
delete ioWrapper;
|
||||
|
@ -215,14 +215,19 @@ float LanguageModelIRST::GetValue(const vector<const Word*> &contextFactor, Stat
|
||||
|
||||
|
||||
void LanguageModelIRST::CleanUpAfterSentenceProcessing(){
|
||||
TRACE_ERR( "reset caches\n");
|
||||
m_lmtb->reset_caches();
|
||||
const StaticData &staticData = StaticData::Instance();
|
||||
static int sentenceCount = 0;
|
||||
sentenceCount++;
|
||||
|
||||
if (staticData.LMCacheCleanup(sentenceCount)){
|
||||
TRACE_ERR( "reset caches\n");
|
||||
m_lmtb->reset_caches();
|
||||
|
||||
#ifndef WIN32
|
||||
TRACE_ERR( "reset mmap\n");
|
||||
m_lmtb->reset_mmap();
|
||||
TRACE_ERR( "reset mmap\n");
|
||||
m_lmtb->reset_mmap();
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void LanguageModelIRST::InitializeBeforeSentenceProcessing(){
|
||||
|
@ -57,8 +57,8 @@ Manager::Manager(InputType const& source, SearchAlgorithm searchAlgorithm)
|
||||
,m_start(clock())
|
||||
,interrupted_flag(0)
|
||||
{
|
||||
// const StaticData &staticData = StaticData::Instance();
|
||||
// staticData.InitializeBeforeSentenceProcessing(source);
|
||||
const StaticData &staticData = StaticData::Instance();
|
||||
staticData.InitializeBeforeSentenceProcessing(source);
|
||||
}
|
||||
|
||||
Manager::~Manager()
|
||||
@ -66,7 +66,7 @@ Manager::~Manager()
|
||||
delete m_transOptColl;
|
||||
delete m_search;
|
||||
|
||||
// StaticData::Instance().CleanUpAfterSentenceProcessing();
|
||||
StaticData::Instance().CleanUpAfterSentenceProcessing();
|
||||
|
||||
clock_t end = clock();
|
||||
float et = (end - m_start);
|
||||
|
Loading…
Reference in New Issue
Block a user