文档
注册

RegisterExternalAllocator

函数功能

用户将自己的Allocator注册给GE,适用于使用用户的内存池场景。

函数原型

Status RegisterExternalAllocator(const void *const stream, AllocatorPtr allocator);

参数说明

参数名

输入/输出

描述

stream

输入

指定allocator注册在哪个Stream上。

allocator

输入

用户allocator对象的智能指针。allocator基于Allocator类派生。

返回值

参数名

类型

描述

-

Status

SUCCESS:设置成功。

FAILED:设置失败。

约束说明

  • 此接口需要配合RunGraphWithStreamAsync接口使用,并且需要在RunGraphWithStreamAsync接口调用前注册。
  • 对于同一条流,多次调用本接口,以最后一次注册为准。
  • 对于不同流,如果用户使用同一个Allocator,不可以多条流并发执行,在执行下一条Stream前,需要对上一Stream做流同步。
  • 将Allocator中的内存释放给操作系统前,需要先调用aclrtSynchronizeStream接口执行流同步,确保Stream中的任务已执行完成。
搜索结果
找到“0”个结果

当前产品无相关内容

未找到相关内容,请尝试其他搜索词