PYTHON APIs
class AclshmemInitAttr
参数:
rank_size - PE总数
rank - 当前PE编号
rank_table_path - 环境配置文件路径
root_info - hccl生成的root info
enum AclshmemMemType
参数:
enumerator HOST_SIDE = 0
enumerator DEVICE_SIDE = 1
aclshmemx_init_attr
aclshmemx_init_attr(flags: int, attr: AclshmemInitAttr) -> int
初始化aclshmem
参数:
flags – [in] aclshmem控制面通信使用的方式
attr – [in] aclshmem相应的初始化信息
返回: 错误码
aclshmem_malloc
aclshmem_malloc(size: int, mem_type: AclshmemMemType) -> int
申请一块aclshmem对称内存,该内存中数据未被初始化
参数:
size – [in] 内存申请大小(bytes)
mem_type – [in] 对称内存申请位置(Host/Device)
返回: 对称内存指针
aclshmem_calloc
aclshmem_calloc(nmemb: int, size: int, mem_type: AclshmemMemType) -> int
申请一块shmem对称内存,并初始化内容为全
参数:
nmemb – [in] 元素个数
size – [in] 每个元素所占字节数
mem_type – [in] 对称内存申请位置(Host/Device)
返回: 对称内存指针
aclshmem_align
aclshmem_align(alignment: int, size: int, mem_type: AclshmemMemType) -> int
申请一块shmem对称内存,并按指定长度对齐
参数:
alignment – [in] 对齐长度(bytes)
size – [in] 内存申请大小(bytes)
mem_type – [in] 对称内存申请位置(Host/Device)
返回: 对称内存指针
aclshmem_free
aclshmem_free(ptr: int, mem_type: AclshmemMemType) -> None
释放申请的对称内存
参数: ptr – [in] 需要释放的内存指针
aclshmem_finalize
aclshmem_finalize() -> None
释放所有aclshmem使用的资源