Skip to content

Commit

Permalink
Merge pull request #246 from lehmann-4178656ch/indexpath-for-stxxl
Browse files Browse the repository at this point in the history
Move .stxxl file into index directory
  • Loading branch information
niklas88 committed May 9, 2019
2 parents 54cb297 + 85ae833 commit 07187c6
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 6 deletions.
13 changes: 11 additions & 2 deletions src/index/CreatePatternsMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ struct option options[] = {{"help", no_argument, NULL, 'h'},
{"index-basename", required_argument, NULL, 'i'},
{NULL, 0, NULL, 0}};

string getStxxlConfigFileName(const string& location) {
std::ostringstream os;
os << location << ".stxxl";
return os.str();
}

string getStxxlDiskFileName(const string& location, const string& tail) {
std::ostringstream os;
os << location << tail << "-stxxl.disk";
Expand All @@ -39,11 +45,14 @@ string getStxxlDiskFileName(const string& location, const string& tail) {
// Write a .stxxl config-file.
// All we want is sufficient space somewhere with enough space.
// We can use the location of input files and use a constant size for now.
// The required size can only ben estimation anyway, since index size
// The required size can only be estimated anyway, since index size
// depends on the structure of words files rather than their size only,
// because of the "multiplications" performed.
void writeStxxlConfigFile(const string& location, const string& tail) {
ad_utility::File stxxlConfig(".stxxl", "w");
string stxxlConfigFileName = getStxxlConfigFileName(location);
ad_utility::File stxxlConfig(stxxlConfigFileName, "w");
// Inform stxxl about .stxxl location
setenv("STXXLCFG", stxxlConfigFileName.c_str(), true);
std::ostringstream config;
config << "disk=" << getStxxlDiskFileName(location, tail) << ","
<< STXXL_DISK_SIZE_INDEX_BUILDER << ",syscall";
Expand Down
13 changes: 11 additions & 2 deletions src/index/IndexBuilderMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ struct option options[] = {
{"no-compressed-vocabulary", no_argument, NULL, 'N'},
{NULL, 0, NULL, 0}};

string getStxxlConfigFileName(const string& location) {
std::ostringstream os;
os << location << ".stxxl";
return os.str();
}

string getStxxlDiskFileName(const string& location, const string& tail) {
std::ostringstream os;
os << location << tail << "-stxxl.disk";
Expand All @@ -54,11 +60,14 @@ string getStxxlDiskFileName(const string& location, const string& tail) {
// Write a .stxxl config-file.
// All we want is sufficient space somewhere with enough space.
// We can use the location of input files and use a constant size for now.
// The required size can only ben estimation anyway, since index size
// The required size can only be estimated anyway, since index size
// depends on the structure of words files rather than their size only,
// because of the "multiplications" performed.
void writeStxxlConfigFile(const string& location, const string& tail) {
ad_utility::File stxxlConfig(".stxxl", "w");
string stxxlConfigFileName = getStxxlConfigFileName(location);
ad_utility::File stxxlConfig(stxxlConfigFileName, "w");
// Inform stxxl about .stxxl location
setenv("STXXLCFG", stxxlConfigFileName.c_str(), true);
std::ostringstream config;
config << "disk=" << getStxxlDiskFileName(location, tail) << ","
<< STXXL_DISK_SIZE_INDEX_BUILDER << ",syscall";
Expand Down
13 changes: 11 additions & 2 deletions test/IndexTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
#include "../src/global/Pattern.h"
#include "../src/index/Index.h"

string getStxxlConfigFileName(const string& location) {
std::ostringstream os;
os << location << ".stxxl";
return os.str();
}

string getStxxlDiskFileName(const string& location, const string& tail) {
std::ostringstream os;
os << location << tail << "-stxxl.disk";
Expand All @@ -17,11 +23,14 @@ string getStxxlDiskFileName(const string& location, const string& tail) {
// Write a .stxxl config-file.
// All we want is sufficient space somewhere with enough space.
// We can use the location of input files and use a constant size for now.
// The required size can only ben estimation anyway, since index size
// The required size can only be estimated anyway, since index size
// depends on the structure of words files rather than their size only,
// because of the "multiplications" performed.
void writeStxxlConfigFile(const string& location, const string& tail) {
ad_utility::File stxxlConfig(".stxxl", "w");
string stxxlConfigFileName = getStxxlConfigFileName(location);
ad_utility::File stxxlConfig(stxxlConfigFileName, "w");
// Inform stxxl about .stxxl location
setenv("STXXLCFG", stxxlConfigFileName.c_str(), true);
std::ostringstream config;
config << "disk=" << getStxxlDiskFileName(location, tail) << ","
<< STXXL_DISK_SIZE_INDEX_TEST << ",syscall";
Expand Down

0 comments on commit 07187c6

Please sign in to comment.