-
Notifications
You must be signed in to change notification settings - Fork 845
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes #629 - python GetSubstructureMatch thread safety #637
Fixes #629 - python GetSubstructureMatch thread safety #637
Conversation
If RDK_THREADSAFE_SSS is not set, should we release the GIL at all? The default is to always release the GIL which seems... optimistic. |
I checked the rest of the GIL releases, it appears this one was the only borked one, I'll write some MT tests over the next few days. |
I've never done enough multi-threading in python to really have much of a grasp of this stuff. When I've wanted to do parallel work, I've tended to use things like multiprocessing. I believe it only makes sense to release the GIL around substructure matching if RDK_THREADSAFE_SSS is set. If that flag is not set and there is a recursive SMARTS component of the query, it will generate incorrect results if that query is being applied to multiple molecules at the same time. |
Re: testing |
MatchVectType matches; | ||
SubstructMatch(mol,query,matches,true,useChirality,useQueryQueryMatches); | ||
{ | ||
NOGIL gil; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about modifying the NOGIL definition so that it only does anything if the thread safety flag (RDK_BUILD_THREADSAFE_SSS) is set?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's my plan.
Brian Kelley
On Oct 14, 2015, at 12:25 AM, Greg Landrum notifications@github.com wrote:
In Code/GraphMol/Wrap/Mol.cpp:
MatchVectType matches;
- SubstructMatch(mol,query,matches,true,useChirality,useQueryQueryMatches);
- {
How about modifying the NOGIL definition so that it only does anything if the thread safety flag (RDK_BUILD_THREADSAFE_SSS) is set?NOGIL gil;
—
Reply to this email directly or view it on GitHub.
Never/ever call the Python API when the GIL is released.
Also releases the GIL during GetSubstructMatches.
Any ideas how to add a test case for this? Do we know when to test threading?