Parameterize amount of RAM for extractLargenetwork. Fixes ticket 21.
This commit is contained in:
parent
417f02d30a
commit
5f711c5e03
@ -120,7 +120,7 @@ struct _SimpleHeapData {
|
||||
_SimpleHeapData( NodeID p ) : parent(p) { }
|
||||
};
|
||||
|
||||
template < typename NodeID, typename Key, typename Weight, typename Data, typename IndexStorage = SparseTableStorage >
|
||||
template < typename NodeID, typename Key, typename Weight, typename Data, typename IndexStorage = ArrayStorage<NodeID, NodeID> >
|
||||
class BinaryHeap {
|
||||
private:
|
||||
BinaryHeap( const BinaryHeap& right );
|
||||
|
@ -35,6 +35,7 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
||||
|
||||
#include <libxml/xmlreader.h>
|
||||
#include <google/sparse_hash_map>
|
||||
#include <unistd.h>
|
||||
#include <stxxl.h>
|
||||
|
||||
#include "typedefs.h"
|
||||
@ -43,6 +44,10 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
||||
#include "DataStructures/ExtractorStructs.h"
|
||||
#include "DataStructures/PBFParser.h"
|
||||
#include "DataStructures/XMLParser.h"
|
||||
#include "Util/BaseConfiguration.h"
|
||||
#include "Util/InputFileUtil.h"
|
||||
|
||||
typedef BaseConfiguration ExtractorConfiguration;
|
||||
|
||||
unsigned globalRelationCounter = 0;
|
||||
ExtractorCallbacks * extractCallBacks;
|
||||
@ -83,6 +88,21 @@ int main (int argc, char *argv[]) {
|
||||
}
|
||||
std::string adressFileName(outputFileName);
|
||||
|
||||
|
||||
|
||||
unsigned amountOfRAM = 1;
|
||||
unsigned installedRAM = (sysconf(_SC_PHYS_PAGES) * sysconf(_SC_PAGESIZE));
|
||||
if(installedRAM < 2097422336) {
|
||||
std::cout << "[Warning] Machine has less than 2GB RAM." << std::endl;
|
||||
}
|
||||
if(testDataFile("extractor.ini")) {
|
||||
ExtractorConfiguration extractorConfig("extractor.ini");
|
||||
unsigned memoryAmountFromFile = atoi(extractorConfig.GetParameter("Memory").c_str());
|
||||
if( memoryAmountFromFile != 0 && memoryAmountFromFile <= installedRAM/(1024*1024*1024))
|
||||
amountOfRAM = memoryAmountFromFile;
|
||||
std::cout << "[extractor] using " << amountOfRAM << " GB of RAM for buffers" << std::endl;
|
||||
}
|
||||
|
||||
STXXLNodeIDVector usedNodeIDs;
|
||||
STXXLNodeVector allNodes;
|
||||
STXXLEdgeVector allEdges;
|
||||
@ -127,7 +147,7 @@ int main (int argc, char *argv[]) {
|
||||
|
||||
std::cout << "[extractor] parsing finished after " << get_timestamp() - time << "seconds" << std::endl;
|
||||
time = get_timestamp();
|
||||
unsigned memory_to_use = 1024 * 1024 * 1024;
|
||||
unsigned memory_to_use = amountOfRAM * 1024 * 1024 * 1024;
|
||||
|
||||
std::cout << "[extractor] Sorting used nodes ... " << std::flush;
|
||||
stxxl::sort(usedNodeIDs.begin(), usedNodeIDs.end(), Cmp(), memory_to_use);
|
||||
@ -165,7 +185,7 @@ int main (int argc, char *argv[]) {
|
||||
fout.write((char*)&(nodesIT->id), sizeof(unsigned));
|
||||
fout.write((char*)&(nodesIT->lon), sizeof(int));
|
||||
fout.write((char*)&(nodesIT->lat), sizeof(int));
|
||||
// std::cout << "serializing: " << nodesIT->id << ", lat: " << nodesIT->lat << ", lon: " << nodesIT->lon << std::endl;
|
||||
// std::cout << "serializing: " << nodesIT->id << ", lat: " << nodesIT->lat << ", lon: " << nodesIT->lon << std::endl;
|
||||
usedNodeCounter++;
|
||||
usedNodeIDsIT++;
|
||||
nodesIT++;
|
||||
|
1
extractor.ini
Normal file
1
extractor.ini
Normal file
@ -0,0 +1 @@
|
||||
Memory = 2
|
Loading…
Reference in New Issue
Block a user