---
title: kpccl_egroup_create
description: "创建kpccl egroup，即kpccl executor的集合。"
url: https://www.hikunpeng.com/document/detail/zh/hpchistory/hpckit/develop2400/KunoengHPCKit_developer_021.html
sourcePath: /source/zh/hpchistory/hpckit/develop2400/KunoengHPCKit_developer_021.html
indexId: bcae4b6b99489cd5081d7de763194d37992bd063588090ffa8c58187f691a68c73
---
# kpccl_egroup_create

创建kpccl egroup，即kpccl executor的集合。

#### 接口定义

kpccl_egroup_h kpccl_egroup_create(int *executors, int executors_num);


#### 参数


**表1 参数定义**

| 参数名 | 类型 | 描述 | 输入/输出 |
| --- | --- | --- | --- |
| executors | int \* | 组成egroup的executor，具体参数传入方式为将需要构成集合的执行器的编号赋值给该数组 约束：0≤executors[i]≤kpccl\_get\_num\_executors() | 输入 |
| executors\_num | int | egroup中executor数量 约束：0≤executors\_num≤kpccl\_get\_num\_executors() | 输入 |


#### 返回值

- 成功：返回创建的egroup
- 失败：返回nullptr


#### 示例

```
#include <stdio.h>
#include "kpccl.h"
int main()
{
int executor_num = kpccl_get_num_executors();
int executors[executor_num];
for (int i =0; i < executor_num; i++) {
executors[i] = i;
}
kpccl_egroup_h egroup =
kpccl_egroup_create
(executors, executor_num);
kpccl_egroup_destroy(egroup);
return 0;
}
```

上述示例演示了创建、销毁一个egroup的流程。kpccl_egroup_create函数创建了一个包含所有executor执行器的egroup。
