Skip to content
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

[Python] release/acquire Global Interpreter Lock (GIL) #2230

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

tnarihi
Copy link
Contributor

@tnarihi tnarihi commented Mar 30, 2015

Dependencies: #2149 #2001

The final commit only mentions this PR. This releases GIL in CPU-intensive operation in C++ side such as Forward and Backward. This will allow us, for example, to prefetch in data layers in Python using a different thread (not process) while other layers are running.

Now we can keep the exception information on Python interpreter. This is
usefull if you are working on Python interface. You can catch the right
Exception class when error occurs in your `PythonLayer`. Now we don't
use `PyErr_Print` that clears exceptions. We use `PyErr_Fetch` to get
the information and `PyErr_Restore` to restore the exceptions back. And
I find that `bp::import` or `bp::object::attr` breaks Python interpreter
if a module or an attribute doesn't exist. We now use `bp::exec` and
`bp::eval` to keep Python interpreter working even after errors occur. I
got the hint from the following page.

http://boost.2283326.n4.nabble.com/embedded-python-td2702335.html

And I also modified to use `bp::object` for `self_` member.
* Modified Makefile to link boost_regex for PythonLayer.
* Travis installs boost_regex
* Add a note of a new dependency boost_regex on Makefile.config.example
LayerParamter methods not to use raw_function
Layer methods not to use raw_function
Conflicts:
	python/caffe/_caffe.cpp
@moi90
Copy link

moi90 commented Dec 28, 2015

Any progress on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants