diff options
author | Kenneth Heafield <kheafiel@cluster12.lti.ece.cmu.local> | 2011-05-20 16:19:04 -0400 |
---|---|---|
committer | Kenneth Heafield <kheafiel@cluster12.lti.ece.cmu.local> | 2011-05-20 16:19:04 -0400 |
commit | 461c2670efb0968ccc6789ff0c9ca6f88ab31e80 (patch) | |
tree | 6b344dcf320674213fd449e6a4915236ad78c29f /klm/lm/binary_format.cc | |
parent | 0e7b303879baf95a8167194ad7c75ef738e79f15 (diff) |
kenlm update including being nicer to NFS
Diffstat (limited to 'klm/lm/binary_format.cc')
-rw-r--r-- | klm/lm/binary_format.cc | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/klm/lm/binary_format.cc b/klm/lm/binary_format.cc index 9be0bc8e..34d9ffca 100644 --- a/klm/lm/binary_format.cc +++ b/klm/lm/binary_format.cc @@ -112,6 +112,8 @@ uint8_t *GrowForSearch(const Config &config, std::size_t memory_size, Backing &b void FinishFile(const Config &config, ModelType model_type, const std::vector<uint64_t> &counts, Backing &backing) { if (config.write_mmap) { + if (msync(backing.search.get(), backing.search.size(), MS_SYNC) || msync(backing.vocab.get(), backing.vocab.size(), MS_SYNC)) + UTIL_THROW(util::ErrnoException, "msync failed for " << config.write_mmap); // header and vocab share the same mmap. The header is written here because we know the counts. Parameters params; params.counts = counts; |