diff options
author | heafield <heafield@1f5c12ca-751b-0410-a591-d2e778427230> | 2011-09-23 02:29:56 +0400 |
---|---|---|
committer | heafield <heafield@1f5c12ca-751b-0410-a591-d2e778427230> | 2011-09-23 02:29:56 +0400 |
commit | 19879a8b1ea6533e2a0b66e9c3e67f2ccd9d49af (patch) | |
tree | 178377fd00bada17a6b6dc2c7c27f30ecc223922 /moses-chart-cmd | |
parent | ddbfee788c092a00dbeac4c71959aa84f64d3813 (diff) |
-threads all option
git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@4252 1f5c12ca-751b-0410-a591-d2e778427230
Diffstat (limited to 'moses-chart-cmd')
-rw-r--r-- | moses-chart-cmd/src/Main.cpp | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/moses-chart-cmd/src/Main.cpp b/moses-chart-cmd/src/Main.cpp index 7032bf849..b99b0d983 100644 --- a/moses-chart-cmd/src/Main.cpp +++ b/moses-chart-cmd/src/Main.cpp @@ -217,24 +217,6 @@ int main(int argc, char* argv[]) return EXIT_FAILURE; } - // create threadpool, if necessary - int threadcount = (parameter.GetParam("threads").size() > 0) ? - Scan<size_t>(parameter.GetParam("threads")[0]) : 1; - -#ifdef WITH_THREADS - if (threadcount < 1) { - cerr << "Error: Need to specify a positive number of threads" << endl; - exit(1); - } - ThreadPool pool(threadcount); -#else - if (threadcount > 1) { - cerr << "Error: Thread count of " << threadcount - << " but moses not built with thread support" << endl; - exit(1); - } -#endif - const StaticData &staticData = StaticData::Instance(); if (!StaticData::LoadDataStatic(¶meter)) return EXIT_FAILURE; @@ -268,6 +250,10 @@ int main(int argc, char* argv[]) if (ioWrapper == NULL) return EXIT_FAILURE; +#ifdef WITH_THREADS + ThreadPool pool(staticData.ThreadCount()); +#endif + // read each sentence & decode InputType *source=0; while(ReadInput(*ioWrapper,staticData.GetInputType(),source)) { |