Commit 3a6abe9f authored by sgebreeg's avatar sgebreeg
Browse files

checks if trees exceed cpus before starting concurrency

parent 89427173
......@@ -46,6 +46,8 @@ RandomForest::RandomForest(vector <vector<string>> trainingData, vector <Feature
this->depth = maxDepth;
unsigned num_cpus = std::thread::hardware_concurrency();
if(numTrees < num_cpus)
num_cpus = numTrees;
// A mutex ensures orderly access.
std::mutex iomutex;
std::vector <std::thread> threads(num_cpus);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment