Browse Source

Centralize thread count suggestion

remotes/origin/HEAD
Mike 3 years ago
parent
commit
1d901ccc01
2 changed files with 15 additions and 1 deletions
  1. +13
    -1
      Population.cpp
  2. +2
    -0
      Population.h

+ 13
- 1
Population.cpp View File

@ -282,7 +282,7 @@ namespace BitEvolver
;
//
thread_count = std::thread::hardware_concurrency();
thread_count = this->GetThreadCountSuggestion();
//
for ( i=0; i<thread_count; i++) {
@ -377,6 +377,18 @@ namespace BitEvolver
//
return this->chromosomes[chromosome_index];
}
//
int Population::GetThreadCountSuggestion()
{
//
int thread_count;
//
thread_count = std::thread::hardware_concurrency();
return thread_count;
}
};


+ 2
- 0
Population.h View File

@ -89,6 +89,8 @@ namespace BitEvolver
std::shared_ptr<Chromosome> BreedChild();
std::shared_ptr<Chromosome> PickChromosomeForBreeding();
//
int GetThreadCountSuggestion();
};
};


Loading…
Cancel
Save