Merge pull request #134 from mapbox/fixshards

Round the number of threads to use down to a power of 2
This commit is contained in:
Eric Fischer 2015-12-22 10:35:22 -08:00
commit a9ad1d99df

View File

@ -70,6 +70,9 @@ void init_cpus() {
CPUS = 1; CPUS = 1;
} }
// Round down to a power of 2
CPUS = 1 << (int) (log(CPUS) / log(2));
TEMP_FILES = 64; TEMP_FILES = 64;
struct rlimit rl; struct rlimit rl;
if (getrlimit(RLIMIT_NOFILE, &rl) != 0) { if (getrlimit(RLIMIT_NOFILE, &rl) != 0) {