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

Release GIL inside optimize? #839

Open
safijari opened this issue Oct 31, 2024 · 3 comments
Open

Release GIL inside optimize? #839

safijari opened this issue Oct 31, 2024 · 3 comments

Comments

@safijari
Copy link

Wondering if there any reason to retain the GIL in this function?

.def("optimize", &CLS::optimize, "iterations"_a,

I'm running into a situation where some times an optimization can take a very long time (in the order of minutes) and because this call does not release the GIL it starves out some background threads meant for telemetry.

RainerKuemmerle added a commit that referenced this issue Nov 1, 2024
@RainerKuemmerle
Copy link
Owner

I have to admit that I did so far not think about this that much. Mostly used the Python binding so far to quickly prototype and visualize some data.

Reading the documentation (https://pybind11.readthedocs.io/en/stable/advanced/misc.html#global-interpreter-lock-gil) I believe we can release the GIL.

Would be great if you can test the branch and provide feedback here. Thanks.

@safijari
Copy link
Author

safijari commented Nov 4, 2024

Are wheels saved anywhere that I could grab and install?

@RainerKuemmerle
Copy link
Owner

Not for updated g2o. You'd have to build yourself. Probably best done in a python venv.

git clone --recurse-submodules https://github.com/miquelmassot/g2o-python.git
cd g2o-python/g2o
git remote set-url origin https://github.com/RainerKuemmerle/g2o.git
git fetch -tp
git co pymem-gil-optimize
cd ..
pip install -v .

RainerKuemmerle added a commit that referenced this issue Nov 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants