Browse Source

add release gil

tags/v1.2.0-rc1
liyong 4 years ago
parent
commit
256e0f7c07
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      mindspore/ccsrc/pipeline/pynative/pynative_execute.cc

+ 5
- 1
mindspore/ccsrc/pipeline/pynative/pynative_execute.cc View File

@@ -1490,7 +1490,11 @@ py::object PynativeExecutor::RunOpInMs(const OpExecInfoPtr &op_exec_info, Pynati
op_exec_info->next_input_index};
#endif
VectorRef outputs;
session->RunOp(&op_run_info, graph_info, &input_tensors, &outputs, tensors_mask);
{
// Release GIL before calling into (potentially long-running) C++ code
py::gil_scoped_release release;
session->RunOp(&op_run_info, graph_info, &input_tensors, &outputs, tensors_mask);
}
if (op_exec_info->is_dynamic_shape) {
op_exec_info->abstract = op_run_info.abstract;
}


Loading…
Cancel
Save