PYTHON API

class AclShmemInitAttr

  • 参数:

    context – [in] 用户传入的context指针,context结构体类型为aclshmem_host_aicore_context_t。

    rank_size - PE总数

    rank - 当前PE编号

    rank_table_path - 环境配置文件路径

    root_info - hccl生成的root info

enum MemType

  • 参数:

    enumerator HOST_SIDE = 0

    enumerator DEVICE_SIDE = 1

aclshmem_init_attr

aclshmem_init_attr(flags: int, attr: AclShmemInitAttr) -> int
  • 初始化aclshmem

    • 参数:

      • flags – [in] aclshmem控制面通信使用的方式

      • attr – [in] aclshmem相应的初始化信息

    • 返回: 错误码

aclshmem_malloc

aclshmem_malloc(size: int, mem_type: MemType) -> int
  • 申请一块aclshmem对称内存,该内存中数据未被初始化

    • 参数:

      • size – [in] 内存申请大小(bytes)

      • mem_type – [in] 对称内存申请位置(Host/Device)

    • 返回: 对称内存指针

aclshmem_calloc

aclshmem_calloc(nmemb: int, size: int, mem_type: MemType) -> int
  • 申请一块shmem对称内存,并初始化内容为全

    • 参数:

      • nmemb – [in] 元素个数

      • size – [in] 每个元素所占字节数

      • mem_type – [in] 对称内存申请位置(Host/Device)

    • 返回: 对称内存指针

aclshmem_align

aclshmem_align(alignment: int, size: int, mem_type: MemType) -> int
  • 申请一块shmem对称内存,并按指定长度对齐

    • 参数:

      • alignment – [in] 对齐长度(bytes)

      • size – [in] 内存申请大小(bytes)

      • mem_type – [in] 对称内存申请位置(Host/Device)

    • 返回: 对称内存指针

aclshmem_free

aclshmem_free(ptr: int, mem_type: MemType) -> None
  • 释放申请的对称内存

    • 参数: ptr – [in] 需要释放的内存指针

aclshmem_finalize

aclshmem_finalize() -> None
  • 释放所有aclshmem使用的资源