Skip to content

Commit

Permalink
Scoped GIL release in run_with_iobinding (#11248)
Browse files Browse the repository at this point in the history
  • Loading branch information
yuslepukhin authored Apr 18, 2022
1 parent dec9965 commit 98faaa7
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions onnxruntime/python/onnxruntime_pybind_state.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1547,6 +1547,8 @@ including arg name, arg type (contains both type and shape).)pbdoc")
py::return_value_policy::reference_internal)
.def("run_with_iobinding", [](PyInferenceSession* sess, SessionIOBinding& io_binding, RunOptions* run_options = nullptr) -> void {
Status status;
// release GIL to allow multiple python threads to invoke Run() in parallel.
py::gil_scoped_release release;
if (!run_options)
status = sess->GetSessionHandle()->Run(*io_binding.Get());
else
Expand Down

0 comments on commit 98faaa7

Please sign in to comment.