It works for debugging. Perhaps your argument is that the single-threaded version will be slower due to unnecessary locking. My response is that, if you care about performance, then you shouldn't be running single-theaded.
Wrapping every lock in an if statement is arguably worse than wrapping them in ifdefs, especially due to the RAII nature of boost locks. So compile-time does a better job at meeting a goal that I don't buy into. On 09/22/11 10:31, Miles Osborne wrote: > that doesn't work, as all of the locking code etc would still be invoked. > > you really want something like > > --threads 0 > > which should bypass everything and truly run in single threaded mode > > Miles > > On 22 September 2011 10:26, Kenneth Heafield <[email protected]> wrote: >> -threads 1 ? >> >> On 09/22/11 10:06, Tom Hoar wrote: >> >> Re: the survey. I suggest if multi-threading is always enabled, there should >> be a command-line option that allows users to disable multi-threading for >> debugging. >> >> Tom >> >> >> >> On Thu, 22 Sep 2011 09:56:57 +0100, Kenneth Heafield <[email protected]> >> wrote: >> >> My fault. Sorry. Fixed. >> >> On 09/22/11 09:41, Hieu Hoang wrote: >> >> hiya >> >> There's currently a compile error in trunk when multi-threading is enabled. >> However, I think the root cause of the problem is that there's currently too >> many compile flags so developers can't test the different combinations. >> Specifically, the boost library and multi-threading options. >> >> I've made a little poll to to see if people want to make Boost library a >> prerequisite, and threading always turned on: >> http://www.doodle.com/g7tgw778m9mp7dvw >> >> The poll also asks if you're willing to chip in and help out whichever way >> you vote. >> >> Having Boost only as an option makes it difficult to develop in Moses and >> makes it error prone, as we see with the compile error. >> >> Mandating Boost may mean some people have to install the correct Boost >> version on their machine. There may be Boost questions on this mailing list >> as a result. >> >> Hieu >> >> ps. the compile error is >> >> /bin/sh ../../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. >> -I../.. -W -Wall -ffor-scope -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -pthread >> -DTRACE_ENABLE=1 -DWITH_THREADS -I/home/s0565741/workspace/srilm/include >> -I/home/s0565741/workspace/sourceforge/trunk/kenlm -g -O2 -MT >> AlignmentInfo.lo -MD -MP -MF .deps/AlignmentInfo.Tpo -c -o AlignmentInfo.lo >> AlignmentInfo.cpp >> libtool: compile: g++ -DHAVE_CONFIG_H -I. -I../.. -W -Wall -ffor-scope >> -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -pthread -DTRACE_ENABLE=1 >> -DWITH_THREADS -I/home/s0565741/workspace/srilm/include >> -I/home/s0565741/workspace/sourceforge/trunk/kenlm -g -O2 -MT >> AlignmentInfo.lo -MD -MP -MF .deps/AlignmentInfo.Tpo -c AlignmentInfo.cpp -o >> AlignmentInfo.o >> In file included from StaticData.h:41:0, >> from AlignmentInfo.cpp:23: >> FactorCollection.h: In member function \u2018bool >> Moses::FactorCollection::EqualsFactor::operator()(const Moses::Factor&, >> const Moses::FactorFriend&) const\u2019: >> FactorCollection.h:80:19: error: \u2018const class Moses::Factor\u2019 has >> no member named \u2018in\u2019 >> make[3]: *** [AlignmentInfo.lo] Error 1 >> make[3]: Leaving directory >> `/disk1/hieu/workspace/sourceforge/trunk/moses/src' >> make[2]: *** [all] Error 2 >> make[2]: Leaving directory >> `/disk1/hieu/workspace/sourceforge/trunk/moses/src' >> make[1]: *** [all-recursive] Error 1 >> make[1]: Leaving directory `/disk1/hieu/workspace/sourceforge/trunk' >> make: *** [all] Error 2 >> >> _______________________________________________ Moses-support mailing list >> [email protected] http://mailman.mit.edu/mailman/listinfo/moses-support >> >> _______________________________________________ >> Moses-support mailing list >> [email protected] >> http://mailman.mit.edu/mailman/listinfo/moses-support >> >> >> _______________________________________________ >> Moses-support mailing list >> [email protected] >> http://mailman.mit.edu/mailman/listinfo/moses-support >> >> > > _______________________________________________ Moses-support mailing list [email protected] http://mailman.mit.edu/mailman/listinfo/moses-support
