Centralize thread count suggestion

This commit is contained in:
Mike 2018-04-14 00:28:50 -07:00
parent 854ad5a1a3
commit 1d901ccc01
2 changed files with 15 additions and 1 deletions

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

View File

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