mirror of
https://github.com/rdkit/rdkit.git
synced 2026-06-03 21:44:30 +08:00
A few improvements to SubstructLibrary (#3557)
* - enable SubstructLibrary to build without threading support - enforce consistency across single- and multi-threaded runs - improve performance on single-threaded runs avoiding overhead of spawning threads - consolidate internalCountMatches and internalGetMatches into one function to reduce code duplication - fix a bug in Python CountMatches whjich would run on 1000 threads * reverted Code/GraphMol/SubstructLibrary/Wrap/SubstructLibraryWrap.cpp as it is now in its own PR (#3558) * - added missing cast - removed unnecessary std::make_move_iterator - added Brian's test Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
This commit is contained in:
@@ -45,16 +45,15 @@ void addPatterns(SubstructLibrary &sslib, int numThreads) {
|
||||
for (int thread_group_idx = 0; thread_group_idx < numThreads;
|
||||
++thread_group_idx) {
|
||||
// need to use std::ref otherwise things are passed by value
|
||||
thread_group.emplace_back(
|
||||
std::async(std::launch::async, fillPatterns,
|
||||
std::ref(sslib), std::ref(*ptr.get()), std::ref(fps),
|
||||
startIdx + thread_group_idx, endIdx, numThreads));
|
||||
thread_group.emplace_back(std::async(
|
||||
std::launch::async, fillPatterns, std::ref(sslib), std::ref(*ptr),
|
||||
std::ref(fps), startIdx + thread_group_idx, endIdx, numThreads));
|
||||
}
|
||||
for (auto &fut : thread_group) {
|
||||
fut.get();
|
||||
}
|
||||
#else
|
||||
fillPaterns(lib, fps, 0, sslib.size(), 1);
|
||||
fillPatterns(sslib, *ptr, fps, 0, sslib.size(), 1);
|
||||
#endif
|
||||
if (ptr->size() != sslib.size()) {
|
||||
throw ValueErrorException("Number of fingerprints generated not equal to current number of molecules");
|
||||
|
||||
Reference in New Issue
Block a user