函数:host_register
产品支持情况
产品 |
是否支持 |
---|---|
√ |
|
√ |
|
√ |
|
x |
|
x |
|
x |
函数原型
- C函数原型
1
aclError aclrtHostRegister(void *ptr, uint64_t size, aclrtHostRegisterType type, void **devPtr)
- python函数
1
dev_ptr, ret = acl.rt.host_register(ptr, size, type)
参数说明
参数名 |
说明 |
---|---|
ptr |
int,Host内存地址。Host内存地址需4K页对齐。当os内核版本为5.10或更低时,使用非锁页内存会导致异常,因此必须调用acl.rt.malloc_host接口来申请Host内存;当os内核版本为5.10以上时,支持使用非锁页的Host内存,因此也支持不调用acl.rt.malloc_host接口申请Host内存。 |
size |
int,内存大小,单位Byte。 |
type |
int,内存注册类型。当前仅支持ACL_HOST_REGISTER_MAPPED,表示将Host内存映射注册为Devcie可访问的。 |
返回值说明
返回值 |
说明 |
---|---|
dev_ptr |
int,Host内存映射成的Device可访问的内存地址。 |
ret |
int,错误码,返回0表示成功,返回其它值表示失败。 |
父主题: 内存管理