[Speed] Upgrade pybind from 2.1 to 2.2
Created by: tonyyang-svail
To use py::call_guard
, pybind11 version needs to be at least 2.2.
The current implementation of python exe.run
will hold the python GIL and blocks other python threads. Because by default, "When calling a C++ function from Python, the GIL is always held."
One way to release the lock is through py::call_guard<py::gil_scoped_release>()
.
m.def("call_go", &call_go, py::call_guard<py::gil_scoped_release>());
Links:
- pybind11 official documentation: https://github.com/pybind/pybind11/blob/master/docs/advanced/misc.rst#global-interpreter-lock-gil
- Usage in other project: