ExecuteGraphWithStreamAsync
产品支持情况
头文件/库文件
- 头文件:#include <ge/ge_api.h>
- 库文件:libge_runner.so
功能说明
异步运行指定ID对应的Graph图,输出执行结果。
此函数与RunGraphWithStreamAsync均用于运行指定ID对应的图并输出结果。与RunGraphWithStreamAsync不同的是:
- 该接口运行前需要完成CompileGraph及LoadGraph(异步运行Graph场景)流程。
- 该接口inputs和outputs数据类型为gert::Tensor。
函数原型
Status ExecuteGraphWithStreamAsync(uint32_t graph_id, void *stream,const std::vector<gert::Tensor> &inputs,std::vector<gert::Tensor> &outputs)
参数说明
|
如果通过options指定了ge.exec.hostInputIndexes参数,对应索引的Tensor可以为Host上的内存空间。 |
||
返回值说明
约束说明
-
调用该接口前,请先分配好Tensor需要使用的内存。
-
调用该接口前,需要完成CompileGraph及LoadGraph流程。
-
调用该接口前,需要通过acl提供的aclrtCreateStream接口创建Stream。
-
得到输出运行结果前,需要通过acl提供的aclrtSynchronizeStream接口保证Stream上的任务已经执行完。
接口详细说明请参见《应用开发指南 (C&C++)》。
调用示例
请参见异步运行Graph。