---
title: 函数：register_cpu_func
description: "| 产品 | 是否支持 |"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/API/runtimeapi/aclpythondevg_01_1084.html
sourcePath: /source/zh/canncommercial/900/API/runtimeapi/aclpythondevg_01_1084.html
indexId: a55ba5f52adaaf6b7f0045fe19f0e407fcaf4764967cb9238463020dd9a1be0071
---
# 函数：register_cpu_func

#### 产品支持情况

| 产品 | 是否支持 |
| --- | --- |
| Atlas 350 加速卡 | √ |
| Atlas A3 训练系列产品 / Atlas A3 推理系列产品 | √ |
| Atlas A2 训练系列产品 / Atlas A2 推理系列产品 | √ |
| Atlas 训练系列产品 | √ |
| Atlas 推理系列产品 | √ |
| Atlas 200I/500 A2 推理产品 | √ |


#### 功能说明

若使用acl.rt.binary_load_from_data接口加载AI CPU算子二进制数据，还需配合使用本接口注册AI CPU算子信息，得到对应的func_handle。本接口只用于AI CPU算子，其它算子会返回报错ACL_ERROR_RT_PARAM_INVALID。


#### 函数原型

- C函数原型
  1 aclError aclrtRegisterCpuFunc(const aclrtBinHandle handle, const char *funcName, const char *kernelName, aclrtFuncHandle *funcHandle)

- python函数
  1 func_handle, ret = acl.rt.register_cpu_func(bin_handle, func_name, kernel_name)


#### 参数说明

| 参数名 | 说明 |
| --- | --- |
| bin\_handle | int，算子二进制句柄。调用acl.rt.binary\_load\_from\_data接口获取算子二进制句柄，再将其作为入参传入本接口。 |
| func\_name | str，执行AI CPU算子的入口函数。不能为空。 |
| kernel\_name | str，AI CPU算子的opType。不能为空。 |


#### 返回值说明

| 返回值 | 说明 |
| --- | --- |
| func\_handle | int，核函数句柄。 |
| ret | int，返回0表示成功，返回其他值表示失败。 |
