LoadGraph
Description
- Distributed build and partitioning of foundation models:
Loads the OM offline model to the current session and associates the model with GraphId based on the passed graph ID. After LoadGraph is successfully executed, RunGraph can be used to specify GraphId.
- Asynchronous graph execution:
Binds a graph with the specified graph ID to the corresponding stream. After LoadGraph is successfully executed, you can use ExecuteGraphWithStreamAsync to execute the graph.
Prototype
- Distributed build and partitioning of foundation models:
Status LoadGraph(const uint32_t graph_id, const std::map<std::string, std::string> &options, const std::string &om_file_path) const;
- Asynchronous graph execution:
Status LoadGraph(const uint32_t graph_id, const std::map<AscendString, AscendString> &options, void *stream) const;
Parameters
|
Parameter |
Input/Output |
Description |
|---|---|---|
|
graph_id |
Input |
ID of the graph to be executed. |
|
options |
Input |
Option that may be used in the execution phase. A key-value mapping table, for the graph configuration. key indicates the option type, and value indicates the option value. Generally, this parameter can be left empty, indicating using the same options configuration passed to GEInitialize.
|
|
om_file_path (distributed build and partitioning of foundation models) |
Input |
Path of the OM offline model. |
|
stream (asynchronous graph execution) |
Input |
Graph execution flow. |
Returns
|
Parameter |
Type |
Description |
|---|---|---|
|
- |
Status |
GE_CLI_SESS_RUN_FAILED: Serialization failed when a subgraph is executed. SUCCESS: Subgraph executed successfully. FAILED: Failed to execute the subgraph. |
Restrictions
- Distributed build and partitioning of foundation models:
- Only models used for distributed deployment can be loaded, that is, offline models generated after --distributed_cluster_build=1 is enabled by the ATC tool or DISTRIBUTED_CLUSTER_BUILD is enabled by Graph Build to an Offline Model during model compilation. If this API is used to load other offline models, the models will be verified, and a failure message will be returned.
- If offline models loaded by calling this API contain variables, a failure message is returned.
- Asynchronous graph execution:
Before calling this API, ensure that the CompileGraph process has been completed and the API must be used together with ExecuteGraphWithStreamAsync.