GeSessionGraphDebugJSONPrint
Header File/Library File
- Header file: #include <ge/ge_api.h>
- Library file: libge_runner.so
Function Usage
Exports runtime task information from a graph in JSON format, including stream ID, task ID, task type, and other details after the graph is loaded in maintenance and testing scenarios. Then, you can view the task visualization information in tracing mode (for example , chrome://tracing/).
If the GeSessionGraphDebugJSONPrint API is not called, when GeSessionLoadGraph is called, set the following environment variables to generate the JSON file of the running task information:
export DUMP_GE_GRAPH=1
The generated JSON file directory complies with the following rules and the file is named in the debug_graph_{graph_id}_{time}_{pid}_{seq} format:
- If the environment variable NPU_COLLECT_PATH is specified, the generated JSON file is stored in the ${NPU_COLLECT_PATH}/extra-info/ directory.
- If the environment variable DUMP_GRAPH_PATH is specified, the generated JSON file is stored in the ${DUMP_GRAPH_PATH}/ directory.
- If no environment variable is specified, the generated JSON file is stored in the current script execution directory.
For details about the environment variables, see Environment Variables.
Prototype
1 | ge::Status GeSessionGraphDebugJSONPrint(ge::Session &session, uint32_t graph_id, uint32_t flags, ge::AscendString &json_result); |
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
session |
Input |
Session instance of the graph to be loaded. |
graph_id |
Input |
ID of the graph to be exported. |
flags |
Input |
Reserved. The value is fixed at 0. |
json_result |
Output |
Task information in the graph, in JSON format. |
Returns
Parameter |
Type |
Description |
|---|---|---|
- |
Status |
GE_RTI_MODEL_NOT_LOADED: The graph is not loaded. SUCCESS: The information is successfully exported. FAILED: The information fails to be exported. |
Restrictions
- The device memory must be allocated before this API call.
- The CompileGraph and GeSessionLoadGraph processes must be completed before this API call.
Example
1 2 3 4 5 | ge::Session session; uint32_t graph_id = 1; // Assume that the graph has been loaded. uint32_t flags = 0; ge::AscendString json_result; ge::Status ret = GeSessionGraphDebugJSONPrint(session, graphId, flags, json_result); |