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
path: root/misc
diff options
context:
space:
mode:
authorMarcin Junczys-Dowmunt <junczys@amu.edu.pl>2012-08-11 03:03:32 +0400
committerMarcin Junczys-Dowmunt <junczys@amu.edu.pl>2012-08-11 03:03:32 +0400
commit01b9cc36b9c3915f12a506055096b1593c037a90 (patch)
tree40280d11ed3654d196f516a13da704796640eb78 /misc
parentad2d55442877efcbd1874cf539e9df53d3140c34 (diff)
Added -threads all
Diffstat (limited to 'misc')
-rw-r--r--misc/processPhraseTableMin.cpp21
1 files changed, 16 insertions, 5 deletions
diff --git a/misc/processPhraseTableMin.cpp b/misc/processPhraseTableMin.cpp
index e97e7e265..084562562 100644
--- a/misc/processPhraseTableMin.cpp
+++ b/misc/processPhraseTableMin.cpp
@@ -1,4 +1,9 @@
#include <iostream>
+
+#ifdef WITH_THREADS
+#include <boost/thread/thread.hpp>
+#endif
+
#include "TypeDef.h"
#include "CompactPT/PhraseTableCreator.h"
@@ -12,7 +17,7 @@ void printHelp(char **argv) {
"\t-nscores int -- number of score components in phrase table\n"
"\t-alignment-info -- include alignment info in the binary phrase table\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-encoding string -- encoding type: PREnc REnc None (default PREnc)\n"
@@ -24,7 +29,6 @@ void printHelp(char **argv) {
"\t-quantize int -- maximum number of scores per score component\n"
"\t-no-warnings -- suppress warnings about missing alignment data\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"
@@ -38,7 +42,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";
-
}
@@ -124,14 +127,22 @@ int main(int argc, char **argv) {
else if("-threads" == arg && i+1 < argc) {
#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);
#endif
}
else {
- //somethings wrong... print help
+ //something's wrong... print help
printHelp(argv);
return 1;
}