Fetching number of threads from extractor.ini

This commit is contained in:
DennisOSRM 2012-11-22 17:23:31 +01:00
parent 6003ae7406
commit a790ffc2d1

View File

@ -32,6 +32,7 @@ or see http://www.gnu.org/licenses/agpl.txt.
#include "Util/BaseConfiguration.h"
#include "Util/InputFileUtil.h"
#include "Util/MachineInfo.h"
#include "Util/StringUtil.h"
typedef BaseConfiguration ExtractorConfiguration;
@ -42,6 +43,16 @@ int main (int argc, char *argv[]) {
ERR("usage: \n" << argv[0] << " <file.osm/.osm.bz2/.osm.pbf> [<profile.lua>]");
}
unsigned numberOfThreads = omp_get_num_procs();
if(testDataFile("extractor.ini")) {
ExtractorConfiguration extractorConfig("extractor.ini");
unsigned rawNumber = stringToInt(extractorConfig.GetParameter("Threads"));
if( rawNumber != 0 && rawNumber <= numberOfThreads)
numberOfThreads = rawNumber;
}
omp_set_num_threads(numberOfThreads);
INFO("extracting data from input file " << argv[1]);
bool isPBF(false);
std::string outputFileName(argv[1]);