Closed ghozn closed 5 years ago
Your platform's read function is broken in that it doesn't accept sizes larger than 2^32. What platform is this on? Smells like OS X.
Can you get this to compile by adding appropriate headers then tell me what it prints?
std::size_t GuardLarge(std::size_t size) {
// The following operating systems have broken read/write/pread/pwrite that
// only supports up to 2^31.
#if defined(_WIN32) || defined(_WIN64) || defined(__APPLE__) || defined(OS_ANDROID)
return std::min(static_cast<std::size_t>(static_cast<unsigned>(-1)), size);
#else
return size;
#endif
}
int main() {
std::cout << GuardLarge(21992807322ULL) << std::endl;
}
Yes, my platform is macOS. And it prints 4294967295.
Did a44136ea76f3f3a89086faaa0a5b78e9283206d7 fix your issue?
It works, thanks!
Hi, I use the command: /Users/admin/fhs/smt-baseline/lazy/lazy-master/bin/decode -i /Users/admin/fhs/smt-baseline/baselines-emnlp2016-master/graph/ --beam 10 --lm /Users/admin/fhs/smt-baseline/baselines-emnlp2016-master/wikilm/wiki.blm -W LanguageModel=1 LanguageModel_OOV=1 WordPenalty=0 --threads 8 but encounter a error: util/file.cc:138 in std::size_t util::PartialRead(int, void *, std::size_t) threw FDException because `ret < 0'. Invalid argument in fd 3 while reading 21992807322 bytes File: /Users/admin/fhs/smt-baseline/baselines-emnlp2016-master/wikilm/wiki.blm How can I solve this problem?