xcode build supports threads. Abort when using Adam's suffix arrays with threads

This commit is contained in:
Hieu Hoang 2012-05-30 09:49:43 +01:00
parent c85b96a6c6
commit 2b20de8ea9
3 changed files with 23 additions and 2 deletions

View File

@ -307,6 +307,7 @@
LIBRARY_SEARCH_PATHS = (
../../irstlm/lib,
../../srilm/lib/macosx,
/opt/local/lib,
);
OTHER_LDFLAGS = (
"-lz",
@ -316,6 +317,7 @@
"-loolm",
"-lflm",
"-llattice",
"-lboost_thread-mt",
);
PRODUCT_NAME = "moses-chart-cmd";
USER_HEADER_SEARCH_PATHS = "../../ ../../moses/src";
@ -338,6 +340,7 @@
LIBRARY_SEARCH_PATHS = (
../../irstlm/lib,
../../srilm/lib/macosx,
/opt/local/lib,
);
OTHER_LDFLAGS = (
"-lz",
@ -347,6 +350,7 @@
"-loolm",
"-lflm",
"-llattice",
"-lboost_thread-mt",
);
PRODUCT_NAME = "moses-chart-cmd";
USER_HEADER_SEARCH_PATHS = "../../ ../../moses/src";
@ -359,7 +363,10 @@
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = TRACE_ENABLE;
GCC_PREPROCESSOR_DEFINITIONS = (
TRACE_ENABLE,
WITH_THREADS,
);
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = (
@ -378,7 +385,10 @@
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_PREPROCESSOR_DEFINITIONS = TRACE_ENABLE;
GCC_PREPROCESSOR_DEFINITIONS = (
TRACE_ENABLE,
WITH_THREADS,
);
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = (

View File

@ -1357,6 +1357,7 @@
LM_IRST,
"_FILE_OFFSET_BITS=64",
_LARGE_FILES,
WITH_THREADS,
);
HEADER_SEARCH_PATHS = (
../..,
@ -1399,6 +1400,7 @@
LM_IRST,
"_FILE_OFFSET_BITS=64",
_LARGE_FILES,
WITH_THREADS,
);
HEADER_SEARCH_PATHS = (
../..,

View File

@ -13,6 +13,8 @@
#include "RuleTable/Loader.h"
#include "RuleTable/LoaderFactory.h"
#include "TypeDef.h"
#include "StaticData.h"
#include "UserMessage.h"
using namespace std;
@ -27,6 +29,13 @@ bool PhraseDictionaryALSuffixArray::Load(const std::vector<FactorType> &input
, const LMList &languageModels
, const WordPenaltyProducer* wpProducer)
{
const StaticData &staticData = StaticData::Instance();
if (staticData.ThreadCount() > 1)
{
UserMessage::Add("Suffix array implementation is not threadsafe");
return false;
}
// file path is the directory of the rules for eacg, NOT the file of all the rules
SetFilePath(filePath);
m_tableLimit = tableLimit;