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
diff options
context:
space:
mode:
authorHieu Hoang <hieuhoang@gmail.com>2017-01-10 21:39:16 +0300
committerHieu Hoang <hieuhoang@gmail.com>2017-01-10 21:39:16 +0300
commit48f1bac05daee1d78bcb206b4240171a17807344 (patch)
tree383b7ec71f3e3ffaa1ac6c9e21b0448cccb5060d /contrib
parent1603c25babaf7e2464ce747c018aaf688c5baebe (diff)
use ken's read map
Diffstat (limited to 'contrib')
-rw-r--r--contrib/moses2/TranslationModel/ProbingPT/probing_hash_utils.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/contrib/moses2/TranslationModel/ProbingPT/probing_hash_utils.cpp b/contrib/moses2/TranslationModel/ProbingPT/probing_hash_utils.cpp
index c72709d3c..11f01a366 100644
--- a/contrib/moses2/TranslationModel/ProbingPT/probing_hash_utils.cpp
+++ b/contrib/moses2/TranslationModel/ProbingPT/probing_hash_utils.cpp
@@ -1,4 +1,6 @@
+#include <iostream>
#include "probing_hash_utils.hh"
+#include "util/file.hh"
namespace Moses2
{
@@ -6,6 +8,13 @@ namespace Moses2
//Read table from disk, return memory map location
char * readTable(const char * filename, size_t size)
{
+ std::cerr << "filename=" << filename << std::endl;
+ util::scoped_fd file_(util::OpenReadOrThrow(filename));
+ uint64_t total_size_ = util::SizeFile(file_.get());
+
+ util::scoped_memory memory;
+ MapRead(util::LAZY, file_.get(), 0, total_size_, memory);
+
//Initial position of the file is the end of the file, thus we know the size
int fd;
char * map;