comparison src/Silvet.cpp @ 347:eee4c7fd15ab

Annoyingly, getting crashes in the tester when using C++11 futures -- for now simply disable that, but it'll need looking into
author Chris Cannam
date Wed, 12 Aug 2015 16:03:53 +0100
parents c9a0015413e2
children 071fd5e7b168
comparison
equal deleted inserted replaced
346:5acce45e2ec6 347:eee4c7fd15ab
741 if (emThreadCount > 1) { 741 if (emThreadCount > 1) {
742 for (int i = 0; i < width; ) { 742 for (int i = 0; i < width; ) {
743 typedef future<pair<vector<double>, vector<int>>> EMFuture; 743 typedef future<pair<vector<double>, vector<int>>> EMFuture;
744 vector<EMFuture> results; 744 vector<EMFuture> results;
745 for (int j = 0; j < emThreadCount && i + j < width; ++j) { 745 for (int j = 0; j < emThreadCount && i + j < width; ++j) {
746 cerr << "creating future " << j << " (i = " << i << ", width = " << width << ")" << endl;
746 results.push_back 747 results.push_back
747 (async(std::launch::async, 748 (async(std::launch::async,
748 [&](int index) { 749 [&](int index) {
749 return applyEM(pack, filtered.at(index)); 750 return applyEM(pack, filtered.at(index));
750 }, i + j)); 751 }, i + j));
751 } 752 }
752 for (int j = 0; j < emThreadCount && i + j < width; ++j) { 753 for (int j = 0; j < emThreadCount && i + j < width; ++j) {
754 cerr << "reaping future " << j << " (i = " << i << ", width = " << width << ")" << endl;
753 auto out = results[j].get(); 755 auto out = results[j].get();
754 localPitches[i+j] = out.first; 756 localPitches[i+j] = out.first;
755 if (wantShifts) localBestShifts[i+j] = out.second; 757 if (wantShifts) localBestShifts[i+j] = out.second;
756 } 758 }
757 i += emThreadCount; 759 i += emThreadCount;