Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Koehn <phi@jhu.edu>2016-05-27 12:39:42 +0300
committerPhilipp Koehn <phi@jhu.edu>2016-05-27 12:39:42 +0300
commitc11a533f146554a14571e1e21d6f0dd25c61b963 (patch)
tree20a6863b52f91452c39e055f9971d29133502022 /moses/Search.cpp
parent65810a38622269e391bbad30ee0c232430e4c008 (diff)
added segment level time out
Diffstat (limited to 'moses/Search.cpp')
-rw-r--r--moses/Search.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/moses/Search.cpp b/moses/Search.cpp
index 2d8c74b5f..33a4cab49 100644
--- a/moses/Search.cpp
+++ b/moses/Search.cpp
@@ -17,19 +17,27 @@ Search::Search(Manager& manager)
, interrupted_flag(0)
{
m_initialTransOpt.SetInputPath(m_inputPath);
+ m_timer.start();
}
-
bool
Search::
out_of_time()
{
int const& timelimit = m_options.search.timeout;
- if (!timelimit) return false;
- double elapsed_time = GetUserTime();
- if (elapsed_time <= timelimit) return false;
- VERBOSE(1,"Decoding is out of time (" << elapsed_time << ","
- << timelimit << ")" << std::endl);
+ if (timelimit > 0) {
+ double elapsed_time = GetUserTime();
+ if (elapsed_time <= timelimit) return false;
+ VERBOSE(1,"Decoding is out of time (" << elapsed_time << ","
+ << timelimit << ")" << std::endl);
+ }
+ int const& segment_timelimit = m_options.search.segment_timeout;
+ if (segment_timelimit > 0) {
+ double elapsed_time = m_timer.get_elapsed_time();
+ if (elapsed_time <= segment_timelimit) return false;
+ VERBOSE(1,"Decoding for segment is out of time (" << elapsed_time << ","
+ << segment_timelimit << ")" << std::endl);
+ }
interrupted_flag = 1;
return true;
}