MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle / eager_api_run_program

Function eager_api_run_program

paddle/fluid/pybind/eager_custom_python_api.h:80–158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78}
79
80static PyObject *eager_api_run_program(PyObject *self,
81 PyObject *args,
82 PyObject *kwargs) {
83 PyThreadState *tstate = nullptr;
84 try {
85 auto X_info = GetPyArgumentInfo("run_program", "X", args, 0, true);
86 TensorListBufferAllocator X_allocator(X_info.second);
87 auto &X = GetTensorListFromArgsWithBuffer("run_program",
88 "X",
89 0,
90 nullptr,
91 X_info.first,
92 X_info.second,
93 X_allocator);
94
95 auto Params_info =
96 GetPyArgumentInfo("run_program", "Params", args, 1, true);
97 TensorListBufferAllocator Params_allocator(Params_info.second);
98 auto &Params = GetTensorListFromArgsWithBuffer("run_program",
99 "Params",
100 0,
101 nullptr,
102 Params_info.first,
103 Params_info.second,
104 Params_allocator);
105
106 auto OutScope =
107 GetScopePtrListFromArgs("run_program", "OutScope", args, 2, false);
108 const phi::distributed::ProcessMesh *mesh = nullptr;
109 if (InputsContainDistTensor(&mesh, X, Params)) {
110 X = GetTensorListFromArgsWithBuffer("run_program",
111 "X",
112 0,
113 nullptr,
114 X_info.first,
115 X_info.second,
116 X_allocator);
117 Params = GetTensorListFromArgsWithBuffer("run_program",
118 "Params",
119 0,
120 nullptr,
121 Params_info.first,
122 Params_info.second,
123 Params_allocator);
124 }
125 VLOG(6) << "Start PIR GetProgramAttributesMapPtrFromPyArgs";
126 auto prog_attrs_ptr =
127 GetProgramAttributesMapPtrFromPyArgs("run_program", args, 3);
128 VLOG(6) << "Finish PIR GetProgramAttributesMapPtrFromPyArgs";
129
130 VLOG(6) << "Start PIR ConstructCudaGraphAttrMapForRunProgram";
131 paddle::framework::AttributeMap cuda_graph_attrs;
132 ConstructCudaGraphAttrMapForRunProgram(
133 "run_program", args, 4, cuda_graph_attrs);
134 VLOG(6) << "Finish PIR ConstructCudaGraphAttrMapForRunProgram";
135 tstate = PyEval_SaveThread();
136 auto out = egr::to_static::run_program_ad_func(
137 X, Params, OutScope, *prog_attrs_ptr, cuda_graph_attrs);

Callers

nothing calls this directly

Calls 11

GetPyArgumentInfoFunction · 0.85
GetScopePtrListFromArgsFunction · 0.85
InputsContainDistTensorFunction · 0.85
run_program_ad_funcFunction · 0.85
ThrowExceptionToPythonFunction · 0.85
set_error_strMethod · 0.80
ToPyObjectFunction · 0.70
whatMethod · 0.45
strMethod · 0.45

Tested by

no test coverage detected