diff options
author | Marcin Junczys-Dowmunt <junczys@amu.edu.pl> | 2012-08-11 03:03:10 +0400 |
---|---|---|
committer | Marcin Junczys-Dowmunt <junczys@amu.edu.pl> | 2012-08-11 03:03:10 +0400 |
commit | ad2d55442877efcbd1874cf539e9df53d3140c34 (patch) | |
tree | aad3ae01aa67ce50cecaad4c0e349c9b104c19c9 /misc | |
parent | e99576aedcc9c8719b8fa685199f2fa66ca28801 (diff) |
Added -threads all
Diffstat (limited to 'misc')
-rw-r--r-- | misc/processLexicalTableMin.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/misc/processLexicalTableMin.cpp b/misc/processLexicalTableMin.cpp index 44474a244..a29e178af 100644 --- a/misc/processLexicalTableMin.cpp +++ b/misc/processLexicalTableMin.cpp @@ -1,6 +1,10 @@ #include <iostream> #include <string> +#ifdef WITH_THREADS +#include <boost/thread/thread.hpp> +#endif + #include "CompactPT/LexicalReorderingTableCreator.h" using namespace Moses; @@ -12,7 +16,7 @@ void printHelp(char **argv) "\t-in string -- input table file name\n" "\t-out string -- prefix of binary table file\n" #ifdef WITH_THREADS - "\t-threads int -- number of threads used for conversion\n" + "\t-threads int|all -- number of threads used for conversion\n" #endif "\n advanced:\n" "\t-landmark int -- use landmark phrase every 2^n phrases\n" @@ -20,7 +24,6 @@ void printHelp(char **argv) "\t-join-scores -- single set of Huffman codes for score components\n" "\t-quantize int -- maximum number of scores per score component\n" "\n" - " For more information see: http://www.statmt.org/moses/?n=Moses.AdvancedFeatures#ntoc6\n\n" " If you use this please cite:\n\n" " @article { junczys_pbml98_2012,\n" @@ -34,7 +37,6 @@ void printHelp(char **argv) " }\n\n" " Acknowledgments: Part of this research was carried out at and funded by\n" " the World Intellectual Property Organization (WIPO) in Geneva.\n\n"; - } int main(int argc, char** argv) @@ -94,7 +96,15 @@ int main(int argc, char** argv) { #ifdef WITH_THREADS ++i; - threads = atoi(argv[i]); + if(std::string(argv[i]) == "all") { + threads = boost::thread::hardware_concurrency(); + if(!threads) { + std::cerr << "Could not determine number of hardware threads, setting to 1" << std::endl; + threads = 1; + } + } + else + threads = atoi(argv[i]); #else std::cerr << "Thread support not compiled in" << std::endl; exit(1); |